i2c: designware: Convert driver to multibus/multiadapter framework
Subsystems (2)
PATCH 1/1 i2c: designware: Convert driver to multibus/multiadapter framework
In preparation for the SoCFPGA support of the designware I2C driver, convert this driver to the common CONFIG_SYS_I2C framework.
This patch converts all users of this driver, this is:
- ST spearxxx boards
- AXS101 (ARC700 platform)
I couldn't test this patch on those boards. Only compile tested for all spear boards. And tested on SoCFPGA.
--- arch/arm/cpu/arm926ejs/spear/cpu.c | 2 +- drivers/i2c/Makefile | 2 +- drivers/i2c/designware_i2c.c | 294 ++++++++++++++++--------------------- include/configs/axs101.h | 9 +- include/configs/spear-common.h | 4 +- include/configs/x600.h | 4 +- 6 files changed, 142 insertions(+), 173 deletions(-)
arch/arm/cpu/arm926ejs/spear/cpu.c +1 -1
@@ -38,7 +38,7 @@ int arch_cpu_init(void)#if defined(CONFIG_DW_UDC ) periph1_clken |=MISC_USBDENB ;#endif -#if defined(CONFIG_DW_I2C ) +#if defined(CONFIG_SYS_I2C_DW ) periph1_clken |=MISC_I2CENB ;#endif #if defined(CONFIG_ST_SMI )
drivers/i2c/Makefile +1 -1
@@ -6,7 +6,6 @@ # obj-$(CONFIG_BFIN_TWI_I2C) += bfin-twi_i2c.o -obj-$(CONFIG_DW_I2C) += designware_i2c.o obj-$(CONFIG_I2C_MV) += mv_i2c.o obj-$(CONFIG_I2C_MXS) += mxs_i2c.o obj-$(CONFIG_PCA9564_I2C) += pca9564_i2c.o
@@ -15,6 +14,7 @@ obj-$(CONFIG_U8500_I2C) += u8500_i2c.o obj-$(CONFIG_SH_SH7734_I2C) += sh_sh7734_i2c.o obj-$(CONFIG_SYS_I2C) += i2c_core.o obj-$(CONFIG_SYS_I2C_DAVINCI) += davinci_i2c.o +obj-$(CONFIG_SYS_I2C_DW) += designware_i2c.o obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o obj-$(CONFIG_SYS_I2C_FTI2C010) += fti2c010.o obj-$(CONFIG_SYS_I2C_IHS) += ihs_i2c.o
drivers/i2c/designware_i2c.c +130 -164
513 lines not on this page · raw message
include/configs/axs101.h +6 -3
@@ -83,12 +83,15 @@/* * I2C configuration */ -#define CONFIG_HARD_I2C -#define CONFIG_DW_I2C -#define CONFIG_I2C_MULTI_BUS +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_DW #define CONFIG_I2C_ENV_EEPROM_BUS 2#define CONFIG_SYS_I2C_SPEED 100000 +#define CONFIG_SYS_I2C_SPEED1 100000 +#define CONFIG_SYS_I2C_SPEED2 100000#define CONFIG_SYS_I2C_SLAVE 0 +#define CONFIG_SYS_I2C_SLAVE1 0 +#define CONFIG_SYS_I2C_SLAVE2 0#define CONFIG_SYS_I2C_BASE 0xE001D000#define CONFIG_SYS_I2C_BASE1 0xE001E000#define CONFIG_SYS_I2C_BASE2 0xE001F000
include/configs/spear-common.h +2 -2
@@ -37,8 +37,8 @@#define CONFIG_EXTRA_ENV_USBTTY "usbtty=cdc_acm\0"/* I2C driver configuration */ -#define CONFIG_HARD_I2C -#define CONFIG_DW_I2C +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_DW #if defined(CONFIG_SPEAR600 )#define CONFIG_SYS_I2C_BASE 0xD0200000#elif defined(CONFIG_SPEAR300 )
include/configs/x600.h +2 -2
@@ -83,8 +83,8 @@#define CONFIG_SPEAR_GPIO /* I2C config options */ -#define CONFIG_HARD_I2C -#define CONFIG_DW_I2C +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_DW #define CONFIG_SYS_I2C_BASE 0xD0200000#define CONFIG_SYS_I2C_SPEED 400000#define CONFIG_SYS_I2C_SLAVE 0x02
Signature · 1 line
2.1.2
PATCH 1/1 i2c: designware: Convert driver to multibus/multiadapter framework
Quoted 8 lines · Stefan Roese
In preparation for the SoCFPGA support of the designware I2C driver, convert this driver to the common
CONFIG_SYS_I2Cframework.This patch converts all users of this driver, this is:
- ST spearxxx boards
- AXS101 (ARC700 platform)
Quoted 8 lines
I couldn't test this patch on those boards. Only compile tested for all spear boards. And tested on SoCFPGA.
Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Marek Vasut <[email protected]>Cc Vipin Kumar <[email protected]>Cc Alexey Brodkin <[email protected]>
I don't see any obvious problems:
Best regards,
Marek Vasut
PATCH 1/1 i2c: designware: Convert driver to multibus/multiadapter framework
In reply to Stefan RoeseHi Stefan,
Quoted 25 lines · Stefan Roese
In preparation for the SoCFPGA support of the designware I2C driver, convert this driver to the common
CONFIG_SYS_I2Cframework.This patch converts all users of this driver, this is:
- ST spearxxx boards
- AXS101 (ARC700 platform)I couldn't test this patch on those boards. Only compile tested for all spear boards. And tested on SoCFPGA.
Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Marek Vasut <[email protected]>Cc Vipin Kumar <[email protected]>Cc Alexey Brodkin <[email protected]>--- arch/arm/cpu/arm926ejs/spear/cpu.c | 2 +- drivers/i2c/Makefile | 2 +- drivers/i2c/designware_i2c.c | 294 ++++++++++++++++--------------------- include/configs/axs101.h | 9 +- include/configs/spear-common.h | 4 +- include/configs/x600.h | 4 +- 6 files changed, 142 insertions(+), 173 deletions(-)
drivers/i2c/designware_i2c.c line 33
Quoted 5 lines
drivers/i2c/designware_i2c.c +3
-2-static struct i2c_regs *i2c_regs_p = - (struct i2c_regs *)CONFIG_SYS_I2C_BASE ; +default : +printf ("wrong hwadapnr: %d\n" , adap->hwadapnr); + }
Well, I'd say "wrong hwadapnr" is not very informative. Maybe something more human-friendly?
Anyway this is just a nitpicking.
I tried updated driver on AXS101 and it builds and works for me fine.
So please add:
-Alexey
PATCH 1/1 i2c: designware: Convert driver to multibus/multiadapter framework
Hi Alexey,
Quoted 26 lines · Alexey Brodkin
Quoted 24 lines · Stefan Roese
In preparation for the SoCFPGA support of the designware I2C driver, convert this driver to the common
CONFIG_SYS_I2Cframework.This patch converts all users of this driver, this is:
- ST spearxxx boards
- AXS101 (ARC700 platform)I couldn't test this patch on those boards. Only compile tested for all spear boards. And tested on SoCFPGA.
Signed-off-by Stefan Roese <[email protected]>Cc Heiko Schocher <[email protected]>Cc Marek Vasut <[email protected]>Cc Vipin Kumar <[email protected]>Cc Alexey Brodkin <[email protected]>--- arch/arm/cpu/arm926ejs/spear/cpu.c | 2 +- drivers/i2c/Makefile | 2 +- drivers/i2c/designware_i2c.c | 294 ++++++++++++++++--------------------- include/configs/axs101.h | 9 +- include/configs/spear-common.h | 4 +- include/configs/x600.h | 4 +- 6 files changed, 142 insertions(+), 173 deletions(-)
Quoted 8 lines
drivers/i2c/designware_i2c.c line 33
Quoted 5 lines
drivers/i2c/designware_i2c.c +3
-2-static struct i2c_regs *i2c_regs_p = - (struct i2c_regs *)CONFIG_SYS_I2C_BASE ; +default : +printf ("wrong hwadapnr: %d\n" , adap->hwadapnr); + }Well, I'd say "wrong hwadapnr" is not very informative. Maybe something more human-friendly?
Yes, now that you mention it, this really is ugly. Copy-n-pasted from some other driver. I'll change it in the next version.
Thanks,
Stefan