i2c: port i2c driver to new subsystem
Subsystems (3)
cover i2c: port i2c driver to new subsystem
This serie is composed of two patches:
- one to port the i2c mxc driver to new subsystem
- one to update all configurations with i2c mxc driver
This serie was tested with success on armadeus apf27.
Philippe Reynes (2):
i2c: move to new subsystem
i2c: update config using mxc driver to new subsystem
README | 3 + arch/arm/cpu/armv7/mx5/clock.c | 2 +- arch/arm/cpu/armv7/mx6/clock.c | 2 +- arch/arm/imx-common/Makefile | 2 +- drivers/i2c/Makefile | 2 +- drivers/i2c/mxc_i2c.c | 109 +++++++++++++++++-------------------- include/configs/apf27.h | 5 +- include/configs/flea3.h | 6 +- include/configs/imx31_phycore.h | 6 +- include/configs/m53evk.h | 6 +- include/configs/mx25pdk.h | 6 +- include/configs/mx35pdk.h | 6 +- include/configs/mx53ard.h | 6 +- include/configs/mx53evk.h | 6 +- include/configs/mx53loco.h | 6 +- include/configs/mx53smd.h | 6 +- include/configs/mx6qsabreauto.h | 3 +- include/configs/nitrogen6x.h | 3 +- include/configs/titanium.h | 3 +- include/configs/vf610twr.h | 6 +- include/configs/woodburn_common.h | 6 +- 21 files changed, 98 insertions(+), 102 deletions(-)
Signature · 1 line
1.7.4.4
PATCH 1/2 i2c: move to new subsystem
--- README | 3 + arch/arm/cpu/armv7/mx5/clock.c | 2 +- arch/arm/cpu/armv7/mx6/clock.c | 2 +- arch/arm/imx-common/Makefile | 2 +- drivers/i2c/Makefile | 2 +- drivers/i2c/mxc_i2c.c | 109 ++++++++++++++++++--------------------- 6 files changed, 57 insertions(+), 63 deletions(-)
README +3 -0
@@ -1995,6 +1995,9 @@ CBFS (Coreboot Filesystem) support - CONFIG_SYS_I2C_PPC4XX_CH0 activate hardware channel 0 - CONFIG_SYS_I2C_PPC4XX_CH1 activate hardware channel 1 + - drivers/i2c/i2c_mxc.c + - activate this driver with CONFIG_SYS_I2C_MXC + additional defines: CONFIG_SYS_NUM_I2C_BUSES
arch/arm/cpu/armv7/mx5/clock.c +1 -1
@@ -94,7 +94,7 @@ void enable_usboh3_clk(bool enable) MXC_CCM_CCGR2_USBOH3_60M(cg)); } -#ifdef CONFIG_I2C_MXC +#ifdef CONFIG_SYS_I2C_MXC /* i2c_num can be from 0, to 1 for i.MX51 and 2 for i.MX53 */ int enable_i2c_clk (unsigned char enable,unsigned i2c_num) {
arch/arm/cpu/armv7/mx6/clock.c +1 -1
@@ -48,7 +48,7 @@ void enable_usboh3_clk(unsigned char enable) } -#ifdef CONFIG_I2C_MXC +#ifdef CONFIG_SYS_I2C_MXC /* i2c_num can be from 0 - 2 */ int enable_i2c_clk (unsigned char enable,unsigned i2c_num) {
arch/arm/imx-common/Makefile +1 -1
@@ -16,7 +16,7 @@ COBJS-y = iomux-v3.o endif ifeq ($(SOC),$(filter $(SOC),mx5 mx6)) COBJS-y += timer.o cpu.o speed.o -COBJS-$(CONFIG_I2C_MXC) += i2c-mxv7.o +COBJS-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o endif ifeq ($(SOC),$(filter $(SOC),mx6 mxs)) COBJS-y += misc.o
drivers/i2c/Makefile +1 -1
@@ -14,7 +14,7 @@ COBJS-$(CONFIG_DRIVER_DAVINCI_I2C) += davinci_i2c.o COBJS-$(CONFIG_DW_I2C) += designware_i2c.o COBJS-$(CONFIG_I2C_MVTWSI) += mvtwsi.o COBJS-$(CONFIG_I2C_MV) += mv_i2c.o -COBJS-$(CONFIG_I2C_MXC) += mxc_i2c.o +COBJS-$(CONFIG_SYS_I2C_MXC) += mxc_i2c.o COBJS-$(CONFIG_I2C_MXS) += mxs_i2c.o COBJS-$(CONFIG_DRIVER_OMAP1510_I2C) += omap1510_i2c.o COBJS-$(CONFIG_DRIVER_OMAP24XX_I2C) += omap24xx_i2c.o
drivers/i2c/mxc_i2c.c +50 -59
153 lines not on this page · raw message
Signature · 1 line
1.7.4.4
PATCH 1/2 i2c: move to new subsystem
Hi Philippe,
Quoted 228 lines · Philippe Reynes
Signed-off-by Philippe Reynes <[email protected]>--- README | 3 + arch/arm/cpu/armv7/mx5/clock.c | 2 +- arch/arm/cpu/armv7/mx6/clock.c | 2 +- arch/arm/imx-common/Makefile | 2 +- drivers/i2c/Makefile | 2 +- drivers/i2c/mxc_i2c.c | 109 ++++++++++++++++++--------------------- 6 files changed, 57 insertions(+), 63 deletions(-)README +3
-0@@ -1995,6 +1995,9 @@ CBFS (Coreboot Filesystem) support - CONFIG_SYS_I2C_PPC4XX_CH0 activate hardware channel 0 - CONFIG_SYS_I2C_PPC4XX_CH1 activate hardware channel 1 + - drivers/i2c/i2c_mxc.c + - activate this driver with CONFIG_SYS_I2C_MXC + additional defines: CONFIG_SYS_NUM_I2C_BUSESarch/arm/cpu/armv7/mx5/clock.c +1
-1@@ -94,7 +94,7 @@ void enable_usboh3_clk(bool enable) MXC_CCM_CCGR2_USBOH3_60M(cg)); } -#ifdef CONFIG_I2C_MXC +#ifdef CONFIG_SYS_I2C_MXC /* i2c_num can be from 0, to 1 for i.MX51 and 2 for i.MX53 */ int enable_i2c_clk (unsigned char enable,unsigned i2c_num) {arch/arm/cpu/armv7/mx6/clock.c +1
-1@@ -48,7 +48,7 @@ void enable_usboh3_clk(unsigned char enable) } -#ifdef CONFIG_I2C_MXC +#ifdef CONFIG_SYS_I2C_MXC /* i2c_num can be from 0 - 2 */ int enable_i2c_clk (unsigned char enable,unsigned i2c_num) {arch/arm/imx-common/Makefile +1
-1@@ -16,7 +16,7 @@ COBJS-y = iomux-v3.o endif ifeq ($(SOC),$(filter $(SOC),mx5 mx6)) COBJS-y += timer.o cpu.o speed.o -COBJS-$(CONFIG_I2C_MXC) += i2c-mxv7.o +COBJS-$(CONFIG_SYS_I2C_MXC) += i2c-mxv7.o endif ifeq ($(SOC),$(filter $(SOC),mx6 mxs)) COBJS-y += misc.odrivers/i2c/Makefile +1
-1@@ -14,7 +14,7 @@ COBJS-$(CONFIG_DRIVER_DAVINCI_I2C) += davinci_i2c.o COBJS-$(CONFIG_DW_I2C) += designware_i2c.o COBJS-$(CONFIG_I2C_MVTWSI) += mvtwsi.o COBJS-$(CONFIG_I2C_MV) += mv_i2c.o -COBJS-$(CONFIG_I2C_MXC) += mxc_i2c.o +COBJS-$(CONFIG_SYS_I2C_MXC) += mxc_i2c.o COBJS-$(CONFIG_I2C_MXS) += mxs_i2c.o COBJS-$(CONFIG_DRIVER_OMAP1510_I2C) += omap1510_i2c.o COBJS-$(CONFIG_DRIVER_OMAP24XX_I2C) += omap24xx_i2c.odrivers/i2c/mxc_i2c.c +40
-59@@ -153,21 +153,6 @@ static int bus_i2c_set_bus_speed(void *base, int speed)return 0 ; } -/* -* Get I2C Speed -*/ -static unsigned int bus_i2c_get_bus_speed (void *base) -{ -struct mxc_i2c_regs *i2c_regs = (struct mxc_i2c_regs *)base; -u8 clk_idx =readb (&i2c_regs->ifdr); -u8 clk_div; - -for (clk_div =0 ; i2c_clk_div[clk_div][1 ] != clk_idx; clk_div++) - ; - -return mxc_get_clock (MXC_I2C_CLK ) / i2c_clk_div[clk_div][0 ]; -} -#define ST_BUS_IDLE (0 | (I2SR_IBB << 8))#define ST_BUS_BUSY (I2SR_IBB | (I2SR_IBB << 8))#define ST_IIF (I2SR_IIF | (I2SR_IIF << 8))@@ -410,20 +395,30 @@ struct sram_data {*/ static struct sram_data __attribute__((section (".data" ))) srdata; -void *get_base (void ) -{ -#ifdef CONFIG_SYS_I2C_BASE -#ifdef CONFIG_I2C_MULTI_BUS -void *ret = srdata.i2c_data[srdata.curr_i2c_bus].base; -if (ret) -return ret; -#endif -return (void *)CONFIG_SYS_I2C_BASE ; -#elif defined(CONFIG_I2C_MULTI_BUS ) -return srdata.i2c_data[srdata.curr_i2c_bus].base; +static void * const i2c_bases[] = { +#if defined(CONFIG_MX25 ) + (void *)IMX_I2C_BASE , + (void *)IMX_I2C2_BASE , + (void *)IMX_I2C3_BASE +#elif defined(CONFIG_MX27 ) + (void *)IMX_I2C1_BASE , + (void *)IMX_I2C2_BASE +#elif defined(CONFIG_MX31 ) || defined(CONFIG_MX35 ) || \ + defined(CONFIG_MX51 ) || defined(CONFIG_MX53 ) || \ + defined(CONFIG_MX6 ) + (void *)I2C1_BASE_ADDR , + (void *)I2C2_BASE_ADDR , + (void *)I2C3_BASE_ADDR +#elif defined(CONFIG_VF610 ) + (void *)I2C0_BASE_ADDR#else -return srdata.i2c_data[0 ].base; +#error "architecture not supported"#endif +}; + +void *i2c_get_base (struct i2c_adapter *adap) +{ +return i2c_bases[adap->hwadapnr]; }static struct i2c_parms *i2c_get_parms (void *base)@@ -448,39 +443,26 @@ static int i2c_idle_bus(void *base)return 0 ; } -#ifdef CONFIG_I2C_MULTI_BUS -unsigned int i2c_get_bus_num (void ) +int mxc_i2c_read (struct i2c_adapter *adap,uint8_t chip, +uint addr,int alen,uint8_t *buffer, +int len) { -return srdata.curr_i2c_bus; +return bus_i2c_read (i2c_get_base (adap), chip, addr, alen, buffer, len); } -int i2c_set_bus_num (unsigned bus_idx) -{ -if (bus_idx >=ARRAY_SIZE (srdata.i2c_data)) -return -1 ; -if (!srdata.i2c_data[bus_idx].base) -return -1 ; - srdata.curr_i2c_bus = bus_idx; -return 0 ; -} -#endif - -int i2c_read (uchar chip,uint addr,int alen,uchar *buf,int len) +int mxc_i2c_write (struct i2c_adapter *adap,uint8_t chip, +uint addr,int alen,uint8_t *buffer, +int len) { -return bus_i2c_read (get_base (), chip, addr, alen, buf, len); -} - -int i2c_write (uchar chip,uint addr,int alen,uchar *buf,int len) -{ -return bus_i2c_write (get_base (), chip, addr, alen, buf, len); +return bus_i2c_write (i2c_get_base (adap), chip, addr, alen, buffer, len); }/* * Test if a chip at a given address responds (probe the chip) */ -int i2c_probe (uchar chip) +int mxc_i2c_probe (struct i2c_adapter *adap,uint8_t chip) { -return bus_i2c_write (get_base (), chip,0 ,0 ,NULL ,0 ); +return bus_i2c_write (i2c_get_base (adap), chip,0 ,0 ,NULL ,0 ); } void bus_i2c_init(void *base, int speed, int unused,@@ -510,23 +492,32 @@ void bus_i2c_init(void *base, int speed, int unused,/* * Init I2C Bus */ -void i2c_init (int speed,int unused) +void mxc_i2c_init (struct i2c_adapter *adap,int speed,int slaveaddr) { -bus_i2c_init (get_base (), speed, unused,NULL ,NULL ); +bus_i2c_init (i2c_get_base (adap), speed, slaveaddr,NULL ,NULL ); }/* * Set I2C Speed */ -int i2c_set_bus_speed (unsigned int speed) +uint mxc_i2c_set_bus_speed (struct i2c_adapter *adap,uint speed) { -return bus_i2c_set_bus_speed (get_base (), speed); +return bus_i2c_set_bus_speed (i2c_get_base (adap), speed); }/* -* Get I2C Speed +* Register mxc i2c adapters */ -unsigned int i2c_get_bus_speed (void ) -{ -return bus_i2c_get_bus_speed (get_base ()); -} +U_BOOT_I2C_ADAP_COMPLETE (mxc0, mxc_i2c_init, mxc_i2c_probe, + mxc_i2c_read, mxc_i2c_write, + mxc_i2c_set_bus_speed,100000 ,0 ,0 )
drivers/i2c/mxc_i2c.c void bus_i2c_init(void *base, int speed, int unused, · line 523
Quoted 10 lines
drivers/i2c/mxc_i2c.c +10
-0+U_BOOT_I2C_ADAP_COMPLETE (mxc1, mxc_i2c_init, mxc_i2c_probe, + mxc_i2c_read, mxc_i2c_write, + mxc_i2c_set_bus_speed, 100000, 0, 1) +#if defined(CONFIG_MX31 ) || defined(CONFIG_MX35 ) ||\ + defined(CONFIG_MX51 ) || defined(CONFIG_MX53 ) ||\ + defined(CONFIG_MX6 ) +U_BOOT_I2C_ADAP_COMPLETE (mxc2, mxc_i2c_init, mxc_i2c_probe, + mxc_i2c_read, mxc_i2c_write, + mxc_i2c_set_bus_speed, 100000, 0, 2) +#endif
Patch subject seems to imply that the whole of I2C moves to some new subsystem. If I understand, only mxc moves. I guess "mxc" should appear somewhere in the patch subject.
Amicalement,
Signature · 1 line
Albert.
PATCH 1/2 i2c: move to new subsystem
In reply to Philippe ReynesHello Philippe,
added stefano babic, as he is the imx custodian, to cc
Am 15.09.2013 21:09, schrieb Philippe Reynes:
Quoted 9 lines
Signed-off-by Philippe Reynes<[email protected]>--- README | 3 + arch/arm/cpu/armv7/mx5/clock.c | 2 +- arch/arm/cpu/armv7/mx6/clock.c | 2 +- arch/arm/imx-common/Makefile | 2 +- drivers/i2c/Makefile | 2 +- drivers/i2c/mxc_i2c.c | 109 ++++++++++++++++++--------------------- 6 files changed, 57 insertions(+), 63 deletions(-)
First, thanks for this work!
Could you please change your subject in something like
"i2c, mxc: switch to new multibus/multiadapter framework" ?
README CBFS (Coreboot Filesystem) support · line 2000
Quoted 11 lines
README +3
-0@@ -1995,6 +1995,9 @@ CBFS (Coreboot Filesystem) support - CONFIG_SYS_I2C_PPC4XX_CH0 activate hardware channel 0 - CONFIG_SYS_I2C_PPC4XX_CH1 activate hardware channel 1 + - drivers/i2c/i2c_mxc.c + - activate this driver with CONFIG_SYS_I2C_MXC +
You should use some new defines for the speed setting ... did you? If not please add them, thanks.
Quoted 3 lines
README +0
-0additional defines: CONFIG_SYS_NUM_I2C_BUSES
[...]
drivers/i2c/Makefile COBJS-$(CONFIG_DRIVER_DAVINCI_I2C) += davinci_i2c.o · line 17
Quoted 10 lines
drivers/i2c/Makefile +1
-1@@ -14,7 +14,7 @@ COBJS-$(CONFIG_DRIVER_DAVINCI_I2C) += davinci_i2c.o COBJS-$(CONFIG_DW_I2C) += designware_i2c.o COBJS-$(CONFIG_I2C_MVTWSI) += mvtwsi.o COBJS-$(CONFIG_I2C_MV) += mv_i2c.o -COBJS-$(CONFIG_I2C_MXC) += mxc_i2c.o +COBJS-$(CONFIG_SYS_I2C_MXC) += mxc_i2c.o
Please keep this list sorted.
Quoted 73 lines
drivers/i2c/Makefile +0
-0COBJS-$(CONFIG_I2C_MXS) += mxs_i2c.o COBJS-$(CONFIG_DRIVER_OMAP1510_I2C) += omap1510_i2c.o COBJS-$(CONFIG_DRIVER_OMAP24XX_I2C) += omap24xx_i2c.odrivers/i2c/mxc_i2c.c +22
-27@@ -153,21 +153,6 @@ static int bus_i2c_set_bus_speed(void *base, int speed)return 0 ; } -/* -* Get I2C Speed -*/ -static unsigned int bus_i2c_get_bus_speed (void *base) -{ -struct mxc_i2c_regs *i2c_regs = (struct mxc_i2c_regs *)base; -u8 clk_idx =readb (&i2c_regs->ifdr); -u8 clk_div; - -for (clk_div =0 ; i2c_clk_div[clk_div][1 ] != clk_idx; clk_div++) - ; - -return mxc_get_clock (MXC_I2C_CLK ) / i2c_clk_div[clk_div][0 ]; -} -#define ST_BUS_IDLE (0 | (I2SR_IBB<< 8))#define ST_BUS_BUSY (I2SR_IBB | (I2SR_IBB<< 8))#define ST_IIF (I2SR_IIF | (I2SR_IIF<< 8))@@ -410,20 +395,30 @@ struct sram_data {*/ static struct sram_data __attribute__((section (".data" ))) srdata; -void *get_base (void ) -{ -#ifdef CONFIG_SYS_I2C_BASE -#ifdef CONFIG_I2C_MULTI_BUS -void *ret = srdata.i2c_data[srdata.curr_i2c_bus].base; -if (ret) -return ret; -#endif -return (void *)CONFIG_SYS_I2C_BASE ; -#elif defined(CONFIG_I2C_MULTI_BUS ) -return srdata.i2c_data[srdata.curr_i2c_bus].base; +static void * const i2c_bases[] = { +#if defined(CONFIG_MX25 ) + (void *)IMX_I2C_BASE , + (void *)IMX_I2C2_BASE , + (void *)IMX_I2C3_BASE +#elif defined(CONFIG_MX27 ) + (void *)IMX_I2C1_BASE , + (void *)IMX_I2C2_BASE +#elif defined(CONFIG_MX31 ) || defined(CONFIG_MX35 ) || \ + defined(CONFIG_MX51 ) || defined(CONFIG_MX53 ) || \ + defined(CONFIG_MX6 ) + (void *)I2C1_BASE_ADDR , + (void *)I2C2_BASE_ADDR , + (void *)I2C3_BASE_ADDR +#elif defined(CONFIG_VF610 ) + (void *)I2C0_BASE_ADDR#else -return srdata.i2c_data[0 ].base; +#error "architecture not supported"#endif +}; + +void *i2c_get_base (struct i2c_adapter *adap) +{ +return i2c_bases[adap->hwadapnr]; }static struct i2c_parms *i2c_get_parms (void *base)
drivers/i2c/mxc_i2c.c static int i2c_idle_bus(void *base) · line 446
Quoted 6 lines
drivers/i2c/mxc_i2c.c +1
-2@@ -448,39 +443,26 @@ static int i2c_idle_bus(void *base)return 0 ; } -#ifdef CONFIG_I2C_MULTI_BUS -unsigned int i2c_get_bus_num (void ) +int mxc_i2c_read(struct i2c_adapter *adap, uint8_t chip,
static now
Quoted 10 lines
drivers/i2c/mxc_i2c.c +3
-4+ uint addr, int alen, uint8_t *buffer, + int len) { -return srdata.curr_i2c_bus; + return bus_i2c_read(i2c_get_base(adap), chip, addr, alen, buffer, len); } -int i2c_set_bus_num (unsigned bus_idx) -{ -if (bus_idx>=ARRAY_SIZE (srdata.i2c_data))
drivers/i2c/mxc_i2c.c static int i2c_idle_bus(void *base) · line 453
Quoted 10 lines
drivers/i2c/mxc_i2c.c +1
-9-return -1 ; -if (!srdata.i2c_data[bus_idx].base) -return -1 ; - srdata.curr_i2c_bus = bus_idx; - return 0; -} -#endif - -int i2c_read (uchar chip,uint addr,int alen,uchar *buf,int len) +int mxc_i2c_write(struct i2c_adapter *adap, uint8_t chip,
static now
Quoted 7 lines
drivers/i2c/mxc_i2c.c +2
-4+ uint addr, int alen, uint8_t *buffer, + int len) { -return bus_i2c_read (get_base (), chip, addr, alen, buf, len); -} - -int i2c_write (uchar chip,uint addr,int alen,uchar *buf,int len)
drivers/i2c/mxc_i2c.c static int i2c_idle_bus(void *base) · line 463
Quoted 10 lines
drivers/i2c/mxc_i2c.c +2
-3-{ -return bus_i2c_write (get_base (), chip, addr, alen, buf, len); +return bus_i2c_write (i2c_get_base (adap), chip, addr, alen, buffer, len); }/* * Test if a chip at a given address responds (probe the chip) */ -int i2c_probe (uchar chip) +int mxc_i2c_probe (struct i2c_adapter *adap,uint8_t chip)
static now
drivers/i2c/mxc_i2c.c void bus_i2c_init(void *base, int speed, int unused, · line 495
Quoted 12 lines
drivers/i2c/mxc_i2c.c +2
-2{ -return bus_i2c_write (get_base (), chip,0 ,0 ,NULL ,0 ); +return bus_i2c_write (i2c_get_base (adap), chip,0 ,0 ,NULL ,0 ); } void bus_i2c_init(void *base, int speed, int unused,@@ -510,23 +492,32 @@ void bus_i2c_init(void *base, int speed, int unused,/* * Init I2C Bus */ -void i2c_init (int speed,int unused) +void mxc_i2c_init (struct i2c_adapter *adap,int speed,int slaveaddr)
static now
drivers/i2c/mxc_i2c.c void bus_i2c_init(void *base, int speed, int unused, · line 503
Quoted 10 lines
drivers/i2c/mxc_i2c.c +2
-2{ -bus_i2c_init (get_base (), speed, unused,NULL ,NULL ); +bus_i2c_init (i2c_get_base (adap), speed, slaveaddr,NULL ,NULL ); }/* * Set I2C Speed */ -int i2c_set_bus_speed (unsigned int speed) +uint mxc_i2c_set_bus_speed (struct i2c_adapter *adap,uint speed)
static now
Quoted 6 lines
drivers/i2c/mxc_i2c.c +1
-1{ -return bus_i2c_set_bus_speed (get_base (), speed); +return bus_i2c_set_bus_speed (i2c_get_base (adap), speed); }/*
drivers/i2c/mxc_i2c.c void bus_i2c_init(void *base, int speed, int unused, · line 513
Quoted 10 lines
drivers/i2c/mxc_i2c.c +4
-5-* Get I2C Speed +* Register mxc i2c adapters */ -unsigned int i2c_get_bus_speed (void ) -{ -return bus_i2c_get_bus_speed (get_base ()); -} +U_BOOT_I2C_ADAP_COMPLETE (mxc0, mxc_i2c_init, mxc_i2c_probe, + mxc_i2c_read, mxc_i2c_write, + mxc_i2c_set_bus_speed,100000 ,0 ,0 )
^
shouldn;t we do this here configurable? Or is the speed and slave setting for all imx boards the same?
drivers/i2c/mxc_i2c.c void bus_i2c_init(void *base, int speed, int unused, · line 523
Quoted 10 lines
drivers/i2c/mxc_i2c.c +10
-0+U_BOOT_I2C_ADAP_COMPLETE (mxc1, mxc_i2c_init, mxc_i2c_probe, + mxc_i2c_read, mxc_i2c_write, + mxc_i2c_set_bus_speed, 100000, 0, 1) +#if defined(CONFIG_MX31 ) || defined(CONFIG_MX35 ) ||\ + defined(CONFIG_MX51 ) || defined(CONFIG_MX53 ) ||\ + defined(CONFIG_MX6 ) +U_BOOT_I2C_ADAP_COMPLETE (mxc2, mxc_i2c_init, mxc_i2c_probe, + mxc_i2c_read, mxc_i2c_write, + mxc_i2c_set_bus_speed, 100000, 0, 2) +#endif
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 2/2 i2c: update config using mxc driver to new subsystem
In reply to Philippe Reynes--- include/configs/apf27.h | 5 ++--- include/configs/flea3.h | 6 +++--- include/configs/imx31_phycore.h | 6 +++--- include/configs/m53evk.h | 6 +++--- include/configs/mx25pdk.h | 6 +++--- include/configs/mx35pdk.h | 6 +++--- include/configs/mx53ard.h | 6 +++--- include/configs/mx53evk.h | 6 +++--- include/configs/mx53loco.h | 6 +++--- include/configs/mx53smd.h | 6 +++--- include/configs/mx6qsabreauto.h | 3 ++- include/configs/nitrogen6x.h | 3 ++- include/configs/titanium.h | 3 ++- include/configs/vf610twr.h | 6 +++--- include/configs/woodburn_common.h | 6 +++--- 15 files changed, 41 insertions(+), 39 deletions(-)
include/configs/apf27.h +2 -3
@@ -321,9 +321,8 @@*/ #ifdef CONFIG_CMD_I2C -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE IMX_I2C1_BASE +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC #define CONFIG_SYS_I2C_SPEED 100000/* 100 kHz */ #define CONFIG_SYS_I2C_SLAVE 0x7F#define CONFIG_SYS_I2C_NOPROBES { }
include/configs/flea3.h +3 -3
@@ -50,9 +50,9 @@/* * Hardware drivers */ -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE I2C3_BASE_ADDR +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_SPD_BUS_NUM 2#define CONFIG_SYS_I2C_SPEED 100000#define CONFIG_SYS_I2C_SLAVE 0xfe#define CONFIG_MXC_SPI
include/configs/imx31_phycore.h +3 -3
@@ -35,9 +35,9 @@* Hardware drivers */ -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE I2C2_BASE_ADDR +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_SPD_BUS_NUM 1#define CONFIG_SYS_I2C_CLK_OFFSET I2C2_CLK_OFFSET#define CONFIG_SYS_I2C_SPEED 100000
include/configs/m53evk.h +3 -3
@@ -161,9 +161,9 @@* I2C */ #ifdef CONFIG_CMD_I2C -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE I2C2_BASE_ADDR +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_SPD_BUS_NUM 1#define CONFIG_SYS_I2C_SPEED 100000#endif
include/configs/mx25pdk.h +3 -3
@@ -111,9 +111,9 @@/* I2C Configs */ #define CONFIG_CMD_I2C -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE IMX_I2C_BASE +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_SPD_BUS_NUM 0#define CONFIG_SYS_I2C_SPEED 100000/* RTC */
include/configs/mx35pdk.h +3 -3
@@ -41,9 +41,9 @@/* * Hardware drivers */ -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE I2C1_BASE_ADDR +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_SPD_BUS_NUM 0#define CONFIG_SYS_I2C_SPEED 100000#define CONFIG_MXC_SPI #define CONFIG_MXC_GPIO
include/configs/mx53ard.h +3 -3
@@ -44,9 +44,9 @@/* I2C Configs */ #define CONFIG_CMD_I2C -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE I2C2_BASE_ADDR +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_SPD_BUS_NUM 1#define CONFIG_SYS_I2C_SPEED 100000/* MMC Configs */
include/configs/mx53evk.h +3 -3
@@ -37,9 +37,9 @@/* I2C Configs */ #define CONFIG_CMD_I2C -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE I2C2_BASE_ADDR +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_SPD_BUS_NUM 1#define CONFIG_SYS_I2C_SPEED 100000/* PMIC Configs */
include/configs/mx53loco.h +3 -3
@@ -71,9 +71,9 @@#define CONFIG_MXC_USB_FLAGS 0/* I2C Configs */ -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE I2C1_BASE_ADDR +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_SPD_BUS_NUM 0#define CONFIG_SYS_I2C_SPEED 100000/* PMIC Controller */
include/configs/mx53smd.h +3 -3
@@ -34,9 +34,9 @@/* I2C Configs */ #define CONFIG_CMD_I2C -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE I2C2_BASE_ADDR +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_SPD_BUS_NUM 1#define CONFIG_SYS_I2C_SPEED 100000/* MMC Configs */
include/configs/mx6qsabreauto.h +2 -1
@@ -36,8 +36,9 @@/* I2C Configs */ #define CONFIG_CMD_I2C +#define CONFIG_SYS_I2C #define CONFIG_I2C_MULTI_BUS -#define CONFIG_I2C_MXC +#define CONFIG_SYS_I2C_MXC #define CONFIG_SYS_I2C_SPEED 100000#endif /* __MX6QSABREAUTO_CONFIG_H */
include/configs/nitrogen6x.h +2 -1
@@ -51,9 +51,10 @@#endif /* I2C Configs */ +#define CONFIG_SYS_I2C #define CONFIG_CMD_I2C #define CONFIG_I2C_MULTI_BUS -#define CONFIG_I2C_MXC +#define CONFIG_SYS_I2C_MXC #define CONFIG_SYS_I2C_SPEED 100000/* OCOTP Configs */
include/configs/titanium.h +2 -1
@@ -40,9 +40,10 @@#define CONFIG_MXC_UART_BASE UART1_BASE/* I2C Configs */ +#define CONFIG_SYS_I2C #define CONFIG_CMD_I2C #define CONFIG_I2C_MULTI_BUS -#define CONFIG_I2C_MXC +#define CONFIG_SYS_I2C_MXC #define CONFIG_SYS_I2C_SPEED 100000/* MMC Configs */
include/configs/vf610twr.h +3 -3
@@ -70,9 +70,9 @@/* I2C Configs */ #define CONFIG_CMD_I2C -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE I2C0_BASE_ADDR +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_SPD_BUS_NUM 0#define CONFIG_SYS_I2C_SPEED 100000#define CONFIG_BOOTDELAY 3
include/configs/woodburn_common.h +3 -3
@@ -45,9 +45,9 @@/* * Hardware drivers */ -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE I2C1_BASE_ADDR +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_SPD_BUS_NUM 0#define CONFIG_SYS_I2C_SPEED 100000#define CONFIG_MXC_SPI #define CONFIG_MXC_GPIO
Signature · 1 line
1.7.4.4
PATCH 2/2 i2c: update config using mxc driver to new subsystem
Hello Phillipe,
added Stefano Babic to cc
Am 15.09.2013 21:09, schrieb Philippe Reynes:
Quoted 41 lines
Signed-off-by Philippe Reynes<[email protected]>--- include/configs/apf27.h | 5 ++--- include/configs/flea3.h | 6 +++--- include/configs/imx31_phycore.h | 6 +++--- include/configs/m53evk.h | 6 +++--- include/configs/mx25pdk.h | 6 +++--- include/configs/mx35pdk.h | 6 +++--- include/configs/mx53ard.h | 6 +++--- include/configs/mx53evk.h | 6 +++--- include/configs/mx53loco.h | 6 +++--- include/configs/mx53smd.h | 6 +++--- include/configs/mx6qsabreauto.h | 3 ++- include/configs/nitrogen6x.h | 3 ++- include/configs/titanium.h | 3 ++- include/configs/vf610twr.h | 6 +++--- include/configs/woodburn_common.h | 6 +++--- 15 files changed, 41 insertions(+), 39 deletions(-)include/configs/apf27.h +2
-3@@ -321,9 +321,8 @@*/ #ifdef CONFIG_CMD_I2C -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE IMX_I2C1_BASE +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC #define CONFIG_SYS_I2C_SPEED 100000/* 100 kHz */ #define CONFIG_SYS_I2C_SLAVE 0x7F#define CONFIG_SYS_I2C_NOPROBES { }include/configs/flea3.h +0
-0@@ -50,9 +50,9 @@/*
include/configs/flea3.h line 57
Quoted 10 lines
include/configs/flea3.h +3
-3* Hardware drivers */ -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE I2C3_BASE_ADDR +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_SPD_BUS_NUM 2#define CONFIG_SYS_I2C_SPEED 100000#define CONFIG_SYS_I2C_SLAVE 0xfe
Ah, here we have a different slave address as before -> we need this settings configurable. Speed setting is equal for all boards, so we need only the slave addr configurable at the moment.
Quoted 142 lines
include/configs/flea3.h +0
-0#define CONFIG_MXC_SPI include/configs/imx31_phycore.h +3
-3@@ -35,9 +35,9 @@* Hardware drivers */ -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE I2C2_BASE_ADDR +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_SPD_BUS_NUM 1#define CONFIG_SYS_I2C_CLK_OFFSET I2C2_CLK_OFFSET#define CONFIG_SYS_I2C_SPEED 100000include/configs/m53evk.h +3
-3@@ -161,9 +161,9 @@* I2C */ #ifdef CONFIG_CMD_I2C -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE I2C2_BASE_ADDR +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_SPD_BUS_NUM 1#define CONFIG_SYS_I2C_SPEED 100000#endif include/configs/mx25pdk.h +3
-3@@ -111,9 +111,9 @@/* I2C Configs */ #define CONFIG_CMD_I2C -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE IMX_I2C_BASE +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_SPD_BUS_NUM 0#define CONFIG_SYS_I2C_SPEED 100000/* RTC */ include/configs/mx35pdk.h +3
-3@@ -41,9 +41,9 @@/* * Hardware drivers */ -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE I2C1_BASE_ADDR +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_SPD_BUS_NUM 0#define CONFIG_SYS_I2C_SPEED 100000#define CONFIG_MXC_SPI #define CONFIG_MXC_GPIO include/configs/mx53ard.h +3
-3@@ -44,9 +44,9 @@/* I2C Configs */ #define CONFIG_CMD_I2C -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE I2C2_BASE_ADDR +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_SPD_BUS_NUM 1#define CONFIG_SYS_I2C_SPEED 100000/* MMC Configs */ include/configs/mx53evk.h +3
-3@@ -37,9 +37,9 @@/* I2C Configs */ #define CONFIG_CMD_I2C -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE I2C2_BASE_ADDR +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_SPD_BUS_NUM 1#define CONFIG_SYS_I2C_SPEED 100000/* PMIC Configs */ include/configs/mx53loco.h +3
-3@@ -71,9 +71,9 @@#define CONFIG_MXC_USB_FLAGS 0/* I2C Configs */ -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE I2C1_BASE_ADDR +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_SPD_BUS_NUM 0#define CONFIG_SYS_I2C_SPEED 100000/* PMIC Controller */ include/configs/mx53smd.h +3
-3@@ -34,9 +34,9 @@/* I2C Configs */ #define CONFIG_CMD_I2C -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE I2C2_BASE_ADDR +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_SPD_BUS_NUM 1#define CONFIG_SYS_I2C_SPEED 100000/* MMC Configs */ include/configs/mx6qsabreauto.h +0
-0
include/configs/mx6qsabreauto.h line 40
Quoted 5 lines
include/configs/mx6qsabreauto.h +1
-0@@ -36,8 +36,9 @@/* I2C Configs */ #define CONFIG_CMD_I2C +#define CONFIG_SYS_I2C #define CONFIG_I2C_MULTI_BUS
This define is no longer needed. Please delete this line.
Quoted 10 lines
include/configs/mx6qsabreauto.h +1
-1-#define CONFIG_I2C_MXC +#define CONFIG_SYS_I2C_MXC #define CONFIG_SYS_I2C_SPEED 100000#endif /* __MX6QSABREAUTO_CONFIG_H */ include/configs/nitrogen6x.h +0
-0
include/configs/nitrogen6x.h line 56
Quoted 6 lines
include/configs/nitrogen6x.h +1
-0@@ -51,9 +51,10 @@#endif /* I2C Configs */ +#define CONFIG_SYS_I2C #define CONFIG_CMD_I2C #define CONFIG_I2C_MULTI_BUS
This define is no longer needed. Please delete this line, and all other.
Quoted 45 lines
include/configs/nitrogen6x.h +1
-1-#define CONFIG_I2C_MXC +#define CONFIG_SYS_I2C_MXC #define CONFIG_SYS_I2C_SPEED 100000/* OCOTP Configs */ include/configs/titanium.h +2
-1@@ -40,9 +40,10 @@#define CONFIG_MXC_UART_BASE UART1_BASE/* I2C Configs */ +#define CONFIG_SYS_I2C #define CONFIG_CMD_I2C #define CONFIG_I2C_MULTI_BUS -#define CONFIG_I2C_MXC +#define CONFIG_SYS_I2C_MXC #define CONFIG_SYS_I2C_SPEED 100000/* MMC Configs */ include/configs/vf610twr.h +3
-3@@ -70,9 +70,9 @@/* I2C Configs */ #define CONFIG_CMD_I2C -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE I2C0_BASE_ADDR +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_SPD_BUS_NUM 0#define CONFIG_SYS_I2C_SPEED 100000#define CONFIG_BOOTDELAY 3include/configs/woodburn_common.h +0
-0@@ -45,9 +45,9 @@/* * Hardware drivers
include/configs/woodburn_common.h line 53
Quoted 10 lines
include/configs/woodburn_common.h +3
-3*/ -#define CONFIG_HARD_I2C -#define CONFIG_I2C_MXC -#define CONFIG_SYS_I2C_BASE I2C1_BASE_ADDR +#define CONFIG_SYS_I2C +#define CONFIG_SYS_I2C_MXC +#define CONFIG_SYS_SPD_BUS_NUM 0#define CONFIG_SYS_I2C_SPEED 100000#define CONFIG_MXC_SPI #define CONFIG_MXC_GPIO
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
cover i2c: port i2c driver to new subsystem
In reply to Philippe ReynesQuoted 24 lines · Philippe Reynes
This serie is composed of two patches:
- one to port the i2c mxc driver to new subsystem
- one to update all configurations with i2c mxc driverThis serie was tested with success on armadeus apf27.
Philippe Reynes (2):
i2c: move to new subsystem
i2c: update config using mxc driver to new subsystemREADME | 3 + arch/arm/cpu/armv7/mx5/clock.c | 2 +- arch/arm/cpu/armv7/mx6/clock.c | 2 +- arch/arm/imx-common/Makefile | 2 +- drivers/i2c/Makefile | 2 +- drivers/i2c/mxc_i2c.c | 109 +++++++++++++++++-------------------- include/configs/apf27.h | 5 +- include/configs/flea3.h | 6 +- include/configs/imx31_phycore.h | 6 +- include/configs/m53evk.h | 6 +- include/configs/mx25pdk.h | 6 +- include/configs/mx35pdk.h | 6 +- include/configs/mx53ard.h | 6 +- include/configs/mx53evk.h | 6 +-
Quoted 9 lines
include/configs/mx53loco.h | 6 +- include/configs/mx53smd.h | 6 +- include/configs/mx6qsabreauto.h | 3 +- include/configs/nitrogen6x.h | 3 +- include/configs/titanium.h | 3 +- include/configs/vf610twr.h | 6 +- include/configs/woodburn_common.h | 6 +- 21 files changed, 98 insertions(+), 102 deletions(-)
Tested on i.MX6Q (nitrogen6q) and i.MX6S (nitrogen6s) against I2C busses 0-2 and a variety of devices (HDMI, touch controllers).