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 /drivers/i2c/mvtwsi.c | |
parent | a907dce88e462251d96be9cdd72900543e4798df (diff) | |
download | u-boot-2147a16983d17bcb0438607aa7760494afc27014.zip u-boot-2147a16983d17bcb0438607aa7760494afc27014.tar.gz u-boot-2147a16983d17bcb0438607aa7760494afc27014.tar.bz2 |
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/mvtwsi.c')
-rw-r--r-- | drivers/i2c/mvtwsi.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c index 5df69f1..d33e2c7 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) { |