diff options
author | Igor Opaniuk <igor.opaniuk@foundries.io> | 2021-02-09 14:52:45 +0300 |
---|---|---|
committer | Heiko Schocher <hs@denx.de> | 2021-02-21 08:08:00 +0300 |
commit | 2147a16983d17bcb0438607aa7760494afc27014 (patch) | |
tree | 153470783919253c3a9bbcbc0e34b38c62f138f1 /drivers/i2c | |
parent | a907dce88e462251d96be9cdd72900543e4798df (diff) | |
download | u-boot-2147a16983d17bcb0438607aa7760494afc27014.tar.xz |
dm: i2c: use CONFIG_IS_ENABLED macro for DM_I2C/DM_I2C_GPIO
Use CONFIG_IS_ENABLED() macro, which provides more convenient
way to check $(SPL)DM_I2C/$(SPL)DM_I2C_GPIO configs
for both SPL and U-Boot proper.
CONFIG_IS_ENABLED(DM_I2C) expands to:
- 1 if CONFIG_SPL_BUILD is undefined and CONFIG_DM_I2C is set to 'y',
- 1 if CONFIG_SPL_BUILD is defined and CONFIG_SPL_DM_I2C is set to 'y',
- 0 otherwise.
All occurences were replaced automatically using these bash cmds:
$ find . -type f -exec sed -i
's/ifndef CONFIG_DM_I2C/if !CONFIG_IS_ENABLED(DM_I2C)/g' {} +
$ find . -type f -exec sed -i
's/ifdef CONFIG_DM_I2C/if CONFIG_IS_ENABLED(DM_I2C)/g' {} +
$ find . -type f -exec sed -i
's/defined(CONFIG_DM_I2C)/CONFIG_IS_ENABLED(DM_I2C)/g' {} +
$ find . -type f -exec sed -i
's/ifndef CONFIG_DM_I2C_GPIO/if !CONFIG_IS_ENABLED(DM_I2C_GPIO)/g' {} +
$ find . -type f -exec sed -i
's/ifdef CONFIG_DM_I2C_GPIO/if CONFIG_IS_ENABLED(DM_I2C_GPIO)/g' {} +
$ find . -type f -exec sed -i
's/defined(CONFIG_DM_I2C_GPIO)/CONFIG_IS_ENABLED(DM_I2C_GPIO)/g' {} +
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/davinci_i2c.c | 4 | ||||
-rw-r--r-- | drivers/i2c/designware_i2c.c | 4 | ||||
-rw-r--r-- | drivers/i2c/fsl_i2c.c | 6 | ||||
-rw-r--r-- | drivers/i2c/ihs_i2c.c | 42 | ||||
-rw-r--r-- | drivers/i2c/lpc32xx_i2c.c | 4 | ||||
-rw-r--r-- | drivers/i2c/mv_i2c.c | 2 | ||||
-rw-r--r-- | drivers/i2c/mvtwsi.c | 16 | ||||
-rw-r--r-- | drivers/i2c/mxc_i2c.c | 4 | ||||
-rw-r--r-- | drivers/i2c/omap24xx_i2c.c | 2 |
9 files changed, 42 insertions, 42 deletions
diff --git a/drivers/i2c/davinci_i2c.c b/drivers/i2c/davinci_i2c.c index 7811abad80..a4abd25c39 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 60111b8419..072803691e 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/fsl_i2c.c b/drivers/i2c/fsl_i2c.c index 5283575968..2200303ea8 100644 --- a/drivers/i2c/fsl_i2c.c +++ b/drivers/i2c/fsl_i2c.c @@ -40,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 @@ -203,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) @@ -497,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/ihs_i2c.c b/drivers/i2c/ihs_i2c.c index ba7817478c..02f0144930 100644 --- a/drivers/i2c/ihs_i2c.c +++ b/drivers/i2c/ihs_i2c.c @@ -6,7 +6,7 @@ #include <common.h> #include <i2c.h> -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) #include <dm.h> #include <regmap.h> #else @@ -18,7 +18,7 @@ #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; @@ -91,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) @@ -99,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); @@ -116,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); @@ -126,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 @@ -137,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 @@ -157,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); @@ -170,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); @@ -190,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); @@ -203,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, @@ -216,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 @@ -233,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 @@ -261,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); @@ -269,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/lpc32xx_i2c.c b/drivers/i2c/lpc32xx_i2c.c index ad11e978cc..f89f7955e4 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/mv_i2c.c b/drivers/i2c/mv_i2c.c index ef1007de14..20c5de0007 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 5df69f1459..d33e2c7c9d 100644 --- a/drivers/i2c/mvtwsi.c +++ b/drivers/i2c/mvtwsi.c @@ -16,7 +16,7 @@ #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 @@ -27,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)) @@ -43,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 @@ -83,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; @@ -184,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 @@ -481,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); @@ -516,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); @@ -683,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 3c91515bff..003aa33f6e 100644 --- a/drivers/i2c/mxc_i2c.c +++ b/drivers/i2c/mxc_i2c.c @@ -394,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) @@ -646,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/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c index 1355dc274e..71f6f5f7ac 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. |