diff options
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/Makefile | 16 | ||||
-rw-r--r-- | drivers/i2c/designware_i2c_pci.c | 4 | ||||
-rw-r--r-- | drivers/i2c/i2c-gpio.c | 10 | ||||
-rw-r--r-- | drivers/i2c/muxes/Kconfig | 5 | ||||
-rw-r--r-- | drivers/i2c/muxes/pca954x.c | 37 | ||||
-rw-r--r-- | drivers/i2c/mxc_i2c.c | 16 | ||||
-rw-r--r-- | drivers/i2c/rz_riic.c | 1 |
7 files changed, 67 insertions, 22 deletions
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index 00b90523c62..bebd728e7da 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile @@ -2,15 +2,15 @@ # # (C) Copyright 2000-2007 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. -obj-$(CONFIG_$(SPL_)DM_I2C) += i2c-uclass.o -ifdef CONFIG_$(SPL_)ACPIGEN -obj-$(CONFIG_$(SPL_)DM_I2C) += acpi_i2c.o +obj-$(CONFIG_$(XPL_)DM_I2C) += i2c-uclass.o +ifdef CONFIG_$(XPL_)ACPIGEN +obj-$(CONFIG_$(XPL_)DM_I2C) += acpi_i2c.o endif -obj-$(CONFIG_$(SPL_)DM_I2C_GPIO) += i2c-gpio.o -obj-$(CONFIG_$(SPL_)I2C_CROS_EC_TUNNEL) += cros_ec_tunnel.o -obj-$(CONFIG_$(SPL_)I2C_CROS_EC_LDO) += cros_ec_ldo.o +obj-$(CONFIG_$(XPL_)DM_I2C_GPIO) += i2c-gpio.o +obj-$(CONFIG_$(XPL_)I2C_CROS_EC_TUNNEL) += cros_ec_tunnel.o +obj-$(CONFIG_$(XPL_)I2C_CROS_EC_LDO) += cros_ec_ldo.o -obj-$(CONFIG_$(SPL_)SYS_I2C_LEGACY) += i2c_core.o +obj-$(CONFIG_$(XPL_)SYS_I2C_LEGACY) += i2c_core.o obj-$(CONFIG_SYS_I2C_ASPEED) += ast_i2c.o obj-$(CONFIG_SYS_I2C_AST2600) += ast2600_i2c.o obj-$(CONFIG_SYS_I2C_AT91) += at91_i2c.o @@ -57,4 +57,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_$(SPL_)I2C_MUX) += muxes/ +obj-$(CONFIG_$(XPL_)I2C_MUX) += muxes/ diff --git a/drivers/i2c/designware_i2c_pci.c b/drivers/i2c/designware_i2c_pci.c index 11c98672265..c21c412231c 100644 --- a/drivers/i2c/designware_i2c_pci.c +++ b/drivers/i2c/designware_i2c_pci.c @@ -37,7 +37,7 @@ static int designware_i2c_pci_of_to_plat(struct udevice *dev) { struct dw_i2c *priv = dev_get_priv(dev); - if (spl_phase() < PHASE_SPL) { + if (xpl_phase() < PHASE_SPL) { u32 base; int ret; @@ -53,7 +53,7 @@ static int designware_i2c_pci_of_to_plat(struct udevice *dev) PCI_COMMAND_MASTER); } - if (spl_phase() < PHASE_BOARD_F) { + if (xpl_phase() < PHASE_BOARD_F) { /* Handle early, fixed mapping into a different address space */ priv->regs = (struct i2c_regs *)dm_pci_read_bar32(dev, 0); } else { diff --git a/drivers/i2c/i2c-gpio.c b/drivers/i2c/i2c-gpio.c index e0a575fb4a4..00aef40e341 100644 --- a/drivers/i2c/i2c-gpio.c +++ b/drivers/i2c/i2c-gpio.c @@ -101,7 +101,7 @@ static int i2c_gpio_read_bit(struct i2c_gpio_bus *bus, int delay) bus->set_scl(bus, 1); udelay(delay); - value = bus->get_sda(bus); + value = bus->get_sda ? bus->get_sda(bus) : 0; udelay(delay); bus->set_scl(bus, 0); udelay(2 * delay); @@ -256,6 +256,9 @@ static int i2c_gpio_read_data(struct i2c_gpio_bus *bus, uchar chip, { unsigned int delay = bus->udelay; + if (!bus->get_sda) + return -EOPNOTSUPP; + debug("%s: chip %x buffer: %p len %d\n", __func__, chip, buffer, len); while (len-- > 0) @@ -353,7 +356,10 @@ static int i2c_gpio_of_to_plat(struct udevice *dev) bus->udelay = dev_read_u32_default(dev, "i2c-gpio,delay-us", DEFAULT_UDELAY); - bus->get_sda = i2c_gpio_sda_get; + if (dev_read_bool(dev, "i2c-gpio,sda-output-only")) + bus->get_sda = NULL; + else + bus->get_sda = i2c_gpio_sda_get; bus->set_sda = i2c_gpio_sda_set; if (dev_read_bool(dev, "i2c-gpio,scl-output-only")) bus->set_scl = i2c_gpio_scl_set_output_only; diff --git a/drivers/i2c/muxes/Kconfig b/drivers/i2c/muxes/Kconfig index 323c4fbe9cc..cd5579aa55a 100644 --- a/drivers/i2c/muxes/Kconfig +++ b/drivers/i2c/muxes/Kconfig @@ -36,6 +36,11 @@ config I2C_MUX_PCA954x device. Supported chips are PCA9543, PCA9544, PCA9546, PCA9547, PCA9548 and PCA9646. + It's also compatible to Maxims MAX735x I2C switch chips, which are controlled + as the NXP PCA9548 and the MAX736x chips that act like the PCA9544. + This includes the: + MAX7356, MAX7357, MAX7358, MAX7367, MAX7368 and MAX7369 + config I2C_MUX_GPIO tristate "GPIO-based I2C multiplexer" depends on I2C_MUX && DM_GPIO diff --git a/drivers/i2c/muxes/pca954x.c b/drivers/i2c/muxes/pca954x.c index 795288fe2e9..9dd26972703 100644 --- a/drivers/i2c/muxes/pca954x.c +++ b/drivers/i2c/muxes/pca954x.c @@ -14,6 +14,12 @@ #include <asm-generic/gpio.h> enum pca_type { + MAX7356, + MAX7357, + MAX7358, + MAX7367, + MAX7368, + MAX7369, PCA9543, PCA9544, PCA9546, @@ -39,6 +45,31 @@ struct pca954x_priv { }; static const struct chip_desc chips[] = { + [MAX7356] = { + .muxtype = pca954x_isswi, + .width = 8, + }, + [MAX7357] = { + .muxtype = pca954x_isswi, + .width = 8, + }, + [MAX7358] = { + .muxtype = pca954x_isswi, + .width = 8, + }, + [MAX7367] = { + .muxtype = pca954x_isswi, + .width = 4, + }, + [MAX7368] = { + .muxtype = pca954x_isswi, + .width = 4, + }, + [MAX7369] = { + .enable = 0x4, + .muxtype = pca954x_ismux, + .width = 4, + }, [PCA9543] = { .muxtype = pca954x_isswi, .width = 2, @@ -102,6 +133,12 @@ static const struct i2c_mux_ops pca954x_ops = { }; static const struct udevice_id pca954x_ids[] = { + { .compatible = "maxim,max7356", .data = MAX7356 }, + { .compatible = "maxim,max7357", .data = MAX7357 }, + { .compatible = "maxim,max7358", .data = MAX7358 }, + { .compatible = "maxim,max7367", .data = MAX7367 }, + { .compatible = "maxim,max7368", .data = MAX7368 }, + { .compatible = "maxim,max7369", .data = MAX7369 }, { .compatible = "nxp,pca9543", .data = PCA9543 }, { .compatible = "nxp,pca9544", .data = PCA9544 }, { .compatible = "nxp,pca9546", .data = PCA9546 }, diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c index 2f3cb5908c9..2dfc1c4eab5 100644 --- a/drivers/i2c/mxc_i2c.c +++ b/drivers/i2c/mxc_i2c.c @@ -29,7 +29,6 @@ #include <watchdog.h> #include <dm.h> #include <dm/pinctrl.h> -#include <fdtdec.h> DECLARE_GLOBAL_DATA_PTR; @@ -867,8 +866,7 @@ static int mxc_i2c_set_bus_speed(struct udevice *bus, unsigned int speed) static int mxc_i2c_probe(struct udevice *bus) { struct mxc_i2c_bus *i2c_bus = dev_get_priv(bus); - const void *fdt = gd->fdt_blob; - int node = dev_of_offset(bus); + ofnode node = dev_ofnode(bus); fdt_addr_t addr; int ret, ret2; @@ -912,17 +910,15 @@ static int mxc_i2c_probe(struct udevice *bus) * See Documentation/devicetree/bindings/i2c/i2c-imx.txt * Use gpio to force bus idle when necessary. */ - ret = fdt_stringlist_search(fdt, node, "pinctrl-names", "gpio"); + ret = ofnode_stringlist_search(node, "pinctrl-names", "gpio"); if (ret < 0) { debug("i2c bus %d at 0x%2lx, no gpio pinctrl state.\n", dev_seq(bus), i2c_bus->base); } else { - ret = gpio_request_by_name_nodev(offset_to_ofnode(node), - "scl-gpios", 0, &i2c_bus->scl_gpio, - GPIOD_IS_OUT); - ret2 = gpio_request_by_name_nodev(offset_to_ofnode(node), - "sda-gpios", 0, &i2c_bus->sda_gpio, - GPIOD_IS_OUT); + ret = gpio_request_by_name(bus, "scl-gpios", 0, &i2c_bus->scl_gpio, + GPIOD_IS_OUT); + ret2 = gpio_request_by_name(bus, "sda-gpios", 0, &i2c_bus->sda_gpio, + GPIOD_IS_OUT); if (!dm_gpio_is_valid(&i2c_bus->sda_gpio) || !dm_gpio_is_valid(&i2c_bus->scl_gpio) || ret || ret2) { diff --git a/drivers/i2c/rz_riic.c b/drivers/i2c/rz_riic.c index 5f3f8d1b24b..f292c824362 100644 --- a/drivers/i2c/rz_riic.c +++ b/drivers/i2c/rz_riic.c @@ -14,6 +14,7 @@ #include <linux/bitops.h> #include <linux/delay.h> #include <reset.h> +#include <u-boot/schedule.h> #include <wait_bit.h> #define RIIC_ICCR1 0x00 |