diff options
author | Igor Opaniuk | 2021-02-09 13:52:45 +0200 |
---|---|---|
committer | Heiko Schocher | 2021-02-21 06:08:00 +0100 |
commit | 2147a16983d17bcb0438607aa7760494afc27014 (patch) | |
tree | 153470783919253c3a9bbcbc0e34b38c62f138f1 /drivers | |
parent | a907dce88e462251d96be9cdd72900543e4798df (diff) |
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')
-rw-r--r-- | drivers/ddr/fsl/main.c | 8 | ||||
-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 | ||||
-rw-r--r-- | drivers/power/palmas.c | 2 | ||||
-rw-r--r-- | drivers/power/pmic/pmic_tps62362.c | 6 | ||||
-rw-r--r-- | drivers/power/pmic/pmic_tps65217.c | 14 | ||||
-rw-r--r-- | drivers/power/pmic/pmic_tps65218.c | 4 | ||||
-rw-r--r-- | drivers/power/pmic/pmic_tps65910.c | 6 | ||||
-rw-r--r-- | drivers/power/twl4030.c | 2 | ||||
-rw-r--r-- | drivers/power/twl6030.c | 2 | ||||
-rw-r--r-- | drivers/tpm/tpm_atmel_twi.c | 6 | ||||
-rw-r--r-- | drivers/usb/host/ohci-lpc32xx.c | 8 |
19 files changed, 71 insertions, 71 deletions
diff --git a/drivers/ddr/fsl/main.c b/drivers/ddr/fsl/main.c index c02badd4a88..8e147160b9f 100644 --- a/drivers/ddr/fsl/main.c +++ b/drivers/ddr/fsl/main.c @@ -86,7 +86,7 @@ u8 spd_i2c_addr[CONFIG_SYS_NUM_DDR_CTLRS][CONFIG_DIMM_SLOTS_PER_CTLR] = { #endif -#if defined(CONFIG_DM_I2C) +#if CONFIG_IS_ENABLED(DM_I2C) #define DEV_TYPE struct udevice #else /* Local udevice */ @@ -106,7 +106,7 @@ static int ddr_i2c_read(DEV_TYPE *dev, unsigned int addr, { int ret; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) ret = dm_i2c_read(dev, 0, buf, len); #else ret = i2c_read(dev->chip, addr, alen, buf, len); @@ -120,7 +120,7 @@ static int ddr_i2c_dummy_write(unsigned int chip_addr) { uint8_t buf = 0; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; int ret; @@ -146,7 +146,7 @@ static void __get_spd(generic_spd_eeprom_t *spd, u8 i2c_address) int ret; DEV_TYPE *dev; -#if defined(CONFIG_DM_I2C) +#if CONFIG_IS_ENABLED(DM_I2C) ret = i2c_get_chip_for_busnum(CONFIG_SYS_SPD_BUS_NUM, i2c_address, 1, &dev); if (ret) { 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/fsl_i2c.c b/drivers/i2c/fsl_i2c.c index 52835759686..2200303ea83 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 ba7817478c3..02f0144930c 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 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/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 5df69f14598..d33e2c7c9d8 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 3c91515bffb..003aa33f6ec 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 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/power/palmas.c b/drivers/power/palmas.c index 2584bea38d0..bf9173949cf 100644 --- a/drivers/power/palmas.c +++ b/drivers/power/palmas.c @@ -176,7 +176,7 @@ int twl603x_enable_bb_charge(u8 bb_fields) return err; } -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) int palmas_i2c_write_u8(u8 chip_no, u8 reg, u8 val) { struct udevice *dev; diff --git a/drivers/power/pmic/pmic_tps62362.c b/drivers/power/pmic/pmic_tps62362.c index c3977fccc3b..76fd14db59d 100644 --- a/drivers/power/pmic/pmic_tps62362.c +++ b/drivers/power/pmic/pmic_tps62362.c @@ -10,7 +10,7 @@ #include <power/pmic.h> #include <power/tps62362.h> -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *tps62362_dev __attribute__((section(".data"))) = NULL; #endif @@ -26,7 +26,7 @@ int tps62362_voltage_update(unsigned char reg, unsigned char volt_sel) if (reg > TPS62362_NUM_REGS) return 1; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) return i2c_write(TPS62362_I2C_ADDR, reg, 1, &volt_sel, 1); #else if (!tps62362_dev) @@ -35,7 +35,7 @@ int tps62362_voltage_update(unsigned char reg, unsigned char volt_sel) #endif } -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) int power_tps62362_init(unsigned char bus) { static const char name[] = "TPS62362"; diff --git a/drivers/power/pmic/pmic_tps65217.c b/drivers/power/pmic/pmic_tps65217.c index c839e318905..54b5bed99ad 100644 --- a/drivers/power/pmic/pmic_tps65217.c +++ b/drivers/power/pmic/pmic_tps65217.c @@ -18,7 +18,7 @@ struct udevice *tps65217_dev __attribute__((section(".data"))) = NULL; */ int tps65217_reg_read(uchar src_reg, uchar *src_val) { -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) return i2c_read(TPS65217_CHIP_PM, src_reg, 1, src_val, 1); #else return dm_i2c_read(tps65217_dev, src_reg, src_val, 1); @@ -52,7 +52,7 @@ int tps65217_reg_write(uchar prot_level, uchar dest_reg, uchar dest_val, * mask */ if (mask != TPS65217_MASK_ALL_BITS) { -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_read(TPS65217_CHIP_PM, dest_reg, 1, &read_val, 1); #else ret = dm_i2c_read(tps65217_dev, dest_reg, &read_val, 1); @@ -67,7 +67,7 @@ int tps65217_reg_write(uchar prot_level, uchar dest_reg, uchar dest_val, if (prot_level > 0) { xor_reg = dest_reg ^ TPS65217_PASSWORD_UNLOCK; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_write(TPS65217_CHIP_PM, TPS65217_PASSWORD, 1, &xor_reg, 1); #else @@ -77,7 +77,7 @@ int tps65217_reg_write(uchar prot_level, uchar dest_reg, uchar dest_val, if (ret) return ret; } -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_write(TPS65217_CHIP_PM, dest_reg, 1, &dest_val, 1); #else ret = dm_i2c_write(tps65217_dev, dest_reg, &dest_val, 1); @@ -86,7 +86,7 @@ int tps65217_reg_write(uchar prot_level, uchar dest_reg, uchar dest_val, return ret; if (prot_level == TPS65217_PROT_LEVEL_2) { -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_write(TPS65217_CHIP_PM, TPS65217_PASSWORD, 1, &xor_reg, 1); #else @@ -96,7 +96,7 @@ int tps65217_reg_write(uchar prot_level, uchar dest_reg, uchar dest_val, if (ret) return ret; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_write(TPS65217_CHIP_PM, dest_reg, 1, &dest_val, 1); #else ret = dm_i2c_write(tps65217_dev, dest_reg, &dest_val, 1); @@ -137,7 +137,7 @@ int tps65217_voltage_update(uchar dc_cntrl_reg, uchar volt_sel) int power_tps65217_init(unsigned char bus) { -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev = NULL; int rc; diff --git a/drivers/power/pmic/pmic_tps65218.c b/drivers/power/pmic/pmic_tps65218.c index 7c95e5e7580..f8bae4545c4 100644 --- a/drivers/power/pmic/pmic_tps65218.c +++ b/drivers/power/pmic/pmic_tps65218.c @@ -10,7 +10,7 @@ #include <power/pmic.h> #include <power/tps65218.h> -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) int tps65218_reg_read(uchar dest_reg, uchar *dest_val) { uchar read_val; @@ -225,7 +225,7 @@ int tps65218_lock_fseal(void) return 0; } -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) int power_tps65218_init(unsigned char bus) { static const char name[] = "TPS65218_PMIC"; diff --git a/drivers/power/pmic/pmic_tps65910.c b/drivers/power/pmic/pmic_tps65910.c index 4772de11be2..84a58c28d8f 100644 --- a/drivers/power/pmic/pmic_tps65910.c +++ b/drivers/power/pmic/pmic_tps65910.c @@ -12,7 +12,7 @@ struct udevice *tps65910_dev __attribute__((section(".data"))) = NULL; static inline int tps65910_read_reg(int addr, uchar *buf) { -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) return i2c_read(TPS65910_CTRL_I2C_ADDR, addr, 1, buf, 1); #else int rc; @@ -27,7 +27,7 @@ static inline int tps65910_read_reg(int addr, uchar *buf) static inline int tps65910_write_reg(int addr, uchar *buf) { -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) return i2c_write(TPS65910_CTRL_I2C_ADDR, addr, 1, buf, 1); #else return dm_i2c_reg_write(tps65910_dev, addr, *buf); @@ -36,7 +36,7 @@ static inline int tps65910_write_reg(int addr, uchar *buf) int power_tps65910_init(unsigned char bus) { -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev = NULL; int rc; diff --git a/drivers/power/twl4030.c b/drivers/power/twl4030.c index f48af84e179..d3e8949af99 100644 --- a/drivers/power/twl4030.c +++ b/drivers/power/twl4030.c @@ -182,7 +182,7 @@ int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) } #endif -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) int twl4030_i2c_write_u8(u8 chip_no, u8 reg, u8 val) { struct udevice *dev; diff --git a/drivers/power/twl6030.c b/drivers/power/twl6030.c index 60a5aaaf19f..2b50a56faf8 100644 --- a/drivers/power/twl6030.c +++ b/drivers/power/twl6030.c @@ -270,7 +270,7 @@ void twl6030_usb_device_settings() twl6030_i2c_write_u8(TWL6030_CHIP_PM, TWL6030_MISC2, value); } -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) int twl6030_i2c_write_u8(u8 chip_no, u8 reg, u8 val) { struct udevice *dev; diff --git a/drivers/tpm/tpm_atmel_twi.c b/drivers/tpm/tpm_atmel_twi.c index d9e4877c5c2..2dcc2af67f9 100644 --- a/drivers/tpm/tpm_atmel_twi.c +++ b/drivers/tpm/tpm_atmel_twi.c @@ -81,7 +81,7 @@ static int tpm_atmel_twi_xfer(struct udevice *dev, print_buffer(0, (void *)sendbuf, 1, send_size, 0); #endif -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) res = i2c_write(0x29, 0, 0, (uchar *)sendbuf, send_size); #else res = dm_i2c_write(dev, 0, sendbuf, send_size); @@ -92,7 +92,7 @@ static int tpm_atmel_twi_xfer(struct udevice *dev, } start = get_timer(0); -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) while ((res = i2c_read(0x29, 0, 0, recvbuf, 10))) #else while ((res = dm_i2c_read(dev, 0, recvbuf, 10))) @@ -116,7 +116,7 @@ static int tpm_atmel_twi_xfer(struct udevice *dev, return -1; } else { *recv_len = hdr_recv_len; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) res = i2c_read(0x29, 0, 0, recvbuf, *recv_len); #else res = dm_i2c_read(dev, 0, recvbuf, *recv_len); diff --git a/drivers/usb/host/ohci-lpc32xx.c b/drivers/usb/host/ohci-lpc32xx.c index afb9e29f788..3be0b311a36 100644 --- a/drivers/usb/host/ohci-lpc32xx.c +++ b/drivers/usb/host/ohci-lpc32xx.c @@ -86,7 +86,7 @@ static struct clk_pm_regs *clk_pwr = (struct clk_pm_regs *)CLK_PM_BASE; static int isp1301_set_value(struct udevice *dev, int reg, u8 value) { -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) return i2c_write(ISP1301_I2C_ADDR, reg, 1, &value, 1); #else return dm_i2c_write(dev, reg, &value, 1); @@ -95,7 +95,7 @@ static int isp1301_set_value(struct udevice *dev, int reg, u8 value) static void isp1301_configure(struct udevice *dev) { -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_set_bus_num(I2C_2); #endif @@ -160,7 +160,7 @@ int usb_cpu_init(void) u32 ret; struct udevice *dev = NULL; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) ret = i2c_get_chip_for_busnum(I2C_2, ISP1301_I2C_ADDR, 1, &dev); if (ret) { debug("%s: No bus %d\n", __func__, I2C_2); @@ -216,7 +216,7 @@ int usb_cpu_stop(void) struct udevice *dev = NULL; int ret = 0; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) ret = i2c_get_chip_for_busnum(I2C_2, ISP1301_I2C_ADDR, 1, &dev); if (ret) { debug("%s: No bus %d\n", __func__, I2C_2); |