diff options
author | Tom Rini | 2020-08-25 08:19:41 -0400 |
---|---|---|
committer | Tom Rini | 2020-08-25 08:19:41 -0400 |
commit | ec54217ddc6f52f3b7dad7a3fd6d8a3abd64ab7e (patch) | |
tree | a21492265223b0b77472eb86f34cbff30add6f36 /drivers | |
parent | e49a9d4ddb10f0047ba0f292e0eb9f07a8f6f5f0 (diff) | |
parent | 660606091f12320210cb7ced018788b8028aab5f (diff) |
Merge tag 'i2c-bugfixes-for-v2020.10' of https://gitlab.denx.de/u-boot/custodians/u-boot-i2c
i2c bugfixes for v2020.10
- fix some issues with octeon_i2c driver on ARM Octeon TX2
- fix link failure with CONFIG_SPL and CONFIG_I2C_MUX_PCA954x
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/Makefile | 2 | ||||
-rw-r--r-- | drivers/i2c/muxes/Makefile | 2 | ||||
-rw-r--r-- | drivers/i2c/octeon_i2c.c | 59 |
3 files changed, 28 insertions, 35 deletions
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index e851ec462ec..f7b27864488 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile @@ -46,4 +46,4 @@ obj-$(CONFIG_SYS_I2C_VERSATILE) += i2c-versatile.o obj-$(CONFIG_SYS_I2C_XILINX_XIIC) += xilinx_xiic.o obj-$(CONFIG_TEGRA186_BPMP_I2C) += tegra186_bpmp_i2c.o -obj-$(CONFIG_I2C_MUX) += muxes/ +obj-$(CONFIG_$(SPL_)I2C_MUX) += muxes/ diff --git a/drivers/i2c/muxes/Makefile b/drivers/i2c/muxes/Makefile index 68ed9b547dd..b690821199f 100644 --- a/drivers/i2c/muxes/Makefile +++ b/drivers/i2c/muxes/Makefile @@ -2,6 +2,6 @@ # # Copyright (c) 2015 Google, Inc obj-$(CONFIG_I2C_ARB_GPIO_CHALLENGE) += i2c-arb-gpio-challenge.o -obj-$(CONFIG_$(SPL_)I2C_MUX) += i2c-mux-uclass.o +obj-$(CONFIG_I2C_MUX) += i2c-mux-uclass.o obj-$(CONFIG_I2C_MUX_PCA954x) += pca954x.o obj-$(CONFIG_I2C_MUX_GPIO) += i2c-mux-gpio.o diff --git a/drivers/i2c/octeon_i2c.c b/drivers/i2c/octeon_i2c.c index c11d6ff93d1..23dcb1563ea 100644 --- a/drivers/i2c/octeon_i2c.c +++ b/drivers/i2c/octeon_i2c.c @@ -3,11 +3,10 @@ * Copyright (C) 2018 Marvell International Ltd. */ -#include <common.h> #include <clk.h> #include <dm.h> #include <i2c.h> -#include <pci_ids.h> +#include <time.h> #include <asm/io.h> #include <linux/bitfield.h> #include <linux/compat.h> @@ -749,6 +748,27 @@ static int octeon_i2c_set_bus_speed(struct udevice *bus, unsigned int speed) return 0; } +static const struct octeon_i2c_data i2c_octeon_data = { + .probe = PROBE_DT, + .reg_offs = 0x0000, + .thp = 3, + .clk_method = CLK_METHOD_OCTEON, +}; + +static const struct octeon_i2c_data i2c_octeontx_data = { + .probe = PROBE_PCI, + .reg_offs = 0x1000, + .thp = 24, + .clk_method = CLK_METHOD_OCTEON, +}; + +static const struct octeon_i2c_data i2c_octeontx2_data = { + .probe = PROBE_PCI, + .reg_offs = 0x1000, + .thp = 3, + .clk_method = CLK_METHOD_OCTEONTX2, +}; + /** * Driver probe function * @@ -761,6 +781,10 @@ static int octeon_i2c_probe(struct udevice *dev) u32 i2c_slave_addr; int ret; + /* Octeon TX2 needs a different data struct */ + if (device_is_compatible(dev, "cavium,thunderx-i2c")) + dev->driver_data = (long)&i2c_octeontx2_data; + twsi->data = (const struct octeon_i2c_data *)dev_get_driver_data(dev); if (twsi->data->probe == PROBE_PCI) { @@ -798,34 +822,11 @@ static const struct dm_i2c_ops octeon_i2c_ops = { .set_bus_speed = octeon_i2c_set_bus_speed, }; -static const struct octeon_i2c_data i2c_octeon_data = { - .probe = PROBE_DT, - .reg_offs = 0x0000, - .thp = 3, - .clk_method = CLK_METHOD_OCTEON, -}; - -static const struct octeon_i2c_data i2c_octeontx_data = { - .probe = PROBE_PCI, - .reg_offs = 0x8000, - .thp = 3, - .clk_method = CLK_METHOD_OCTEON, -}; - -static const struct octeon_i2c_data i2c_octeontx2_data = { - .probe = PROBE_PCI, - .reg_offs = 0x8000, - .thp = 24, - .clk_method = CLK_METHOD_OCTEONTX2, -}; - static const struct udevice_id octeon_i2c_ids[] = { { .compatible = "cavium,octeon-7890-twsi", .data = (ulong)&i2c_octeon_data }, { .compatible = "cavium,thunder-8890-twsi", .data = (ulong)&i2c_octeontx_data }, - { .compatible = "cavium,thunder2-99xx-twsi", - .data = (ulong)&i2c_octeontx2_data }, { } }; @@ -837,11 +838,3 @@ U_BOOT_DRIVER(octeon_pci_twsi) = { .priv_auto_alloc_size = sizeof(struct octeon_twsi), .ops = &octeon_i2c_ops, }; - -static struct pci_device_id octeon_twsi_supported[] = { - { PCI_VDEVICE(CAVIUM, PCI_DEVICE_ID_CAVIUM_TWSI), - .driver_data = (ulong)&i2c_octeontx2_data }, - { }, -}; - -U_BOOT_PCI_DEVICE(octeon_pci_twsi, octeon_twsi_supported); |