diff options
author | Igor Opaniuk <igor.opaniuk@foundries.io> | 2021-02-09 13:52:45 +0200 |
---|---|---|
committer | Heiko Schocher <hs@denx.de> | 2021-02-21 06:08:00 +0100 |
commit | 2147a16983d17bcb0438607aa7760494afc27014 (patch) | |
tree | 153470783919253c3a9bbcbc0e34b38c62f138f1 /board | |
parent | a907dce88e462251d96be9cdd72900543e4798df (diff) | |
download | u-boot-2147a16983d17bcb0438607aa7760494afc27014.tar.gz |
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 'board')
39 files changed, 139 insertions, 139 deletions
diff --git a/board/freescale/common/dcu_sii9022a.c b/board/freescale/common/dcu_sii9022a.c index 832ae258f1..9137d246ea 100644 --- a/board/freescale/common/dcu_sii9022a.c +++ b/board/freescale/common/dcu_sii9022a.c @@ -64,7 +64,7 @@ int dcu_set_dvi_encoder(struct fb_videomode *videomode) u8 temp; u16 temp1, temp2; u32 temp3; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; int ret; diff --git a/board/freescale/common/diu_ch7301.c b/board/freescale/common/diu_ch7301.c index 02a271895b..05e6a3acf1 100644 --- a/board/freescale/common/diu_ch7301.c +++ b/board/freescale/common/diu_ch7301.c @@ -53,7 +53,7 @@ int diu_set_dvi_encoder(unsigned int pixclock) u8 temp; temp = I2C_DVI_TEST_PATTERN_VAL; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; ret = i2c_get_chip_for_busnum(CONFIG_SYS_I2C_DVI_BUS_NUM, diff --git a/board/freescale/common/emc2305.c b/board/freescale/common/emc2305.c index 12ad4b3e08..9a75c5a09d 100644 --- a/board/freescale/common/emc2305.c +++ b/board/freescale/common/emc2305.c @@ -24,7 +24,7 @@ void set_fan_speed(u8 data, int chip_addr) I2C_EMC2305_FAN5}; for (index = 0; index < NUM_OF_FANS; index++) { -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) if (i2c_write(chip_addr, Fan[index], 1, &data, 1) != 0) { printf("Error: failed to change fan speed @%x\n", Fan[index]); @@ -48,7 +48,7 @@ void emc2305_init(int chip_addr) u8 data; data = I2C_EMC2305_CMD; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) if (i2c_write(chip_addr, I2C_EMC2305_CONF, 1, &data, 1) != 0) printf("Error: failed to configure EMC2305\n"); #else diff --git a/board/freescale/common/qixis.c b/board/freescale/common/qixis.c index 1696c24e27..2bb838cea6 100644 --- a/board/freescale/common/qixis.c +++ b/board/freescale/common/qixis.c @@ -32,7 +32,7 @@ #ifdef CONFIG_SYS_I2C_FPGA_ADDR u8 qixis_read_i2c(unsigned int reg) { -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) return i2c_reg_read(CONFIG_SYS_I2C_FPGA_ADDR, reg); #else struct udevice *dev; @@ -47,7 +47,7 @@ u8 qixis_read_i2c(unsigned int reg) void qixis_write_i2c(unsigned int reg, u8 value) { u8 val = value; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_reg_write(CONFIG_SYS_I2C_FPGA_ADDR, reg, val); #else struct udevice *dev; diff --git a/board/freescale/common/sys_eeprom.c b/board/freescale/common/sys_eeprom.c index 33ae4c15ba..be0fda0638 100644 --- a/board/freescale/common/sys_eeprom.c +++ b/board/freescale/common/sys_eeprom.c @@ -152,7 +152,7 @@ static int read_eeprom(void) { int ret; #ifdef CONFIG_SYS_EEPROM_BUS_NUM -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) unsigned int bus; #endif #endif @@ -161,13 +161,13 @@ static int read_eeprom(void) return 0; #ifdef CONFIG_SYS_EEPROM_BUS_NUM -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) bus = i2c_get_bus_num(); i2c_set_bus_num(CONFIG_SYS_EEPROM_BUS_NUM); #endif #endif -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, CONFIG_SYS_I2C_EEPROM_ADDR_LEN, (void *)&e, sizeof(e)); @@ -186,7 +186,7 @@ static int read_eeprom(void) #endif #ifdef CONFIG_SYS_EEPROM_BUS_NUM -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_set_bus_num(bus); #endif #endif @@ -223,7 +223,7 @@ static int prog_eeprom(void) int i; void *p; #ifdef CONFIG_SYS_EEPROM_BUS_NUM -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) unsigned int bus; #endif #endif @@ -237,7 +237,7 @@ static int prog_eeprom(void) #endif update_crc(); -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) #ifdef CONFIG_SYS_EEPROM_BUS_NUM bus = i2c_get_bus_num(); i2c_set_bus_num(CONFIG_SYS_EEPROM_BUS_NUM); @@ -250,7 +250,7 @@ static int prog_eeprom(void) * complete a given write. */ for (i = 0, p = &e; i < sizeof(e); i += 8, p += 8) { -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_write(CONFIG_SYS_I2C_EEPROM_ADDR, i, CONFIG_SYS_I2C_EEPROM_ADDR_LEN, p, min((int)(sizeof(e) - i), 8)); @@ -279,7 +279,7 @@ static int prog_eeprom(void) /* Verify the write by reading back the EEPROM and comparing */ struct eeprom e2; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, CONFIG_SYS_I2C_EEPROM_ADDR_LEN, (void *)&e2, sizeof(e2)); @@ -302,7 +302,7 @@ static int prog_eeprom(void) ret = -1; } -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) #ifdef CONFIG_SYS_EEPROM_BUS_NUM i2c_set_bus_num(bus); #endif @@ -594,7 +594,7 @@ unsigned int get_cpu_board_revision(void) u8 minor; /* 0x05 Board revision, minor */ } be; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, CONFIG_SYS_I2C_EEPROM_ADDR_LEN, (void *)&be, sizeof(be)); #else diff --git a/board/freescale/common/vid.c b/board/freescale/common/vid.c index 2617f61520..20f5421da0 100644 --- a/board/freescale/common/vid.c +++ b/board/freescale/common/vid.c @@ -65,14 +65,14 @@ static int find_ir_chip_on_i2c(void) u8 byte; int i; const int ir_i2c_addr[] = {0x38, 0x08, 0x09}; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; #endif /* Check all the address */ for (i = 0; i < (sizeof(ir_i2c_addr)/sizeof(ir_i2c_addr[0])); i++) { i2caddress = ir_i2c_addr[i]; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_read(i2caddress, IR36021_MFR_ID_OFFSET, 1, (void *)&byte, sizeof(byte)); @@ -117,12 +117,12 @@ static int read_voltage_from_INA220(int i2caddress) int i, ret, voltage_read = 0; u16 vol_mon; u8 buf[2]; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; #endif for (i = 0; i < NUM_READINGS; i++) { -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_read(I2C_VOL_MONITOR_ADDR, I2C_VOL_MONITOR_BUS_V_OFFSET, 1, (void *)&buf, 2); @@ -160,12 +160,12 @@ static int read_voltage_from_IR(int i2caddress) int i, ret, voltage_read = 0; u16 vol_mon; u8 buf; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; #endif for (i = 0; i < NUM_READINGS; i++) { -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_read(i2caddress, IR36021_LOOP1_VOUT_OFFSET, 1, (void *)&buf, 1); @@ -213,7 +213,7 @@ static int read_voltage_from_LTC(int i2caddress) int ret, vcode = 0; u8 chan = PWM_CHANNEL0; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) /* select the PAGE 0 using PMBus commands PAGE for VDD*/ ret = i2c_write(I2C_VOL_MONITOR_ADDR, PMBUS_CMD_PAGE, 1, &chan, 1); @@ -229,7 +229,7 @@ static int read_voltage_from_LTC(int i2caddress) return ret; } -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) /*read the output voltage using PMBus command READ_VOUT*/ ret = i2c_read(I2C_VOL_MONITOR_ADDR, PMBUS_CMD_READ_VOUT, 1, (void *)&vcode, 2); @@ -344,7 +344,7 @@ static int set_voltage_to_IR(int i2caddress, int vdd) vid = DIV_ROUND_UP(vdd - 245, 5); #endif -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_write(i2caddress, IR36021_LOOP1_MANUAL_ID_OFFSET, 1, (void *)&vid, sizeof(vid)); #else @@ -392,7 +392,7 @@ static int set_voltage_to_LTC(int i2caddress, int vdd) vdd & 0xFF, (vdd & 0xFF00) >> 8}; /* Write the desired voltage code to the regulator */ -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) /* Check write protect state */ ret = i2c_read(I2C_VOL_MONITOR_ADDR, PMBUS_CMD_WRITE_PROTECT, 1, @@ -621,7 +621,7 @@ int adjust_vdd(ulong vdd_override) } /* check IR chip work on Intel mode*/ -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_read(i2caddress, IR36021_INTEL_MODE_OOFSET, 1, (void *)&buf, 1); @@ -803,7 +803,7 @@ int adjust_vdd(ulong vdd_override) } /* check IR chip work on Intel mode*/ -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_read(i2caddress, IR36021_INTEL_MODE_OOFSET, 1, (void *)&buf, 1); diff --git a/board/freescale/common/vsc3316_3308.c b/board/freescale/common/vsc3316_3308.c index 8aceb8ef17..c51f3c5aca 100644 --- a/board/freescale/common/vsc3316_3308.c +++ b/board/freescale/common/vsc3316_3308.c @@ -34,7 +34,7 @@ int vsc_if_enable(unsigned int vsc_addr) /* enable 2-wire Serial InterFace (I2C) */ data = 0x02; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) int ret, bus_num = 0; struct udevice *dev; @@ -62,7 +62,7 @@ int vsc3316_config(unsigned int vsc_addr, int8_t con_arr[][2], debug("VSC:Initializing VSC3316 at I2C address 0x%2x" " for Tx\n", vsc_addr); -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) int bus_num = 0; struct udevice *dev; @@ -185,7 +185,7 @@ int vsc3308_config_adjust(unsigned int vsc_addr, const int8_t con_arr[][2], debug("VSC:Initializing VSC3308 at I2C address 0x%x for Tx\n", vsc_addr); -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) int bus_num = 0; struct udevice *dev; @@ -385,7 +385,7 @@ int vsc3308_config(unsigned int vsc_addr, const int8_t con_arr[][2], debug("VSC:Initializing VSC3308 at I2C address 0x%x" " for Tx\n", vsc_addr); -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) int bus_num = 0; struct udevice *dev; @@ -509,7 +509,7 @@ void vsc_wp_config(unsigned int vsc_addr) /* For new crosspoint configuration to occur, WP bit of * CORE_CONFIG_REG should be set 1 and then reset to 0 */ -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) int ret, bus_num = 0; struct udevice *dev; diff --git a/board/freescale/ls1012aqds/ls1012aqds.c b/board/freescale/ls1012aqds/ls1012aqds.c index b77808ea57..cfe3f3360c 100644 --- a/board/freescale/ls1012aqds/ls1012aqds.c +++ b/board/freescale/ls1012aqds/ls1012aqds.c @@ -112,7 +112,7 @@ int misc_init_r(void) u8 mux_sdhc_cd = 0x80; int bus_num = 0; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; int ret; diff --git a/board/freescale/ls1012ardb/eth.c b/board/freescale/ls1012ardb/eth.c index 2241d061dd..bb3fbc71ef 100644 --- a/board/freescale/ls1012ardb/eth.c +++ b/board/freescale/ls1012ardb/eth.c @@ -29,7 +29,7 @@ static inline void ls1012ardb_reset_phy(void) { #ifdef CONFIG_TARGET_LS1012ARDB /* Through reset IO expander reset both RGMII and SGMII PHYs */ -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; int ret; diff --git a/board/freescale/ls1012ardb/ls1012ardb.c b/board/freescale/ls1012ardb/ls1012ardb.c index ed6dc9ff71..41bcf6f935 100644 --- a/board/freescale/ls1012ardb/ls1012ardb.c +++ b/board/freescale/ls1012ardb/ls1012ardb.c @@ -43,7 +43,7 @@ int checkboard(void) puts("Board: LS1012ARDB "); /* Initialize i2c early for Serial flash bank information */ -#if defined(CONFIG_DM_I2C) +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; ret = i2c_get_chip_for_busnum(bus_num, I2C_MUX_IO_ADDR, @@ -195,7 +195,7 @@ int esdhc_status_fixup(void *blob, const char *compat) u8 io = 0; int ret, bus_num = 0; -#if defined(CONFIG_DM_I2C) +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; ret = i2c_get_chip_for_busnum(bus_num, I2C_MUX_IO_ADDR, @@ -234,7 +234,7 @@ int esdhc_status_fixup(void *blob, const char *compat) * 10 - eMMC Memory * 11 - SPI */ -#if defined(CONFIG_DM_I2C) +#if CONFIG_IS_ENABLED(DM_I2C) ret = dm_i2c_read(dev, I2C_MUX_IO_0, &io, 1); #else ret = i2c_read(I2C_MUX_IO_ADDR, I2C_MUX_IO_0, 1, &io, 1); @@ -273,7 +273,7 @@ static int switch_to_bank1(void) u8 data = 0xf4, chip_addr = 0x24, offset_addr = 0x03; int ret, bus_num = 0; -#if defined(CONFIG_DM_I2C) +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; ret = i2c_get_chip_for_busnum(bus_num, chip_addr, @@ -338,7 +338,7 @@ static int switch_to_bank2(void) u8 chip_addr = 0x24; int ret, i, bus_num = 0; -#if defined(CONFIG_DM_I2C) +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; ret = i2c_get_chip_for_busnum(bus_num, chip_addr, @@ -361,7 +361,7 @@ static int switch_to_bank2(void) * CS routed to SPI memory bank2 */ for (i = 0; i < sizeof(data); i++) { -#if defined(CONFIG_DM_I2C) +#if CONFIG_IS_ENABLED(DM_I2C) ret = dm_i2c_write(dev, offset_addr[i], &data[i], 1); #else /* Non DM I2C support - will be removed */ ret = i2c_write(chip_addr, offset_addr[i], 1, &data[i], 1); diff --git a/board/freescale/ls1021aqds/dcu.c b/board/freescale/ls1021aqds/dcu.c index f66961ca59..7532f7c0b2 100644 --- a/board/freescale/ls1021aqds/dcu.c +++ b/board/freescale/ls1021aqds/dcu.c @@ -20,7 +20,7 @@ DECLARE_GLOBAL_DATA_PTR; static int select_i2c_ch_pca9547(u8 ch, int bus_num) { int ret; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; ret = i2c_get_chip_for_busnum(bus_num, I2C_MUX_PCA_ADDR_PRI, @@ -65,7 +65,7 @@ int platform_dcu_init(struct fb_info *fbinfo, u8 ch; /* Mux I2C3+I2C4 as HSYNC+VSYNC */ -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; /* QIXIS device mount on I2C1 bus*/ @@ -113,7 +113,7 @@ int platform_dcu_init(struct fb_info *fbinfo, pixval = 1000000000 / dcu_fb_videomode->pixclock; pixval *= 1000; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_set_bus_num(CONFIG_SYS_I2C_DVI_BUS_NUM); #endif select_i2c_ch_pca9547(I2C_MUX_CH_CH7301, diff --git a/board/freescale/ls1021aqds/ls1021aqds.c b/board/freescale/ls1021aqds/ls1021aqds.c index 4169a0fc85..aa1f6025c1 100644 --- a/board/freescale/ls1021aqds/ls1021aqds.c +++ b/board/freescale/ls1021aqds/ls1021aqds.c @@ -144,7 +144,7 @@ unsigned long get_board_ddr_clk(void) int select_i2c_ch_pca9547(u8 ch, int bus_num) { int ret; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; ret = i2c_get_chip_for_busnum(bus_num, I2C_MUX_PCA_ADDR_PRI, diff --git a/board/freescale/ls1021atwr/ls1021atwr.c b/board/freescale/ls1021atwr/ls1021atwr.c index 0cd38a14b8..4c3be42179 100644 --- a/board/freescale/ls1021atwr/ls1021atwr.c +++ b/board/freescale/ls1021atwr/ls1021atwr.c @@ -458,7 +458,7 @@ void ls1twr_program_regulator(void) #define MC34VR500_ADDR 0x8 #define MC34VR500_DEVICEID 0x4 #define MC34VR500_DEVICEID_MASK 0x0f -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; int ret; diff --git a/board/freescale/ls1028a/ls1028a.c b/board/freescale/ls1028a/ls1028a.c index f3c1d958b7..5269fd34c6 100644 --- a/board/freescale/ls1028a/ls1028a.c +++ b/board/freescale/ls1028a/ls1028a.c @@ -92,7 +92,7 @@ int board_init(void) #if defined(CONFIG_TARGET_LS1028ARDB) u8 val = I2C_MUX_CH_DEFAULT; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_write(I2C_MUX_PCA_ADDR_PRI, 0x0b, 1, &val, 1); #else struct udevice *dev; diff --git a/board/freescale/ls1043aqds/ls1043aqds.c b/board/freescale/ls1043aqds/ls1043aqds.c index 44e4c61eab..5b131d1d67 100644 --- a/board/freescale/ls1043aqds/ls1043aqds.c +++ b/board/freescale/ls1043aqds/ls1043aqds.c @@ -283,7 +283,7 @@ int select_i2c_ch_pca9547(u8 ch, int bus_num) { int ret; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; ret = i2c_get_chip_for_busnum(bus_num, I2C_MUX_PCA_ADDR_PRI, @@ -338,7 +338,7 @@ void board_retimer_init(void) /* Retimer is connected to I2C1_CH7_CH5 */ select_i2c_ch_pca9547(I2C_MUX_CH7, bus_num); reg = I2C_MUX_CH5; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; int ret; diff --git a/board/freescale/ls1046afrwy/ls1046afrwy.c b/board/freescale/ls1046afrwy/ls1046afrwy.c index 9813a36ca0..f1709dcd1c 100644 --- a/board/freescale/ls1046afrwy/ls1046afrwy.c +++ b/board/freescale/ls1046afrwy/ls1046afrwy.c @@ -42,7 +42,7 @@ int select_i2c_ch_pca9547(u8 ch, int bus_num) { int ret; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; ret = i2c_get_chip_for_busnum(bus_num, I2C_MUX_PCA_ADDR_PRI, diff --git a/board/freescale/ls1046aqds/ls1046aqds.c b/board/freescale/ls1046aqds/ls1046aqds.c index 3c96c900c3..20694426af 100644 --- a/board/freescale/ls1046aqds/ls1046aqds.c +++ b/board/freescale/ls1046aqds/ls1046aqds.c @@ -279,7 +279,7 @@ u32 get_lpuart_clk(void) int select_i2c_ch_pca9547(u8 ch, int bus_num) { int ret; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; ret = i2c_get_chip_for_busnum(bus_num, I2C_MUX_PCA_ADDR_PRI, diff --git a/board/freescale/ls1088a/eth_ls1088aqds.c b/board/freescale/ls1088a/eth_ls1088aqds.c index bf4f57e6f8..140733de6a 100644 --- a/board/freescale/ls1088a/eth_ls1088aqds.c +++ b/board/freescale/ls1088a/eth_ls1088aqds.c @@ -114,12 +114,12 @@ static void sgmii_configure_repeater(int dpmac) {0x18, NULL}, {0x23, ®_val[3]}, {0x2d, ®_val[4]}, {4, ®_val[5]}, }; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *udev; #endif /* Set I2c to Slot 1 */ -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_write(0x77, 0, 0, &a, 1); #else ret = i2c_get_chip_for_busnum(0, 0x77, 1, &udev); @@ -173,7 +173,7 @@ static void sgmii_configure_repeater(int dpmac) return; } -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) i2c_get_chip_for_busnum(0, i2c_phy_addr, 1, &udev); #endif @@ -184,7 +184,7 @@ static void sgmii_configure_repeater(int dpmac) reg_pair[5].val = &ch_b_eq[i]; reg_pair[6].val = &ch_b_ctl2[j]; for (k = 0; k < 10; k++) { -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_write(i2c_phy_addr, reg_pair[k].addr, 1, reg_pair[k].val, 1); @@ -257,12 +257,12 @@ static void qsgmii_configure_repeater(int dpmac) const char *dev = mdio_names[EMI1_SLOT1]; int ret = 0; unsigned short value; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *udev; #endif /* Set I2c to Slot 1 */ -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_write(0x77, 0, 0, &a, 1); #else ret = i2c_get_chip_for_busnum(0, 0x77, 1, &udev); @@ -304,7 +304,7 @@ static void qsgmii_configure_repeater(int dpmac) return; } -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) i2c_get_chip_for_busnum(0, i2c_phy_addr, 1, &udev); #endif @@ -316,7 +316,7 @@ static void qsgmii_configure_repeater(int dpmac) reg_pair[6].val = &ch_b_ctl2[j]; for (k = 0; k < 10; k++) { -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_write(i2c_phy_addr, reg_pair[k].addr, 1, reg_pair[k].val, 1); diff --git a/board/freescale/ls1088a/ls1088a.c b/board/freescale/ls1088a/ls1088a.c index 2ba6a3990d..e76ea01914 100644 --- a/board/freescale/ls1088a/ls1088a.c +++ b/board/freescale/ls1088a/ls1088a.c @@ -379,7 +379,7 @@ int select_i2c_ch_pca9547(u8 ch) { int ret; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_write(I2C_MUX_PCA_ADDR_PRI, 0, 1, &ch, 1); #else struct udevice *dev; @@ -406,7 +406,7 @@ void board_retimer_init(void) /* Access to Control/Shared register */ reg = 0x0; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_write(I2C_RETIMER_ADDR, 0xff, 1, ®, 1); #else struct udevice *dev; @@ -416,7 +416,7 @@ void board_retimer_init(void) #endif /* Read device revision and ID */ -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_read(I2C_RETIMER_ADDR, 1, 1, ®, 1); #else dm_i2c_read(dev, 1, ®, 1); @@ -425,20 +425,20 @@ void board_retimer_init(void) /* Enable Broadcast. All writes target all channel register sets */ reg = 0x0c; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_write(I2C_RETIMER_ADDR, 0xff, 1, ®, 1); #else dm_i2c_write(dev, 0xff, ®, 1); #endif /* Reset Channel Registers */ -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_read(I2C_RETIMER_ADDR, 0, 1, ®, 1); #else dm_i2c_read(dev, 0, ®, 1); #endif reg |= 0x4; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_write(I2C_RETIMER_ADDR, 0, 1, ®, 1); #else dm_i2c_write(dev, 0, ®, 1); @@ -446,45 +446,45 @@ void board_retimer_init(void) /* Set data rate as 10.3125 Gbps */ reg = 0x90; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_write(I2C_RETIMER_ADDR, 0x60, 1, ®, 1); #else dm_i2c_write(dev, 0x60, ®, 1); #endif reg = 0xb3; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_write(I2C_RETIMER_ADDR, 0x61, 1, ®, 1); #else dm_i2c_write(dev, 0x61, ®, 1); #endif reg = 0x90; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_write(I2C_RETIMER_ADDR, 0x62, 1, ®, 1); #else dm_i2c_write(dev, 0x62, ®, 1); #endif reg = 0xb3; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_write(I2C_RETIMER_ADDR, 0x63, 1, ®, 1); #else dm_i2c_write(dev, 0x63, ®, 1); #endif reg = 0xcd; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_write(I2C_RETIMER_ADDR, 0x64, 1, ®, 1); #else dm_i2c_write(dev, 0x64, ®, 1); #endif /* Select VCO Divider to full rate (000) */ -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_read(I2C_RETIMER_ADDR, 0x2F, 1, ®, 1); #else dm_i2c_read(dev, 0x2F, ®, 1); #endif reg &= 0x0f; reg |= 0x70; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_write(I2C_RETIMER_ADDR, 0x2F, 1, ®, 1); #else dm_i2c_write(dev, 0x2F, ®, 1); @@ -496,7 +496,7 @@ void board_retimer_init(void) /* Access to Control/Shared register */ reg = 0x0; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_write(I2C_RETIMER_ADDR2, 0xff, 1, ®, 1); #else i2c_get_chip_for_busnum(0, I2C_RETIMER_ADDR2, 1, &dev); @@ -504,7 +504,7 @@ void board_retimer_init(void) #endif /* Read device revision and ID */ -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_read(I2C_RETIMER_ADDR2, 1, 1, ®, 1); #else dm_i2c_read(dev, 1, ®, 1); @@ -513,20 +513,20 @@ void board_retimer_init(void) /* Enable Broadcast. All writes target all channel register sets */ reg = 0x0c; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_write(I2C_RETIMER_ADDR2, 0xff, 1, ®, 1); #else dm_i2c_write(dev, 0xff, ®, 1); #endif /* Reset Channel Registers */ -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_read(I2C_RETIMER_ADDR2, 0, 1, ®, 1); #else dm_i2c_read(dev, 0, ®, 1); #endif reg |= 0x4; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_write(I2C_RETIMER_ADDR2, 0, 1, ®, 1); #else dm_i2c_write(dev, 0, ®, 1); @@ -534,45 +534,45 @@ void board_retimer_init(void) /* Set data rate as 10.3125 Gbps */ reg = 0x90; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_write(I2C_RETIMER_ADDR2, 0x60, 1, ®, 1); #else dm_i2c_write(dev, 0x60, ®, 1); #endif reg = 0xb3; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_write(I2C_RETIMER_ADDR2, 0x61, 1, ®, 1); #else dm_i2c_write(dev, 0x61, ®, 1); #endif reg = 0x90; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_write(I2C_RETIMER_ADDR2, 0x62, 1, ®, 1); #else dm_i2c_write(dev, 0x62, ®, 1); #endif reg = 0xb3; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_write(I2C_RETIMER_ADDR2, 0x63, 1, ®, 1); #else dm_i2c_write(dev, 0x63, ®, 1); #endif reg = 0xcd; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_write(I2C_RETIMER_ADDR2, 0x64, 1, ®, 1); #else dm_i2c_write(dev, 0x64, ®, 1); #endif /* Select VCO Divider to full rate (000) */ -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_read(I2C_RETIMER_ADDR2, 0x2F, 1, ®, 1); #else dm_i2c_read(dev, 0x2F, ®, 1); #endif reg &= 0x0f; reg |= 0x70; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_write(I2C_RETIMER_ADDR2, 0x2F, 1, ®, 1); #else dm_i2c_write(dev, 0x2F, ®, 1); @@ -640,7 +640,7 @@ int get_serdes_volt(void) u8 chan = PWM_CHANNEL0; /* Select the PAGE 0 using PMBus commands PAGE for VDD */ -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_write(I2C_SVDD_MONITOR_ADDR, PMBUS_CMD_PAGE, 1, &chan, 1); #else @@ -658,7 +658,7 @@ int get_serdes_volt(void) } /* Read the output voltage using PMBus command READ_VOUT */ -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_read(I2C_SVDD_MONITOR_ADDR, PMBUS_CMD_READ_VOUT, 1, (void *)&vcode, 2); #else @@ -679,7 +679,7 @@ int set_serdes_volt(int svdd) svdd & 0xFF, (svdd & 0xFF00) >> 8}; /* Write the desired voltage code to the SVDD regulator */ -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_write(I2C_SVDD_MONITOR_ADDR, PMBUS_CMD_PAGE_PLUS_WRITE, 1, (void *)&buff, 5); #else @@ -720,7 +720,7 @@ int set_serdes_volt(int svdd) printf("SVDD changing of RDB\n"); /* Read the BRDCFG54 via CLPD */ -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_read(CONFIG_SYS_I2C_FPGA_ADDR, QIXIS_BRDCFG4_OFFSET, 1, (void *)&brdcfg4, 1); #else @@ -740,7 +740,7 @@ int set_serdes_volt(int svdd) brdcfg4 = brdcfg4 | 0x08; /* Write to the BRDCFG4 */ -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_write(CONFIG_SYS_I2C_FPGA_ADDR, QIXIS_BRDCFG4_OFFSET, 1, (void *)&brdcfg4, 1); #else diff --git a/board/freescale/ls2080aqds/eth.c b/board/freescale/ls2080aqds/eth.c index 4b7f85540d..914cd0a9ab 100644 --- a/board/freescale/ls2080aqds/eth.c +++ b/board/freescale/ls2080aqds/eth.c @@ -125,12 +125,12 @@ static void sgmii_configure_repeater(int serdes_port) }; int *riser_phy_addr = &xqsgii_riser_phy_addr[0]; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *udev; #endif /* Set I2c to Slot 1 */ -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_write(0x77, 0, 0, &a, 1); #else ret = i2c_get_chip_for_busnum(0, 0x77, 1, &udev); @@ -151,7 +151,7 @@ static void sgmii_configure_repeater(int serdes_port) mii_bus = 1; dpmac_id = dpmac + 9; a = 0xb; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_write(0x76, 0, 0, &a, 1); #else ret = i2c_get_chip_for_busnum(0, 0x76, 1, &udev); @@ -198,7 +198,7 @@ static void sgmii_configure_repeater(int serdes_port) reg_pair[6].val = &ch_b_ctl2[j]; for (k = 0; k < 10; k++) { -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_write(i2c_addr[dpmac], reg_pair[k].addr, 1, reg_pair[k].val, 1); @@ -277,12 +277,12 @@ static void qsgmii_configure_repeater(int dpmac) const char *dev = "LS2080A_QDS_MDIO0"; int ret = 0; unsigned short value; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *udev; #endif /* Set I2c to Slot 1 */ -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_write(0x77, 0, 0, &a, 1); #else ret = i2c_get_chip_for_busnum(0, 0x77, 1, &udev); @@ -347,7 +347,7 @@ static void qsgmii_configure_repeater(int dpmac) reg_pair[6].val = &ch_b_ctl2[j]; for (k = 0; k < 10; k++) { -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_write(i2c_phy_addr, reg_pair[k].addr, 1, reg_pair[k].val, 1); diff --git a/board/freescale/ls2080aqds/ls2080aqds.c b/board/freescale/ls2080aqds/ls2080aqds.c index a6f6897eb0..9572319234 100644 --- a/board/freescale/ls2080aqds/ls2080aqds.c +++ b/board/freescale/ls2080aqds/ls2080aqds.c @@ -164,7 +164,7 @@ unsigned long get_board_ddr_clk(void) int select_i2c_ch_pca9547(u8 ch) { int ret; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; ret = i2c_get_chip_for_busnum(0, I2C_MUX_PCA_ADDR_PRI, 1, &dev); @@ -238,7 +238,7 @@ int board_init(void) select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT); #ifdef CONFIG_RTC_ENABLE_32KHZ_OUTPUT -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) rtc_enable_32khz_output(0, CONFIG_SYS_I2C_RTC_ADDR); #else rtc_enable_32khz_output(); diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c index 26ce5a80ed..c5ae02bc93 100644 --- a/board/freescale/ls2080ardb/ls2080ardb.c +++ b/board/freescale/ls2080ardb/ls2080ardb.c @@ -167,7 +167,7 @@ int select_i2c_ch_pca9547(u8 ch) { int ret; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_write(I2C_MUX_PCA_ADDR_PRI, 0, 1, &ch, 1); #else struct udevice *dev; diff --git a/board/freescale/lx2160a/lx2160a.c b/board/freescale/lx2160a/lx2160a.c index 1d203ec6da..b32e487e76 100644 --- a/board/freescale/lx2160a/lx2160a.c +++ b/board/freescale/lx2160a/lx2160a.c @@ -83,7 +83,7 @@ int select_i2c_ch_pca9547(u8 ch) { int ret; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) ret = i2c_write(I2C_MUX_PCA_ADDR_PRI, 0, 1, &ch, 1); #else struct udevice *dev; diff --git a/board/freescale/p1010rdb/p1010rdb.c b/board/freescale/p1010rdb/p1010rdb.c index 7e007da87c..90436337df 100644 --- a/board/freescale/p1010rdb/p1010rdb.c +++ b/board/freescale/p1010rdb/p1010rdb.c @@ -141,7 +141,7 @@ int config_board_mux(int ctrl_type) ccsr_gur_t __iomem *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); u8 tmp; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; int ret; #if defined(CONFIG_TARGET_P1010RDB_PA) @@ -377,7 +377,7 @@ int i2c_pca9557_read(int type) u8 val; int bus_num = I2C_PCA9557_BUS_NUM; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; int ret; @@ -419,7 +419,7 @@ int checkboard(void) printf("Board: %sRDB-PA, ", cpu->name); #elif defined(CONFIG_TARGET_P1010RDB_PB) printf("Board: %sRDB-PB, ", cpu->name); -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; int ret; @@ -462,7 +462,7 @@ int checkboard(void) case 0xe: puts("SDHC\n"); val = 0x60; /* set pca9557 pin input/output */ -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) dm_i2c_write(dev, 3, &val, 1); #else i2c_write(I2C_PCA9557_ADDR2, 3, 1, &val, 1); diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c index 4584f0147b..8273384f2d 100644 --- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c +++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c @@ -173,7 +173,7 @@ int checkboard(void) in_8(&cpld_data->pcba_rev) & 0x0F); /* Initialize i2c early for rom_loc and flash bank information */ - #if defined(CONFIG_DM_I2C) + #if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; int ret; diff --git a/board/freescale/t102xrdb/t102xrdb.c b/board/freescale/t102xrdb/t102xrdb.c index 2770e104ee..51a36abe36 100644 --- a/board/freescale/t102xrdb/t102xrdb.c +++ b/board/freescale/t102xrdb/t102xrdb.c @@ -259,7 +259,7 @@ static u32 t1023rdb_ctrl(u32 ctrl_type) u8 tmp; int bus_num = I2C_PCA6408_BUS_NUM; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; int ret; diff --git a/board/freescale/t208xqds/t208xqds.c b/board/freescale/t208xqds/t208xqds.c index dedf722c69..36bb399293 100644 --- a/board/freescale/t208xqds/t208xqds.c +++ b/board/freescale/t208xqds/t208xqds.c @@ -83,7 +83,7 @@ int select_i2c_ch_pca9547(u8 ch, int bus_num) { int ret; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; ret = i2c_get_chip_for_busnum(bus_num, I2C_MUX_PCA_ADDR_PRI, 1, &dev); diff --git a/board/friendlyarm/nanopi2/onewire.c b/board/friendlyarm/nanopi2/onewire.c index 994befb1ec..fb356639be 100644 --- a/board/friendlyarm/nanopi2/onewire.c +++ b/board/friendlyarm/nanopi2/onewire.c @@ -35,7 +35,7 @@ static int bus_type = -1; static int lcd_id = -1; static unsigned short lcd_fwrev; static int current_brightness = -1; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) static struct udevice *i2c_dev; #endif @@ -182,7 +182,7 @@ static int onewire_i2c_do_request(unsigned char req, unsigned char *buf) tx[0] = req; tx[1] = crc8_ow(req << 24, 8); -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) if (dm_i2c_write(i2c_dev, 0, tx, 2)) return -EIO; @@ -214,7 +214,7 @@ static void onewire_i2c_init(void) unsigned char buf[4]; int ret; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) ret = i2c_get_chip_for_busnum(ONEWIRE_I2C_BUS, ONEWIRE_I2C_ADDR, 0, &i2c_dev); #else diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c index bc8ffd56e1..9a3a856be0 100644 --- a/board/keymile/common/ivm.c +++ b/board/keymile/common/ivm.c @@ -333,7 +333,7 @@ static int ivm_populate_env(unsigned char *buf, int len, int mac_address_offset) int ivm_read_eeprom(unsigned char *buf, int len, int mac_address_offset) { int ret; -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *eedev = NULL; ret = i2c_get_chip_for_busnum(CONFIG_KM_IVM_BUS, diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c index 7d3b9846e3..d48ba7eaf0 100644 --- a/board/samsung/common/misc.c +++ b/board/samsung/common/misc.c @@ -117,7 +117,7 @@ void set_board_info(void) #ifdef CONFIG_LCD_MENU static int power_key_pressed(u32 reg) { -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ +#if !CONFIG_IS_ENABLED(DM_I2C) /* TODO(maintainer): Convert to driver model */ struct pmic *pmic; u32 status; u32 mask; diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c index 2e80dbbc84..d06687620c 100644 --- a/board/samsung/trats/trats.c +++ b/board/samsung/trats/trats.c @@ -52,7 +52,7 @@ int exynos_init(void) return 0; } -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ +#if !CONFIG_IS_ENABLED(DM_I2C) /* TODO(maintainer): Convert to driver model */ static void trats_low_power_mode(void) { struct exynos4_clock *clk = @@ -114,7 +114,7 @@ static void trats_low_power_mode(void) int exynos_power_init(void) { -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ +#if !CONFIG_IS_ENABLED(DM_I2C) /* TODO(maintainer): Convert to driver model */ int chrg, ret; struct power_battery *pb; struct pmic *p_fg, *p_chrg, *p_muic, *p_bat; @@ -293,7 +293,7 @@ int board_usb_init(int index, enum usb_init_type init) int g_dnl_board_usb_cable_connected(void) { -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ +#if !CONFIG_IS_ENABLED(DM_I2C) /* TODO(maintainer): Convert to driver model */ struct pmic *muic = pmic_get("MAX8997_MUIC"); if (!muic) return 0; @@ -415,7 +415,7 @@ void exynos_reset_lcd(void) int lcd_power(void) { -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ +#if !CONFIG_IS_ENABLED(DM_I2C) /* TODO(maintainer): Convert to driver model */ int ret = 0; struct pmic *p = pmic_get("MAX8997_PMIC"); if (!p) @@ -439,7 +439,7 @@ int lcd_power(void) int mipi_power(void) { -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ +#if !CONFIG_IS_ENABLED(DM_I2C) /* TODO(maintainer): Convert to driver model */ int ret = 0; struct pmic *p = pmic_get("MAX8997_PMIC"); if (!p) diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c index 69e0ef192d..59e6fbf4b0 100644 --- a/board/samsung/trats2/trats2.c +++ b/board/samsung/trats2/trats2.c @@ -129,7 +129,7 @@ int exynos_init(void) int exynos_power_init(void) { -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ +#if !CONFIG_IS_ENABLED(DM_I2C) /* TODO(maintainer): Convert to driver model */ int chrg; struct power_battery *pb; struct pmic *p_chrg, *p_muic, *p_fg, *p_bat; @@ -192,7 +192,7 @@ int exynos_power_init(void) #ifdef CONFIG_USB_GADGET static int s5pc210_phy_control(int on) { -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ +#if !CONFIG_IS_ENABLED(DM_I2C) /* TODO(maintainer): Convert to driver model */ int ret = 0; unsigned int val; struct pmic *p, *p_pmic, *p_muic; @@ -269,7 +269,7 @@ int board_usb_init(int index, enum usb_init_type init) int g_dnl_board_usb_cable_connected(void) { -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ +#if !CONFIG_IS_ENABLED(DM_I2C) /* TODO(maintainer): Convert to driver model */ struct pmic *muic = pmic_get("MAX77693_MUIC"); if (!muic) return 0; @@ -288,7 +288,7 @@ int g_dnl_board_usb_cable_connected(void) #ifdef CONFIG_LCD int mipi_power(void) { -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ +#if !CONFIG_IS_ENABLED(DM_I2C) /* TODO(maintainer): Convert to driver model */ struct pmic *p = pmic_get("MAX77686_PMIC"); /* LDO8 VMIPI_1.0V_AP */ @@ -302,7 +302,7 @@ int mipi_power(void) void exynos_lcd_power_on(void) { -#ifndef CONFIG_DM_I2C /* TODO(maintainer): Convert to driver model */ +#if !CONFIG_IS_ENABLED(DM_I2C) /* TODO(maintainer): Convert to driver model */ struct pmic *p = pmic_get("MAX77686_PMIC"); /* LCD_2.2V_EN: GPC0[1] */ diff --git a/board/sunxi/board.c b/board/sunxi/board.c index c150810d16..21651a1bfc 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -293,7 +293,7 @@ int board_init(void) } } -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) /* * Temporary workaround for enabling I2C clocks until proper sunxi DM * clk, reset and pinctrl drivers land. diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index 2cd0a1281f..bc1657e88f 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -77,7 +77,7 @@ static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE; void do_board_detect(void) { enable_i2c0_pin_mux(); -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE); #endif if (ti_i2c_eeprom_am_get(CONFIG_EEPROM_BUS_ADDRESS, @@ -336,7 +336,7 @@ static void scale_vcores_bone(int freq) if (board_is_bone() && !strncmp(board_ti_get_rev(), "00A1", 4)) return; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) if (i2c_probe(TPS65217_CHIP_PM)) return; #else @@ -435,7 +435,7 @@ void scale_vcores_generic(int freq) * 1.10V. For MPU voltage we need to switch based on * the frequency we are running at. */ -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) if (i2c_probe(TPS65910_CTRL_I2C_ADDR)) return; #else @@ -469,7 +469,7 @@ void gpi2c_init(void) if (first_time) { enable_i2c0_pin_mux(); -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE); #endif diff --git a/board/ti/am335x/mux.c b/board/ti/am335x/mux.c index 6fb2c009ba..03adcd2b76 100644 --- a/board/ti/am335x/mux.c +++ b/board/ti/am335x/mux.c @@ -333,7 +333,7 @@ static unsigned short detect_daughter_board_profile(void) { unsigned short val; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) if (i2c_probe(I2C_CPLD_ADDR)) return PROFILE_NONE; diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c index ac0d792643..e9febb9592 100644 --- a/board/ti/am43xx/board.c +++ b/board/ti/am43xx/board.c @@ -393,7 +393,7 @@ void scale_vcores_generic(u32 m) { int mpu_vdd, ddr_volt; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) if (i2c_probe(TPS65218_CHIP_PM)) return; #else @@ -451,7 +451,7 @@ void scale_vcores_idk(u32 m) { int mpu_vdd; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) if (i2c_probe(TPS62362_I2C_ADDR)) return; #else @@ -492,7 +492,7 @@ void gpi2c_init(void) if (first_time) { enable_i2c0_pin_mux(); -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE); #endif @@ -632,14 +632,14 @@ void sdram_init(void) int power_init_board(void) { int rc; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) struct pmic *p = NULL; #endif if (board_is_idk()) { rc = power_tps62362_init(0); if (rc) goto done; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) p = pmic_get("TPS62362"); if (!p || pmic_probe(p)) goto done; @@ -649,7 +649,7 @@ int power_init_board(void) rc = power_tps65218_init(0); if (rc) goto done; -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) p = pmic_get("TPS65218_PMIC"); if (!p || pmic_probe(p)) goto done; diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c index 8b3b4bc825..de92eb0981 100644 --- a/board/ti/common/board_detect.c +++ b/board/ti/common/board_detect.c @@ -22,7 +22,7 @@ #include "board_detect.h" -#if !defined(CONFIG_DM_I2C) +#if !CONFIG_IS_ENABLED(DM_I2C) /** * ti_i2c_eeprom_init - Initialize an i2c bus and probe for a device * @i2c_bus: i2c bus number to initialize @@ -89,7 +89,7 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr, u32 hdr_read; int rc; -#if defined(CONFIG_DM_I2C) +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *dev; struct udevice *bus; diff --git a/board/ti/ks2_evm/board_k2g.c b/board/ti/ks2_evm/board_k2g.c index 2be86d6d26..5229afad63 100644 --- a/board/ti/ks2_evm/board_k2g.c +++ b/board/ti/ks2_evm/board_k2g.c @@ -259,7 +259,7 @@ int board_fit_config_name_match(const char *name) #if defined(CONFIG_DTB_RESELECT) static int k2g_alt_board_detect(void) { -#ifndef CONFIG_DM_I2C +#if !CONFIG_IS_ENABLED(DM_I2C) int rc; rc = i2c_set_bus_num(1); diff --git a/board/wandboard/wandboard.c b/board/wandboard/wandboard.c index 53299c8701..da995dd0f5 100644 --- a/board/wandboard/wandboard.c +++ b/board/wandboard/wandboard.c @@ -54,7 +54,7 @@ DECLARE_GLOBAL_DATA_PTR; #define REV_DETECTION IMX_GPIO_NR(2, 28) /* Speed defined in Kconfig is only applicable when not using DM_I2C. */ -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) #define I2C1_SPEED_NON_DM 0 #define I2C2_SPEED_NON_DM 0 #else @@ -259,7 +259,7 @@ static void do_enable_hdmi(struct display_info_t const *dev) static int detect_i2c(struct display_info_t const *dev) { -#ifdef CONFIG_DM_I2C +#if CONFIG_IS_ENABLED(DM_I2C) struct udevice *bus, *udev; int rc; |