diff options
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/Kconfig | 25 | ||||
-rw-r--r-- | drivers/i2c/Makefile | 4 | ||||
-rw-r--r-- | drivers/i2c/at91_i2c.c | 5 | ||||
-rw-r--r-- | drivers/i2c/cros_ec_tunnel.c | 1 | ||||
-rw-r--r-- | drivers/i2c/davinci_i2c.c | 4 | ||||
-rw-r--r-- | drivers/i2c/designware_i2c.c | 4 | ||||
-rw-r--r-- | drivers/i2c/exynos_hs_i2c.c | 1 | ||||
-rw-r--r-- | drivers/i2c/fsl_i2c.c | 7 | ||||
-rw-r--r-- | drivers/i2c/i2c-gpio.c | 17 | ||||
-rw-r--r-- | drivers/i2c/i2c_core.c | 1 | ||||
-rw-r--r-- | drivers/i2c/ihs_i2c.c | 43 | ||||
-rw-r--r-- | drivers/i2c/iproc_i2c.c | 1 | ||||
-rw-r--r-- | drivers/i2c/lpc32xx_i2c.c | 4 | ||||
-rw-r--r-- | drivers/i2c/muxes/i2c-arb-gpio-challenge.c | 1 | ||||
-rw-r--r-- | drivers/i2c/muxes/i2c-mux-gpio.c | 1 | ||||
-rw-r--r-- | drivers/i2c/muxes/pca954x.c | 1 | ||||
-rw-r--r-- | drivers/i2c/mv_i2c.c | 2 | ||||
-rw-r--r-- | drivers/i2c/mvtwsi.c | 17 | ||||
-rw-r--r-- | drivers/i2c/mxc_i2c.c | 5 | ||||
-rw-r--r-- | drivers/i2c/nx_i2c.c | 1 | ||||
-rw-r--r-- | drivers/i2c/ocores_i2c.c | 1 | ||||
-rw-r--r-- | drivers/i2c/omap24xx_i2c.c | 2 | ||||
-rw-r--r-- | drivers/i2c/s3c24x0_i2c.c | 1 | ||||
-rw-r--r-- | drivers/i2c/sh_i2c.c | 1 | ||||
-rw-r--r-- | drivers/i2c/soft_i2c.c | 1 | ||||
-rw-r--r-- | drivers/i2c/tegra186_bpmp_i2c.c | 1 |
26 files changed, 99 insertions, 53 deletions
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index 403602fddff..1844941eb21 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig @@ -14,6 +14,17 @@ config DM_I2C device (bus child) info is kept as parent plat. The interface is defined in include/i2c.h. +config SPL_DM_I2C + bool "Enable Driver Model for I2C drivers in SPL" + depends on SPL_DM && DM_I2C + default y + help + Enable driver model for I2C. The I2C uclass interface: probe, read, + write and speed, is implemented with the bus drivers operations, + which provide methods for bus setting and data transfer. Each chip + device (bus child) info is kept as parent platdata. The interface + is defined in include/i2c.h. + config I2C_CROS_EC_TUNNEL tristate "Chrome OS EC tunnel I2C bus" depends on CROS_EC @@ -61,6 +72,16 @@ config DM_I2C_GPIO bindings are supported. Binding info: doc/device-tree-bindings/i2c/i2c-gpio.txt +config SPL_DM_I2C_GPIO + bool "Enable Driver Model for software emulated I2C bus driver in SPL" + depends on SPL_DM && DM_I2C_GPIO && SPL_DM_GPIO && SPL_GPIO_SUPPORT + default y + help + Enable the i2c bus driver emulation by using the GPIOs. The bus GPIO + configuration is given by the device tree. Kernel-style device tree + bindings are supported. + Binding info: doc/device-tree-bindings/i2c/i2c-gpio.txt + config SYS_I2C_AT91 bool "Atmel I2C driver" depends on DM_I2C && ARCH_AT91 @@ -222,7 +243,7 @@ endif if SYS_I2C_MXC_I2C1 config SYS_MXC_I2C1_SPEED int "I2C Channel 1 speed" - default 40000000 if TARGET_LS2080A_SIMU || TARGET_LS2080A_EMU + default 40000000 if TARGET_LS2080A_EMU default 100000 help MXC I2C Channel 1 speed @@ -237,7 +258,7 @@ endif if SYS_I2C_MXC_I2C2 config SYS_MXC_I2C2_SPEED int "I2C Channel 2 speed" - default 40000000 if TARGET_LS2080A_SIMU || TARGET_LS2080A_EMU + default 40000000 if TARGET_LS2080A_EMU default 100000 help MXC I2C Channel 2 speed diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index 29aab0f9e30..acd27ac29d2 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile @@ -2,9 +2,9 @@ # # (C) Copyright 2000-2007 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. -obj-$(CONFIG_DM_I2C) += i2c-uclass.o +obj-$(CONFIG_$(SPL_)DM_I2C) += i2c-uclass.o ifdef CONFIG_ACPIGEN -obj-$(CONFIG_DM_I2C) += acpi_i2c.o +obj-$(CONFIG_$(SPL_)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 diff --git a/drivers/i2c/at91_i2c.c b/drivers/i2c/at91_i2c.c index 3eb6db4878d..6b4c0e48045 100644 --- a/drivers/i2c/at91_i2c.c +++ b/drivers/i2c/at91_i2c.c @@ -6,6 +6,7 @@ */ #include <malloc.h> +#include <asm/global_data.h> #include <asm/io.h> #include <common.h> #include <clk.h> @@ -50,6 +51,10 @@ static int at91_i2c_xfer_msg(struct at91_i2c_bus *bus, struct i2c_msg *msg) u32 i; int ret = 0; + /* if there is no message to send/receive, just exit quietly */ + if (msg->len == 0) + return ret; + readl(®->sr); if (is_read) { writel(TWI_CR_START, ®->cr); diff --git a/drivers/i2c/cros_ec_tunnel.c b/drivers/i2c/cros_ec_tunnel.c index 970b91cfd30..75828b6e7c2 100644 --- a/drivers/i2c/cros_ec_tunnel.c +++ b/drivers/i2c/cros_ec_tunnel.c @@ -9,6 +9,7 @@ #include <cros_ec.h> #include <errno.h> #include <i2c.h> +#include <asm/global_data.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/i2c/davinci_i2c.c b/drivers/i2c/davinci_i2c.c index 7811abad80b..a4abd25c398 100644 --- a/drivers/i2c/davinci_i2c.c +++ b/drivers/i2c/davinci_i2c.c @@ -21,7 +21,7 @@ #include <linux/delay.h> #include "davinci_i2c.h" -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) /* Information about i2c controller */ struct i2c_bus { int id; @@ -340,7 +340,7 @@ static int _davinci_i2c_probe_chip(struct i2c_regs *i2c_base, uint8_t chip) return rc; } -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) static struct i2c_regs *davinci_get_base(struct i2c_adapter *adap) { switch (adap->hwadapnr) { diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c index 60111b84197..072803691e3 100644 --- a/drivers/i2c/designware_i2c.c +++ b/drivers/i2c/designware_i2c.c @@ -598,7 +598,7 @@ static int __dw_i2c_init(struct i2c_regs *i2c_base, int speed, int slaveaddr) writel(IC_RX_TL, &i2c_base->ic_rx_tl); writel(IC_TX_TL, &i2c_base->ic_tx_tl); writel(IC_STOP_DET, &i2c_base->ic_intr_mask); -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) _dw_i2c_set_bus_speed(NULL, i2c_base, speed, IC_CLK); writel(slaveaddr, &i2c_base->ic_sar); #endif @@ -611,7 +611,7 @@ static int __dw_i2c_init(struct i2c_regs *i2c_base, int speed, int slaveaddr) return 0; } -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) /* * The legacy I2C functions. These need to get removed once * all users of this driver are converted to DM. diff --git a/drivers/i2c/exynos_hs_i2c.c b/drivers/i2c/exynos_hs_i2c.c index 879ddc67b69..39bcacc17a7 100644 --- a/drivers/i2c/exynos_hs_i2c.c +++ b/drivers/i2c/exynos_hs_i2c.c @@ -13,6 +13,7 @@ #include <asm/arch/clk.h> #include <asm/arch/cpu.h> #include <asm/arch/pinmux.h> +#include <asm/global_data.h> #include <linux/delay.h> #include "s3c24x0_i2c.h" diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c index 875d30762e3..2200303ea83 100644 --- a/drivers/i2c/fsl_i2c.c +++ b/drivers/i2c/fsl_i2c.c @@ -11,6 +11,7 @@ #include <i2c.h> /* Functional interface */ #include <log.h> #include <time.h> +#include <asm/global_data.h> #include <asm/io.h> #include <asm/fsl_i2c.h> /* HW definitions */ #include <clk.h> @@ -39,7 +40,7 @@ DECLARE_GLOBAL_DATA_PTR; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) static const struct fsl_i2c_base *i2c_base[4] = { (struct fsl_i2c_base *)(CONFIG_SYS_IMMR + CONFIG_SYS_FSL_I2C_OFFSET), #ifdef CONFIG_SYS_FSL_I2C2_OFFSET @@ -202,7 +203,7 @@ static uint set_i2c_bus_speed(const struct fsl_i2c_base *base, return speed; } -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) static uint get_i2c_clock(int bus) { if (bus) @@ -496,7 +497,7 @@ static uint __i2c_set_bus_speed(const struct fsl_i2c_base *base, return 0; } -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) static void fsl_i2c_init(struct i2c_adapter *adap, int speed, int slaveadd) { __i2c_init(i2c_base[adap->hwadapnr], speed, slaveadd, diff --git a/drivers/i2c/i2c-gpio.c b/drivers/i2c/i2c-gpio.c index 387f00b2cde..a301a4460b3 100644 --- a/drivers/i2c/i2c-gpio.c +++ b/drivers/i2c/i2c-gpio.c @@ -50,9 +50,10 @@ static void i2c_gpio_sda_set(struct i2c_gpio_bus *bus, int bit) struct gpio_desc *sda = &bus->gpios[PIN_SDA]; if (bit) - dm_gpio_set_dir_flags(sda, GPIOD_IS_IN); + sda->flags = (sda->flags & ~GPIOD_IS_OUT) | GPIOD_IS_IN; else - dm_gpio_set_dir_flags(sda, GPIOD_IS_OUT); + sda->flags = (sda->flags & (~GPIOD_IS_IN & ~GPIOD_IS_OUT_ACTIVE)) | GPIOD_IS_OUT; + dm_gpio_set_dir(sda); } static void i2c_gpio_scl_set(struct i2c_gpio_bus *bus, int bit) @@ -61,14 +62,16 @@ static void i2c_gpio_scl_set(struct i2c_gpio_bus *bus, int bit) int count = 0; if (bit) { - dm_gpio_set_dir_flags(scl, GPIOD_IS_IN); + scl->flags = (scl->flags & ~GPIOD_IS_OUT) | GPIOD_IS_IN; + dm_gpio_set_dir(scl); while (!dm_gpio_get_value(scl) && count++ < 100000) udelay(1); if (!dm_gpio_get_value(scl)) pr_err("timeout waiting on slave to release scl\n"); } else { - dm_gpio_set_dir_flags(scl, GPIOD_IS_OUT); + scl->flags = (scl->flags & (~GPIOD_IS_IN & ~GPIOD_IS_OUT_ACTIVE)) | GPIOD_IS_OUT; + dm_gpio_set_dir(scl); } } @@ -76,11 +79,11 @@ static void i2c_gpio_scl_set(struct i2c_gpio_bus *bus, int bit) static void i2c_gpio_scl_set_output_only(struct i2c_gpio_bus *bus, int bit) { struct gpio_desc *scl = &bus->gpios[PIN_SCL]; - ulong flags = GPIOD_IS_OUT; + scl->flags = (scl->flags & (~GPIOD_IS_IN & ~GPIOD_IS_OUT_ACTIVE)) | GPIOD_IS_OUT; if (bit) - flags |= GPIOD_IS_OUT_ACTIVE; - dm_gpio_set_dir_flags(scl, flags); + scl->flags |= GPIOD_IS_OUT_ACTIVE; + dm_gpio_set_dir(scl); } static void i2c_gpio_write_bit(struct i2c_gpio_bus *bus, int delay, uchar bit) diff --git a/drivers/i2c/i2c_core.c b/drivers/i2c/i2c_core.c index da50d86cc8b..85cf75ecd92 100644 --- a/drivers/i2c/i2c_core.c +++ b/drivers/i2c/i2c_core.c @@ -10,6 +10,7 @@ #include <common.h> #include <i2c.h> #include <linker_lists.h> +#include <asm/global_data.h> struct i2c_adapter *i2c_get_adapter(int index) { diff --git a/drivers/i2c/ihs_i2c.c b/drivers/i2c/ihs_i2c.c index f91a96a3aa3..02f0144930c 100644 --- a/drivers/i2c/ihs_i2c.c +++ b/drivers/i2c/ihs_i2c.c @@ -6,18 +6,19 @@ #include <common.h> #include <i2c.h> -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) #include <dm.h> #include <regmap.h> #else #include <gdsys_fpga.h> #endif #include <log.h> +#include <asm/global_data.h> #include <asm/unaligned.h> #include <linux/bitops.h> #include <linux/delay.h> -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct ihs_i2c_priv { uint speed; struct regmap *map; @@ -90,7 +91,7 @@ enum { I2COP_READ = 1, }; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) static int wait_for_int(struct udevice *dev, int read) #else static int wait_for_int(bool read) @@ -98,11 +99,11 @@ static int wait_for_int(bool read) { u16 val; uint ctr = 0; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct ihs_i2c_priv *priv = dev_get_priv(dev); #endif -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) ihs_i2c_get(priv->map, interrupt_status, &val); #else I2C_GET_REG(interrupt_status, &val); @@ -115,7 +116,7 @@ static int wait_for_int(bool read) debug("%s: timed out\n", __func__); return -ETIMEDOUT; } -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) ihs_i2c_get(priv->map, interrupt_status, &val); #else I2C_GET_REG(interrupt_status, &val); @@ -125,7 +126,7 @@ static int wait_for_int(bool read) return (val & I2CINT_ERROR_EV) ? -EIO : 0; } -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) static int ihs_i2c_transfer(struct udevice *dev, uchar chip, uchar *buffer, int len, int read, bool is_last) #else @@ -136,13 +137,13 @@ static int ihs_i2c_transfer(uchar chip, uchar *buffer, int len, bool read, u16 val; u16 data; int res; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct ihs_i2c_priv *priv = dev_get_priv(dev); #endif /* Clear interrupt status */ data = I2CINT_ERROR_EV | I2CINT_RECEIVE_EV | I2CINT_TRANSMIT_EV; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) ihs_i2c_set(priv->map, interrupt_status, data); ihs_i2c_get(priv->map, interrupt_status, &val); #else @@ -156,7 +157,7 @@ static int ihs_i2c_transfer(uchar chip, uchar *buffer, int len, bool read, if (len > 1) val |= buffer[1] << 8; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) ihs_i2c_set(priv->map, write_mailbox_ext, val); #else I2C_SET_REG(write_mailbox_ext, val); @@ -169,13 +170,13 @@ static int ihs_i2c_transfer(uchar chip, uchar *buffer, int len, bool read, | ((len > 1) ? I2CMB_2BYTE : 0) | (is_last ? 0 : I2CMB_HOLD_BUS); -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) ihs_i2c_set(priv->map, write_mailbox, data); #else I2C_SET_REG(write_mailbox, data); #endif -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) res = wait_for_int(dev, read); #else res = wait_for_int(read); @@ -189,7 +190,7 @@ static int ihs_i2c_transfer(uchar chip, uchar *buffer, int len, bool read, /* If we want to read, get the bytes from the mailbox */ if (read) { -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) ihs_i2c_get(priv->map, read_mailbox_ext, &val); #else I2C_GET_REG(read_mailbox_ext, &val); @@ -202,7 +203,7 @@ static int ihs_i2c_transfer(uchar chip, uchar *buffer, int len, bool read, return 0; } -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) static int ihs_i2c_send_buffer(struct udevice *dev, uchar chip, u8 *data, int len, bool hold_bus, int read) #else static int ihs_i2c_send_buffer(uchar chip, u8 *data, int len, bool hold_bus, @@ -215,7 +216,7 @@ static int ihs_i2c_send_buffer(uchar chip, u8 *data, int len, bool hold_bus, int transfer = min(len, 2); bool is_last = len <= transfer; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) res = ihs_i2c_transfer(dev, chip, data, transfer, read, hold_bus ? false : is_last); #else @@ -232,21 +233,21 @@ static int ihs_i2c_send_buffer(uchar chip, u8 *data, int len, bool hold_bus, return 0; } -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) static int ihs_i2c_address(struct udevice *dev, uchar chip, u8 *addr, int alen, bool hold_bus) #else static int ihs_i2c_address(uchar chip, u8 *addr, int alen, bool hold_bus) #endif { -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) return ihs_i2c_send_buffer(dev, chip, addr, alen, hold_bus, I2COP_WRITE); #else return ihs_i2c_send_buffer(chip, addr, alen, hold_bus, I2COP_WRITE); #endif } -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) static int ihs_i2c_access(struct udevice *dev, uchar chip, u8 *addr, int alen, uchar *buffer, int len, int read) #else @@ -260,7 +261,7 @@ static int ihs_i2c_access(struct i2c_adapter *adap, uchar chip, u8 *addr, if (len <= 0) return -EINVAL; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) res = ihs_i2c_address(dev, chip, addr, alen, len); #else res = ihs_i2c_address(chip, addr, alen, len); @@ -268,14 +269,14 @@ static int ihs_i2c_access(struct i2c_adapter *adap, uchar chip, u8 *addr, if (res) return res; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) return ihs_i2c_send_buffer(dev, chip, buffer, len, false, read); #else return ihs_i2c_send_buffer(chip, buffer, len, false, read); #endif } -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) int ihs_i2c_probe(struct udevice *bus) { diff --git a/drivers/i2c/iproc_i2c.c b/drivers/i2c/iproc_i2c.c index 83301bbf1b3..d975e782649 100644 --- a/drivers/i2c/iproc_i2c.c +++ b/drivers/i2c/iproc_i2c.c @@ -4,6 +4,7 @@ * */ +#include <asm/global_data.h> #include <asm/io.h> #include <common.h> #include <config.h> diff --git a/drivers/i2c/lpc32xx_i2c.c b/drivers/i2c/lpc32xx_i2c.c index ad11e978ccd..f89f7955e4c 100644 --- a/drivers/i2c/lpc32xx_i2c.c +++ b/drivers/i2c/lpc32xx_i2c.c @@ -42,7 +42,7 @@ #define LPC32XX_I2C_STAT_NAI 0x00000004 #define LPC32XX_I2C_STAT_TDI 0x00000001 -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) static struct lpc32xx_i2c_base *lpc32xx_i2c[] = { (struct lpc32xx_i2c_base *)I2C1_BASE, (struct lpc32xx_i2c_base *)I2C2_BASE, @@ -224,7 +224,7 @@ static int __i2c_write(struct lpc32xx_i2c_base *base, u8 dev, uint addr, return 0; } -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) static void lpc32xx_i2c_init(struct i2c_adapter *adap, int requested_speed, int slaveadd) { diff --git a/drivers/i2c/muxes/i2c-arb-gpio-challenge.c b/drivers/i2c/muxes/i2c-arb-gpio-challenge.c index 928e02b7af1..ad730e0e79f 100644 --- a/drivers/i2c/muxes/i2c-arb-gpio-challenge.c +++ b/drivers/i2c/muxes/i2c-arb-gpio-challenge.c @@ -10,6 +10,7 @@ #include <i2c.h> #include <log.h> #include <malloc.h> +#include <asm/global_data.h> #include <asm/gpio.h> #include <linux/delay.h> diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c index 8d6e208a0b8..4ca206115f8 100644 --- a/drivers/i2c/muxes/i2c-mux-gpio.c +++ b/drivers/i2c/muxes/i2c-mux-gpio.c @@ -7,6 +7,7 @@ * Peng Fan <peng.fan@nxp.com> */ +#include <asm/global_data.h> #include <asm/io.h> #include <asm-generic/gpio.h> #include <common.h> diff --git a/drivers/i2c/muxes/pca954x.c b/drivers/i2c/muxes/pca954x.c index d21a84c4fa8..55858cf653f 100644 --- a/drivers/i2c/muxes/pca954x.c +++ b/drivers/i2c/muxes/pca954x.c @@ -11,6 +11,7 @@ #include <i2c.h> #include <log.h> #include <malloc.h> +#include <asm/global_data.h> #include <asm-generic/gpio.h> diff --git a/drivers/i2c/mv_i2c.c b/drivers/i2c/mv_i2c.c index ef1007de142..20c5de0007a 100644 --- a/drivers/i2c/mv_i2c.c +++ b/drivers/i2c/mv_i2c.c @@ -370,7 +370,7 @@ static int __i2c_write(struct mv_i2c *base, uchar chip, u8 *addr, int alen, return 0; } -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) static struct mv_i2c *base_glob; diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c index 37b1a06ee03..d33e2c7c9d8 100644 --- a/drivers/i2c/mvtwsi.c +++ b/drivers/i2c/mvtwsi.c @@ -10,12 +10,13 @@ #include <common.h> #include <i2c.h> #include <log.h> +#include <asm/global_data.h> #include <linux/delay.h> #include <linux/errno.h> #include <asm/io.h> #include <linux/bitops.h> #include <linux/compat.h> -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) #include <dm.h> #endif @@ -26,7 +27,7 @@ DECLARE_GLOBAL_DATA_PTR; * settings */ -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) #if defined(CONFIG_ARCH_ORION5X) #include <asm/arch/orion5x.h> #elif (defined(CONFIG_ARCH_KIRKWOOD) || defined(CONFIG_ARCH_MVEBU)) @@ -42,7 +43,7 @@ DECLARE_GLOBAL_DATA_PTR; * On SUNXI, we get CONFIG_SYS_TCLK from this include, so we want to * always have it. */ -#if defined(CONFIG_DM_I2C) && defined(CONFIG_ARCH_SUNXI) +#if CONFIG_IS_ENABLED(DM_I2C) && defined(CONFIG_ARCH_SUNXI) #include <asm/arch/i2c.h> #endif @@ -82,7 +83,7 @@ struct mvtwsi_registers { #endif -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct mvtwsi_i2c_dev { /* TWSI Register base for the device */ struct mvtwsi_registers *base; @@ -183,7 +184,7 @@ inline uint calc_tick(uint speed) return (1000000000u / speed) + 100; } -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) /* * twsi_get_base() - Get controller register base for specified adapter @@ -480,7 +481,7 @@ static uint __twsi_i2c_set_bus_speed(struct mvtwsi_registers *twsi, writel(baud, &twsi->baudrate); /* Wait for controller for one tick */ -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) ndelay(calc_tick(highest_speed)); #else ndelay(10000); @@ -515,7 +516,7 @@ static void __twsi_i2c_init(struct mvtwsi_registers *twsi, int speed, writel(slaveadd, &twsi->slave_address); writel(0, &twsi->xtnd_slave_addr); /* Assert STOP, but don't care for the result */ -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) (void) twsi_stop(twsi, calc_tick(*actual_speed)); #else (void) twsi_stop(twsi, 10000); @@ -682,7 +683,7 @@ static int __twsi_i2c_write(struct mvtwsi_registers *twsi, uchar chip, return status != 0 ? status : stop_status; } -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) static void twsi_i2c_init(struct i2c_adapter *adap, int speed, int slaveadd) { diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c index 0362ec67632..003aa33f6ec 100644 --- a/drivers/i2c/mxc_i2c.c +++ b/drivers/i2c/mxc_i2c.c @@ -18,6 +18,7 @@ #include <log.h> #include <asm/arch/clock.h> #include <asm/arch/imx-regs.h> +#include <asm/global_data.h> #include <dm/device_compat.h> #include <linux/delay.h> #include <linux/errno.h> @@ -393,7 +394,7 @@ static struct mxc_i2c_bus mxc_i2c_buses[] = { #endif }; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) int i2c_idle_bus(struct mxc_i2c_bus *i2c_bus) { if (i2c_bus && i2c_bus->idle_bus_fn) @@ -645,7 +646,7 @@ int __enable_i2c_clk(unsigned char enable, unsigned int i2c_num) int enable_i2c_clk(unsigned char enable, unsigned int i2c_num) __attribute__((weak, alias("__enable_i2c_clk"))); -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) /* * Read data from I2C device * diff --git a/drivers/i2c/nx_i2c.c b/drivers/i2c/nx_i2c.c index c63a7325576..07cda0fa679 100644 --- a/drivers/i2c/nx_i2c.c +++ b/drivers/i2c/nx_i2c.c @@ -7,6 +7,7 @@ #include <asm/arch/reset.h> #include <asm/arch/clk.h> #include <asm/arch/nx_gpio.h> +#include <asm/global_data.h> #include <linux/delay.h> #define I2C_WRITE 0 diff --git a/drivers/i2c/ocores_i2c.c b/drivers/i2c/ocores_i2c.c index 48ed1d5bffb..088ba9a6a3c 100644 --- a/drivers/i2c/ocores_i2c.c +++ b/drivers/i2c/ocores_i2c.c @@ -13,6 +13,7 @@ */ #include <common.h> +#include <asm/global_data.h> #include <asm/io.h> #include <clk.h> #include <dm.h> diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c index 1355dc274ed..71f6f5f7ac8 100644 --- a/drivers/i2c/omap24xx_i2c.c +++ b/drivers/i2c/omap24xx_i2c.c @@ -836,7 +836,7 @@ wr_exit: return i2c_error; } -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) /* * The legacy I2C functions. These need to get removed once * all users of this driver are converted to DM. diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c index 0c8915605db..56f0f69885e 100644 --- a/drivers/i2c/s3c24x0_i2c.c +++ b/drivers/i2c/s3c24x0_i2c.c @@ -16,6 +16,7 @@ #else #include <asm/arch/s3c24x0_cpu.h> #endif +#include <asm/global_data.h> #include <asm/io.h> #include <i2c.h> #include "s3c24x0_i2c.h" diff --git a/drivers/i2c/sh_i2c.c b/drivers/i2c/sh_i2c.c index f857307e6a4..26a87006698 100644 --- a/drivers/i2c/sh_i2c.c +++ b/drivers/i2c/sh_i2c.c @@ -10,6 +10,7 @@ #include <common.h> #include <i2c.h> #include <log.h> +#include <asm/global_data.h> #include <asm/io.h> #include <linux/delay.h> diff --git a/drivers/i2c/soft_i2c.c b/drivers/i2c/soft_i2c.c index 1031066b8c4..db69c18cb6d 100644 --- a/drivers/i2c/soft_i2c.c +++ b/drivers/i2c/soft_i2c.c @@ -25,6 +25,7 @@ #endif #endif #include <i2c.h> +#include <asm/global_data.h> #include <linux/delay.h> #if defined(CONFIG_SOFT_I2C_GPIO_SCL) diff --git a/drivers/i2c/tegra186_bpmp_i2c.c b/drivers/i2c/tegra186_bpmp_i2c.c index 88e4e9a5c9d..588f6bdcc4b 100644 --- a/drivers/i2c/tegra186_bpmp_i2c.c +++ b/drivers/i2c/tegra186_bpmp_i2c.c @@ -9,6 +9,7 @@ #include <log.h> #include <misc.h> #include <asm/arch-tegra/bpmp_abi.h> +#include <asm/global_data.h> #include <linux/bitops.h> DECLARE_GLOBAL_DATA_PTR; |