From de6957256980d9aa1bf11585e6e5b4740d3ccb97 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Tue, 17 Aug 2021 17:59:46 -0400 Subject: [PATCH] Convert CONFIG_SYS_I2C_SOFT et al to Kconfig This converts the following to Kconfig: CONFIG_SYS_I2C_SOFT CONFIG_SYS_I2C_SOFT_SPEED CONFIG_SYS_I2C_SOFT_SLAVE Signed-off-by: Tom Rini --- board/sunxi/board.c | 2 +- configs/Colombus_defconfig | 3 +++ configs/UTOO_P66_defconfig | 3 +++ configs/ethernut5_defconfig | 2 ++ configs/km_kirkwood_128m16_defconfig | 2 ++ configs/km_kirkwood_defconfig | 2 ++ configs/km_kirkwood_pci_defconfig | 2 ++ configs/kmcoge5un_defconfig | 2 ++ configs/kmnusa_defconfig | 2 ++ configs/kmsuse2_defconfig | 2 ++ configs/snapper9260_defconfig | 2 ++ configs/snapper9g20_defconfig | 2 ++ drivers/i2c/Kconfig | 19 +++++++++++++++++++ include/configs/ethernut5.h | 3 --- include/configs/km/km_arm.h | 4 ---- include/configs/snapper9260.h | 3 --- include/configs/sunxi-common.h | 5 +---- 17 files changed, 45 insertions(+), 15 deletions(-) diff --git a/board/sunxi/board.c b/board/sunxi/board.c index 1a46100e40..2b7d655678 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -47,7 +47,7 @@ #include #include -#if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD) +#if defined(CONFIG_VIDEO_LCD_PANEL_I2C) /* So that we can use pin names in Kconfig and sunxi_name_to_gpio() */ int soft_i2c_gpio_sda; int soft_i2c_gpio_scl; diff --git a/configs/Colombus_defconfig b/configs/Colombus_defconfig index a6b3bd438a..0542520a0e 100644 --- a/configs/Colombus_defconfig +++ b/configs/Colombus_defconfig @@ -17,6 +17,9 @@ CONFIG_VIDEO_LCD_PANEL_I2C_SDA="PA23" CONFIG_VIDEO_LCD_PANEL_I2C_SCL="PA24" CONFIG_VIDEO_LCD_PANEL_EDP_4_LANE_1620M_VIA_ANX9804=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +CONFIG_SYS_I2C_SOFT=y +CONFIG_SYS_I2C_SOFT_SPEED=50000 +CONFIG_SYS_I2C_SOFT_SLAVE=0x00 CONFIG_PHY_REALTEK=y CONFIG_ETH_DESIGNWARE=y CONFIG_RGMII=y diff --git a/configs/UTOO_P66_defconfig b/configs/UTOO_P66_defconfig index 78c40c067a..b9553b7937 100644 --- a/configs/UTOO_P66_defconfig +++ b/configs/UTOO_P66_defconfig @@ -21,6 +21,9 @@ CONFIG_VIDEO_LCD_BL_PWM="PB2" CONFIG_VIDEO_LCD_TL059WV5C0=y # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_SPL_I2C=y +CONFIG_SYS_I2C_SOFT=y +CONFIG_SYS_I2C_SOFT_SPEED=50000 +CONFIG_SYS_I2C_SOFT_SLAVE=0x00 # CONFIG_REQUIRE_SERIAL_CONSOLE is not set CONFIG_CONS_INDEX=2 CONFIG_USB_MUSB_HOST=y diff --git a/configs/ethernut5_defconfig b/configs/ethernut5_defconfig index 4da3c1d4f4..7b58b714eb 100644 --- a/configs/ethernut5_defconfig +++ b/configs/ethernut5_defconfig @@ -55,6 +55,8 @@ CONFIG_DM=y CONFIG_CLK=y CONFIG_CLK_AT91=y CONFIG_AT91_GPIO=y +CONFIG_SYS_I2C_SOFT=y +CONFIG_SYS_I2C_SOFT_SLAVE=0 CONFIG_MTD=y CONFIG_MTD_NOR_FLASH=y CONFIG_MTD_RAW_NAND=y diff --git a/configs/km_kirkwood_128m16_defconfig b/configs/km_kirkwood_128m16_defconfig index 0597970746..b93fcbf805 100644 --- a/configs/km_kirkwood_128m16_defconfig +++ b/configs/km_kirkwood_128m16_defconfig @@ -46,6 +46,8 @@ CONFIG_VERSION_VARIABLE=y CONFIG_NETCONSOLE=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_BOOTCOUNT_RAM=y +CONFIG_SYS_I2C_SOFT=y +CONFIG_SYS_I2C_SOFT_SLAVE=0x0 CONFIG_SYS_I2C_EEPROM_ADDR=0x50 # CONFIG_MMC is not set CONFIG_MTD=y diff --git a/configs/km_kirkwood_defconfig b/configs/km_kirkwood_defconfig index 7f982de136..0fe7a9d7a4 100644 --- a/configs/km_kirkwood_defconfig +++ b/configs/km_kirkwood_defconfig @@ -46,6 +46,8 @@ CONFIG_VERSION_VARIABLE=y CONFIG_NETCONSOLE=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_BOOTCOUNT_RAM=y +CONFIG_SYS_I2C_SOFT=y +CONFIG_SYS_I2C_SOFT_SLAVE=0x0 CONFIG_SYS_I2C_EEPROM_ADDR=0x50 # CONFIG_MMC is not set CONFIG_MTD=y diff --git a/configs/km_kirkwood_pci_defconfig b/configs/km_kirkwood_pci_defconfig index fb1b93db51..5a49acba12 100644 --- a/configs/km_kirkwood_pci_defconfig +++ b/configs/km_kirkwood_pci_defconfig @@ -47,6 +47,8 @@ CONFIG_VERSION_VARIABLE=y CONFIG_NETCONSOLE=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_BOOTCOUNT_RAM=y +CONFIG_SYS_I2C_SOFT=y +CONFIG_SYS_I2C_SOFT_SLAVE=0x0 CONFIG_SYS_I2C_EEPROM_ADDR=0x50 # CONFIG_MMC is not set CONFIG_MTD=y diff --git a/configs/kmcoge5un_defconfig b/configs/kmcoge5un_defconfig index ed9996c4c0..989dc6e45a 100644 --- a/configs/kmcoge5un_defconfig +++ b/configs/kmcoge5un_defconfig @@ -50,6 +50,8 @@ CONFIG_VERSION_VARIABLE=y CONFIG_NETCONSOLE=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_BOOTCOUNT_RAM=y +CONFIG_SYS_I2C_SOFT=y +CONFIG_SYS_I2C_SOFT_SLAVE=0x0 CONFIG_SYS_I2C_EEPROM_ADDR=0x50 # CONFIG_MMC is not set CONFIG_MTD=y diff --git a/configs/kmnusa_defconfig b/configs/kmnusa_defconfig index 9a1c4a48e6..68d9b54113 100644 --- a/configs/kmnusa_defconfig +++ b/configs/kmnusa_defconfig @@ -50,6 +50,8 @@ CONFIG_VERSION_VARIABLE=y CONFIG_NETCONSOLE=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_BOOTCOUNT_RAM=y +CONFIG_SYS_I2C_SOFT=y +CONFIG_SYS_I2C_SOFT_SLAVE=0x0 CONFIG_SYS_I2C_EEPROM_ADDR=0x50 # CONFIG_MMC is not set CONFIG_MTD=y diff --git a/configs/kmsuse2_defconfig b/configs/kmsuse2_defconfig index 66e4f2d069..c8b84b1b17 100644 --- a/configs/kmsuse2_defconfig +++ b/configs/kmsuse2_defconfig @@ -51,6 +51,8 @@ CONFIG_VERSION_VARIABLE=y CONFIG_NETCONSOLE=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_BOOTCOUNT_RAM=y +CONFIG_SYS_I2C_SOFT=y +CONFIG_SYS_I2C_SOFT_SLAVE=0x0 CONFIG_SYS_I2C_EEPROM_ADDR=0x50 # CONFIG_MMC is not set CONFIG_MTD=y diff --git a/configs/snapper9260_defconfig b/configs/snapper9260_defconfig index f9cc1a6c7e..0acb95f85c 100644 --- a/configs/snapper9260_defconfig +++ b/configs/snapper9260_defconfig @@ -33,6 +33,8 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_TFTP_TSIZE=y CONFIG_AT91_GPIO=y CONFIG_CMD_PCA953X=y +CONFIG_SYS_I2C_SOFT=y +CONFIG_SYS_I2C_SOFT_SLAVE=0x7F # CONFIG_MMC is not set CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y diff --git a/configs/snapper9g20_defconfig b/configs/snapper9g20_defconfig index e3a325a271..5d83c263b6 100644 --- a/configs/snapper9g20_defconfig +++ b/configs/snapper9g20_defconfig @@ -32,6 +32,8 @@ CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_TFTP_TSIZE=y CONFIG_AT91_GPIO=y CONFIG_CMD_PCA953X=y +CONFIG_SYS_I2C_SOFT=y +CONFIG_SYS_I2C_SOFT_SLAVE=0x7F # CONFIG_MMC is not set CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig index a50c1f3833..4da074de72 100644 --- a/drivers/i2c/Kconfig +++ b/drivers/i2c/Kconfig @@ -437,6 +437,25 @@ config SYS_I2C_SANDBOX bus. Devices can be attached to the bus using the device tree which specifies the driver to use. See sandbox.dts as an example. +config SYS_I2C_SOFT + bool "Legacy software I2C interface" + help + Enable the legacy software defined I2C interface + +config SYS_I2C_SOFT_SPEED + int "Software I2C bus speed" + depends on SYS_I2C_SOFT + default 100000 + help + Speed of the software I2C bus + +config SYS_I2C_SOFT_SLAVE + hex "Software I2C slave address" + depends on SYS_I2C_SOFT + default 0xfe + help + Slave address of the software I2C bus + config SYS_I2C_OCTEON bool "Octeon II/III/TX/TX2 I2C driver" depends on (ARCH_OCTEON || ARCH_OCTEONTX || ARCH_OCTEONTX2) && DM_I2C diff --git a/include/configs/ethernut5.h b/include/configs/ethernut5.h index 3f266543b9..8b60ad52df 100644 --- a/include/configs/ethernut5.h +++ b/include/configs/ethernut5.h @@ -98,9 +98,6 @@ #define CONFIG_SYS_MAX_I2C_BUS 1 #define CONFIG_SYS_I2C_LEGACY -#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ -#define CONFIG_SYS_I2C_SOFT_SPEED 100000 -#define CONFIG_SYS_I2C_SOFT_SLAVE 0 #define I2C_SOFT_DECLARATIONS diff --git a/include/configs/km/km_arm.h b/include/configs/km/km_arm.h index 6633bf8256..a52df29df1 100644 --- a/include/configs/km/km_arm.h +++ b/include/configs/km/km_arm.h @@ -91,7 +91,6 @@ */ #undef CONFIG_I2C_MVTWSI #define CONFIG_SYS_I2C_LEGACY -#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ #define CONFIG_SYS_I2C_INIT_BOARD #define CONFIG_KIRKWOOD_GPIO /* Enable GPIO Support */ @@ -125,9 +124,6 @@ extern void __set_direction(unsigned pin, int high); #define I2C_DELAY udelay(1) #define I2C_SOFT_DECLARATIONS -#define CONFIG_SYS_I2C_SOFT_SLAVE 0x0 -#define CONFIG_SYS_I2C_SOFT_SPEED 100000 - /* EEprom support 24C128, 24C256 valid for environment eeprom */ #define CONFIG_SYS_EEPROM_PAGE_WRITE_ENABLE diff --git a/include/configs/snapper9260.h b/include/configs/snapper9260.h index 529976efee..2c89a6b530 100644 --- a/include/configs/snapper9260.h +++ b/include/configs/snapper9260.h @@ -74,9 +74,6 @@ /* I2C - Bit-bashed */ #define CONFIG_SYS_I2C_LEGACY -#define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ -#define CONFIG_SYS_I2C_SOFT_SPEED 100000 -#define CONFIG_SYS_I2C_SOFT_SLAVE 0x7F #define CONFIG_SOFT_I2C_READ_REPEATED_START #define I2C_INIT do { \ at91_set_gpio_output(AT91_PIN_PA23, 1); \ diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index 958b850da4..4f7049a4de 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -205,10 +205,7 @@ #endif #endif -#if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD) -#define CONFIG_SYS_I2C_SOFT -#define CONFIG_SYS_I2C_SOFT_SPEED 50000 -#define CONFIG_SYS_I2C_SOFT_SLAVE 0x00 +#if defined(CONFIG_VIDEO_LCD_PANEL_I2C) /* We use pin names in Kconfig and sunxi_name_to_gpio() */ #define CONFIG_SOFT_I2C_GPIO_SDA soft_i2c_gpio_sda #define CONFIG_SOFT_I2C_GPIO_SCL soft_i2c_gpio_scl -- 2.39.5