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/freescale/common | |
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 'board/freescale/common')
-rw-r--r-- | board/freescale/common/dcu_sii9022a.c | 2 | ||||
-rw-r--r-- | board/freescale/common/diu_ch7301.c | 2 | ||||
-rw-r--r-- | board/freescale/common/emc2305.c | 4 | ||||
-rw-r--r-- | board/freescale/common/qixis.c | 4 | ||||
-rw-r--r-- | board/freescale/common/sys_eeprom.c | 20 | ||||
-rw-r--r-- | board/freescale/common/vid.c | 24 | ||||
-rw-r--r-- | board/freescale/common/vsc3316_3308.c | 10 |
7 files changed, 33 insertions, 33 deletions
diff --git a/board/freescale/common/dcu_sii9022a.c b/board/freescale/common/dcu_sii9022a.c index 832ae258f14..9137d246ea0 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 02a271895bd..05e6a3acf11 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 12ad4b3e08a..9a75c5a09dd 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 1696c24e27b..2bb838cea6c 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 33ae4c15ba7..be0fda06381 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 2617f61520b..20f5421da0b 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 8aceb8ef178..c51f3c5aca2 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; |