diff options
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/Kconfig | 1 | ||||
-rw-r--r-- | drivers/i2c/ast_i2c.c | 2 | ||||
-rw-r--r-- | drivers/i2c/at91_i2c.c | 2 | ||||
-rw-r--r-- | drivers/i2c/davinci_i2c.c | 2 | ||||
-rw-r--r-- | drivers/i2c/designware_i2c.c | 2 | ||||
-rw-r--r-- | drivers/i2c/exynos_hs_i2c.c | 2 | ||||
-rw-r--r-- | drivers/i2c/i2c-cdns.c | 2 | ||||
-rw-r--r-- | drivers/i2c/i2c-uniphier-f.c | 2 | ||||
-rw-r--r-- | drivers/i2c/i2c-uniphier.c | 2 | ||||
-rw-r--r-- | drivers/i2c/imx_lpi2c.c | 80 | ||||
-rw-r--r-- | drivers/i2c/mv_i2c.c | 2 | ||||
-rw-r--r-- | drivers/i2c/mvtwsi.c | 2 | ||||
-rw-r--r-- | drivers/i2c/mxc_i2c.c | 2 | ||||
-rw-r--r-- | drivers/i2c/omap24xx_i2c.c | 2 | ||||
-rw-r--r-- | drivers/i2c/rk_i2c.c | 2 | ||||
-rw-r--r-- | drivers/i2c/s3c24x0_i2c.c | 2 | ||||
-rw-r--r-- | drivers/i2c/tegra_i2c.c | 2 |
17 files changed, 55 insertions, 56 deletions
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index c58bc1e..8ac1cc6 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig @@ -134,7 +134,6 @@ config SYS_I2C_INTEL config SYS_I2C_IMX_LPI2C bool "NXP i.MX LPI2C driver" - depends on ARCH_MX7ULP help Add support for the NXP i.MX LPI2C driver. diff --git a/drivers/i2c/ast_i2c.c b/drivers/i2c/ast_i2c.c index 16dfb57..7ed0c10 100644 --- a/drivers/i2c/ast_i2c.c +++ b/drivers/i2c/ast_i2c.c @@ -92,7 +92,7 @@ static int ast_i2c_ofdata_to_platdata(struct udevice *dev) struct ast_i2c_priv *priv = dev_get_priv(dev); int ret; - priv->regs = dev_get_addr_ptr(dev); + priv->regs = devfdt_get_addr_ptr(dev); if (IS_ERR(priv->regs)) return PTR_ERR(priv->regs); diff --git a/drivers/i2c/at91_i2c.c b/drivers/i2c/at91_i2c.c index 5a63669..b7298cf 100644 --- a/drivers/i2c/at91_i2c.c +++ b/drivers/i2c/at91_i2c.c @@ -244,7 +244,7 @@ static int at91_i2c_ofdata_to_platdata(struct udevice *dev) struct at91_i2c_bus *bus = dev_get_priv(dev); int node = dev_of_offset(dev); - bus->regs = (struct at91_i2c_regs *)dev_get_addr(dev); + bus->regs = (struct at91_i2c_regs *)devfdt_get_addr(dev); bus->pdata = (struct at91_i2c_pdata *)dev_get_driver_data(dev); bus->clock_frequency = fdtdec_get_int(blob, node, "clock-frequency", 100000); diff --git a/drivers/i2c/davinci_i2c.c b/drivers/i2c/davinci_i2c.c index 4471193..2df07bb 100644 --- a/drivers/i2c/davinci_i2c.c +++ b/drivers/i2c/davinci_i2c.c @@ -470,7 +470,7 @@ static int davinci_i2c_probe(struct udevice *dev) struct i2c_bus *i2c_bus = dev_get_priv(dev); i2c_bus->id = dev->seq; - i2c_bus->regs = (struct i2c_regs *)dev_get_addr(dev); + i2c_bus->regs = (struct i2c_regs *)devfdt_get_addr(dev); i2c_bus->speed = 100000; _davinci_i2c_init(i2c_bus->regs, i2c_bus->speed, 0); diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c index c68ff64..d4df35a 100644 --- a/drivers/i2c/designware_i2c.c +++ b/drivers/i2c/designware_i2c.c @@ -545,7 +545,7 @@ static int designware_i2c_probe(struct udevice *bus) #endif #endif } else { - priv->regs = (struct i2c_regs *)dev_get_addr_ptr(bus); + priv->regs = (struct i2c_regs *)devfdt_get_addr_ptr(bus); } __dw_i2c_init(priv->regs, 0, 0); diff --git a/drivers/i2c/exynos_hs_i2c.c b/drivers/i2c/exynos_hs_i2c.c index 2dd75fd..9f4ac2f 100644 --- a/drivers/i2c/exynos_hs_i2c.c +++ b/drivers/i2c/exynos_hs_i2c.c @@ -524,7 +524,7 @@ static int s3c_i2c_ofdata_to_platdata(struct udevice *dev) node = dev_of_offset(dev); - i2c_bus->hsregs = (struct exynos5_hsi2c *)dev_get_addr(dev); + i2c_bus->hsregs = (struct exynos5_hsi2c *)devfdt_get_addr(dev); i2c_bus->id = pinmux_decode_periph_id(blob, node); diff --git a/drivers/i2c/i2c-cdns.c b/drivers/i2c/i2c-cdns.c index db37444..8265ce3 100644 --- a/drivers/i2c/i2c-cdns.c +++ b/drivers/i2c/i2c-cdns.c @@ -419,7 +419,7 @@ static int cdns_i2c_ofdata_to_platdata(struct udevice *dev) struct cdns_i2c_platform_data *pdata = (struct cdns_i2c_platform_data *)dev_get_driver_data(dev); - i2c_bus->regs = (struct cdns_i2c_regs *)dev_get_addr(dev); + i2c_bus->regs = (struct cdns_i2c_regs *)devfdt_get_addr(dev); if (!i2c_bus->regs) return -ENOMEM; diff --git a/drivers/i2c/i2c-uniphier-f.c b/drivers/i2c/i2c-uniphier-f.c index be9fc8a..e51537b 100644 --- a/drivers/i2c/i2c-uniphier-f.c +++ b/drivers/i2c/i2c-uniphier-f.c @@ -104,7 +104,7 @@ static int uniphier_fi2c_probe(struct udevice *dev) struct uniphier_fi2c_dev *priv = dev_get_priv(dev); int ret; - addr = dev_get_addr(dev); + addr = devfdt_get_addr(dev); if (addr == FDT_ADDR_T_NONE) return -EINVAL; diff --git a/drivers/i2c/i2c-uniphier.c b/drivers/i2c/i2c-uniphier.c index 75d1c4c..3412e2a 100644 --- a/drivers/i2c/i2c-uniphier.c +++ b/drivers/i2c/i2c-uniphier.c @@ -49,7 +49,7 @@ static int uniphier_i2c_probe(struct udevice *dev) fdt_addr_t addr; struct uniphier_i2c_dev *priv = dev_get_priv(dev); - addr = dev_get_addr(dev); + addr = devfdt_get_addr(dev); if (addr == FDT_ADDR_T_NONE) return -EINVAL; diff --git a/drivers/i2c/imx_lpi2c.c b/drivers/i2c/imx_lpi2c.c index f792d44..aa97196 100644 --- a/drivers/i2c/imx_lpi2c.c +++ b/drivers/i2c/imx_lpi2c.c @@ -25,9 +25,8 @@ int __weak init_i2c_power(unsigned i2c_num) return 0; } -static int imx_lpci2c_check_busy_bus(struct udevice *bus) +static int imx_lpci2c_check_busy_bus(const struct imx_lpi2c_reg *regs) { - struct imx_lpi2c_reg *regs = (struct imx_lpi2c_reg *)dev_get_addr(bus); lpi2c_status_t result = LPI2C_SUCESS; u32 status; @@ -39,9 +38,8 @@ static int imx_lpci2c_check_busy_bus(struct udevice *bus) return result; } -static int imx_lpci2c_check_clear_error(struct udevice *bus) +static int imx_lpci2c_check_clear_error(struct imx_lpi2c_reg *regs) { - struct imx_lpi2c_reg *regs = (struct imx_lpi2c_reg *)dev_get_addr(bus); lpi2c_status_t result = LPI2C_SUCESS; u32 val, status; @@ -71,9 +69,8 @@ static int imx_lpci2c_check_clear_error(struct udevice *bus) return result; } -static int bus_i2c_wait_for_tx_ready(struct udevice *bus) +static int bus_i2c_wait_for_tx_ready(struct imx_lpi2c_reg *regs) { - struct imx_lpi2c_reg *regs = (struct imx_lpi2c_reg *)dev_get_addr(bus); lpi2c_status_t result = LPI2C_SUCESS; u32 txcount = 0; ulong start_time = get_timer(0); @@ -81,7 +78,7 @@ static int bus_i2c_wait_for_tx_ready(struct udevice *bus) do { txcount = LPI2C_MFSR_TXCOUNT(readl(®s->mfsr)); txcount = LPI2C_FIFO_SIZE - txcount; - result = imx_lpci2c_check_clear_error(bus); + result = imx_lpci2c_check_clear_error(regs); if (result) { debug("i2c: wait for tx ready: result 0x%x\n", result); return result; @@ -95,9 +92,8 @@ static int bus_i2c_wait_for_tx_ready(struct udevice *bus) return result; } -static int bus_i2c_send(struct udevice *bus, u8 *txbuf, int len) +static int bus_i2c_send(struct imx_lpi2c_reg *regs, u8 *txbuf, int len) { - struct imx_lpi2c_reg *regs = (struct imx_lpi2c_reg *)dev_get_addr(bus); lpi2c_status_t result = LPI2C_SUCESS; /* empty tx */ @@ -105,7 +101,7 @@ static int bus_i2c_send(struct udevice *bus, u8 *txbuf, int len) return result; while (len--) { - result = bus_i2c_wait_for_tx_ready(bus); + result = bus_i2c_wait_for_tx_ready(regs); if (result) { debug("i2c: send wait fot tx ready: %d\n", result); return result; @@ -116,9 +112,8 @@ static int bus_i2c_send(struct udevice *bus, u8 *txbuf, int len) return result; } -static int bus_i2c_receive(struct udevice *bus, u8 *rxbuf, int len) +static int bus_i2c_receive(struct imx_lpi2c_reg *regs, u8 *rxbuf, int len) { - struct imx_lpi2c_reg *regs = (struct imx_lpi2c_reg *)dev_get_addr(bus); lpi2c_status_t result = LPI2C_SUCESS; u32 val; ulong start_time = get_timer(0); @@ -127,7 +122,7 @@ static int bus_i2c_receive(struct udevice *bus, u8 *rxbuf, int len) if (!len) return result; - result = bus_i2c_wait_for_tx_ready(bus); + result = bus_i2c_wait_for_tx_ready(regs); if (result) { debug("i2c: receive wait fot tx ready: %d\n", result); return result; @@ -141,9 +136,10 @@ static int bus_i2c_receive(struct udevice *bus, u8 *rxbuf, int len) while (len--) { do { - result = imx_lpci2c_check_clear_error(bus); + result = imx_lpci2c_check_clear_error(regs); if (result) { - debug("i2c: receive check clear error: %d\n", result); + debug("i2c: receive check clear error: %d\n", + result); return result; } if (get_timer(start_time) > LPI2C_TIMEOUT_MS) { @@ -158,13 +154,12 @@ static int bus_i2c_receive(struct udevice *bus, u8 *rxbuf, int len) return result; } -static int bus_i2c_start(struct udevice *bus, u8 addr, u8 dir) +static int bus_i2c_start(struct imx_lpi2c_reg *regs, u8 addr, u8 dir) { - struct imx_lpi2c_reg *regs = (struct imx_lpi2c_reg *)dev_get_addr(bus); lpi2c_status_t result = LPI2C_SUCESS; u32 val; - result = imx_lpci2c_check_busy_bus(bus); + result = imx_lpci2c_check_busy_bus(regs); if (result) { debug("i2c: start check busy bus: 0x%x\n", result); return result; @@ -175,7 +170,7 @@ static int bus_i2c_start(struct udevice *bus, u8 addr, u8 dir) val = readl(®s->mcfgr1) & ~LPI2C_MCFGR1_AUTOSTOP_MASK; writel(val, ®s->mcfgr1); /* wait tx fifo ready */ - result = bus_i2c_wait_for_tx_ready(bus); + result = bus_i2c_wait_for_tx_ready(regs); if (result) { debug("i2c: start wait for tx ready: 0x%x\n", result); return result; @@ -186,13 +181,13 @@ static int bus_i2c_start(struct udevice *bus, u8 addr, u8 dir) return result; } -static int bus_i2c_stop(struct udevice *bus) + +static int bus_i2c_stop(struct imx_lpi2c_reg *regs) { - struct imx_lpi2c_reg *regs = (struct imx_lpi2c_reg *)dev_get_addr(bus); lpi2c_status_t result = LPI2C_SUCESS; u32 status; - result = bus_i2c_wait_for_tx_ready(bus); + result = bus_i2c_wait_for_tx_ready(regs); if (result) { debug("i2c: stop wait for tx ready: 0x%x\n", result); return result; @@ -203,7 +198,7 @@ static int bus_i2c_stop(struct udevice *bus) while (result == LPI2C_SUCESS) { status = readl(®s->msr); - result = imx_lpci2c_check_clear_error(bus); + result = imx_lpci2c_check_clear_error(regs); /* stop detect flag */ if (status & LPI2C_MSR_SDF_MASK) { /* clear stop flag */ @@ -216,34 +211,34 @@ static int bus_i2c_stop(struct udevice *bus) return result; } -static int bus_i2c_read(struct udevice *bus, u32 chip, u8 *buf, int len) +static int bus_i2c_read(struct imx_lpi2c_reg *regs, u32 chip, u8 *buf, int len) { lpi2c_status_t result = LPI2C_SUCESS; - result = bus_i2c_start(bus, chip, 1); + result = bus_i2c_start(regs, chip, 1); if (result) return result; - result = bus_i2c_receive(bus, buf, len); + result = bus_i2c_receive(regs, buf, len); if (result) return result; - result = bus_i2c_stop(bus); + result = bus_i2c_stop(regs); if (result) return result; return result; } -static int bus_i2c_write(struct udevice *bus, u32 chip, u8 *buf, int len) +static int bus_i2c_write(struct imx_lpi2c_reg *regs, u32 chip, u8 *buf, int len) { lpi2c_status_t result = LPI2C_SUCESS; - result = bus_i2c_start(bus, chip, 0); + result = bus_i2c_start(regs, chip, 0); if (result) return result; - result = bus_i2c_send(bus, buf, len); + result = bus_i2c_send(regs, buf, len); if (result) return result; - result = bus_i2c_stop(bus); + result = bus_i2c_stop(regs); if (result) return result; @@ -253,7 +248,7 @@ static int bus_i2c_write(struct udevice *bus, u32 chip, u8 *buf, int len) static int bus_i2c_set_bus_speed(struct udevice *bus, int speed) { - struct imx_lpi2c_reg *regs = (struct imx_lpi2c_reg *)dev_get_addr(bus); + struct imx_lpi2c_reg *regs; u32 val; u32 preescale = 0, best_pre = 0, clkhi = 0; u32 best_clkhi = 0, abs_error = 0, rate; @@ -262,6 +257,7 @@ static int bus_i2c_set_bus_speed(struct udevice *bus, int speed) bool mode; int i; + regs = (struct imx_lpi2c_reg *)devfdt_get_addr(bus); clock_rate = imx_get_i2cclk(bus->seq + 4); if (!clock_rate) return -EPERM; @@ -320,10 +316,11 @@ static int bus_i2c_set_bus_speed(struct udevice *bus, int speed) static int bus_i2c_init(struct udevice *bus, int speed) { - struct imx_lpi2c_reg *regs = (struct imx_lpi2c_reg *)dev_get_addr(bus); + struct imx_lpi2c_reg *regs; u32 val; int ret; + regs = (struct imx_lpi2c_reg *)devfdt_get_addr(bus); /* reset peripheral */ writel(LPI2C_MCR_RST_MASK, ®s->mcr); writel(0x0, ®s->mcr); @@ -356,16 +353,18 @@ static int bus_i2c_init(struct udevice *bus, int speed) static int imx_lpi2c_probe_chip(struct udevice *bus, u32 chip, u32 chip_flags) { + struct imx_lpi2c_reg *regs; lpi2c_status_t result = LPI2C_SUCESS; - result = bus_i2c_start(bus, chip, 0); + regs = (struct imx_lpi2c_reg *)devfdt_get_addr(bus); + result = bus_i2c_start(regs, chip, 0); if (result) { - bus_i2c_stop(bus); + bus_i2c_stop(regs); bus_i2c_init(bus, 100000); return result; } - result = bus_i2c_stop(bus); + result = bus_i2c_stop(regs); if (result) { bus_i2c_init(bus, 100000); return -result; @@ -376,15 +375,16 @@ static int imx_lpi2c_probe_chip(struct udevice *bus, u32 chip, static int imx_lpi2c_xfer(struct udevice *bus, struct i2c_msg *msg, int nmsgs) { + struct imx_lpi2c_reg *regs; int ret = 0; + regs = (struct imx_lpi2c_reg *)devfdt_get_addr(bus); for (; nmsgs > 0; nmsgs--, msg++) { debug("i2c_xfer: chip=0x%x, len=0x%x\n", msg->addr, msg->len); if (msg->flags & I2C_M_RD) - ret = bus_i2c_read(bus, msg->addr, msg->buf, - msg->len); + ret = bus_i2c_read(regs, msg->addr, msg->buf, msg->len); else { - ret = bus_i2c_write(bus, msg->addr, msg->buf, + ret = bus_i2c_write(regs, msg->addr, msg->buf, msg->len); if (ret) break; @@ -410,7 +410,7 @@ static int imx_lpi2c_probe(struct udevice *bus) i2c_bus->driver_data = dev_get_driver_data(bus); - addr = dev_get_addr(bus); + addr = devfdt_get_addr(bus); if (addr == FDT_ADDR_T_NONE) return -ENODEV; diff --git a/drivers/i2c/mv_i2c.c b/drivers/i2c/mv_i2c.c index c780272..913721b 100644 --- a/drivers/i2c/mv_i2c.c +++ b/drivers/i2c/mv_i2c.c @@ -579,7 +579,7 @@ static int mv_i2c_probe(struct udevice *bus) { struct mv_i2c_priv *priv = dev_get_priv(bus); - priv->base = (void *)dev_get_addr_ptr(bus); + priv->base = (void *)devfdt_get_addr_ptr(bus); return 0; } diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c index 3703519..dfbc4e0 100644 --- a/drivers/i2c/mvtwsi.c +++ b/drivers/i2c/mvtwsi.c @@ -778,7 +778,7 @@ static int mvtwsi_i2c_ofdata_to_platdata(struct udevice *bus) { struct mvtwsi_i2c_dev *dev = dev_get_priv(bus); - dev->base = dev_get_addr_ptr(bus); + dev->base = devfdt_get_addr_ptr(bus); if (!dev->base) return -ENOMEM; diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c index b68e827..3258ae7 100644 --- a/drivers/i2c/mxc_i2c.c +++ b/drivers/i2c/mxc_i2c.c @@ -752,7 +752,7 @@ static int mxc_i2c_probe(struct udevice *bus) i2c_bus->driver_data = dev_get_driver_data(bus); - addr = dev_get_addr(bus); + addr = devfdt_get_addr(bus); if (addr == FDT_ADDR_T_NONE) return -ENODEV; diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c index 4b8397a..f71e0a5 100644 --- a/drivers/i2c/omap24xx_i2c.c +++ b/drivers/i2c/omap24xx_i2c.c @@ -896,7 +896,7 @@ static int omap_i2c_ofdata_to_platdata(struct udevice *bus) { struct omap_i2c *priv = dev_get_priv(bus); - priv->regs = map_physmem(dev_get_addr(bus), sizeof(void *), + priv->regs = map_physmem(devfdt_get_addr(bus), sizeof(void *), MAP_NOCACHE); priv->speed = CONFIG_SYS_OMAP24_I2C_SPEED; diff --git a/drivers/i2c/rk_i2c.c b/drivers/i2c/rk_i2c.c index 76f41f7..8bc045a 100644 --- a/drivers/i2c/rk_i2c.c +++ b/drivers/i2c/rk_i2c.c @@ -369,7 +369,7 @@ static int rockchip_i2c_probe(struct udevice *bus) { struct rk_i2c *priv = dev_get_priv(bus); - priv->regs = (void *)dev_get_addr(bus); + priv->regs = (void *)devfdt_get_addr(bus); return 0; } diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c index 3c69dbf..06fe0a5 100644 --- a/drivers/i2c/s3c24x0_i2c.c +++ b/drivers/i2c/s3c24x0_i2c.c @@ -314,7 +314,7 @@ static int s3c_i2c_ofdata_to_platdata(struct udevice *dev) node = dev_of_offset(dev); - i2c_bus->regs = (struct s3c24x0_i2c *)dev_get_addr(dev); + i2c_bus->regs = (struct s3c24x0_i2c *)devfdt_get_addr(dev); i2c_bus->id = pinmux_decode_periph_id(blob, node); diff --git a/drivers/i2c/tegra_i2c.c b/drivers/i2c/tegra_i2c.c index 898f12a..055f481 100644 --- a/drivers/i2c/tegra_i2c.c +++ b/drivers/i2c/tegra_i2c.c @@ -365,7 +365,7 @@ static int tegra_i2c_probe(struct udevice *dev) i2c_bus->id = dev->seq; i2c_bus->type = dev_get_driver_data(dev); - i2c_bus->regs = (struct i2c_ctlr *)dev_get_addr(dev); + i2c_bus->regs = (struct i2c_ctlr *)devfdt_get_addr(dev); ret = reset_get_by_name(dev, "i2c", &i2c_bus->reset_ctl); if (ret) { |