Skip to contentSkip to conversation

i2c, mxc: switch to new multibus/multiadapter framework

PATCH Superseded Philippe Reynes 2 participants 5 messages Sep 18, 2013 – Sep 19, 2013

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover i2c, mxc: switch to new multibus/multiadapter framework

This serie is composed of three patches:
- one to fix the i2c init on the generic board
- 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.

Difference between v2 and v1:
- change title of the serie
- use define for speed and slave for each i2c bus
- sort i2c driver list
- define mxc function as static
- remove CONFIG_I2C_MULTI_BUS in config using i2c mxc

Philippe Reynes (3):
i2c: fix init on generic board
i2c: move to new subsystem
i2c: update config using mxc driver to new subsystem

 README                            |   11 +++
 arch/arm/cpu/armv7/mx5/clock.c    |    2 +-
 arch/arm/cpu/armv7/mx6/clock.c    |    2 +-
 arch/arm/imx-common/Makefile      |    2 +-
 common/board_f.c                  |    4 +
 drivers/i2c/Makefile              |    2 +-
 drivers/i2c/mxc_i2c.c             |  137 +++++++++++++++++++++----------------
 include/configs/apf27.h           |   11 ++--
 include/configs/flea3.h           |    9 +--
 include/configs/imx31_phycore.h   |    7 +-
 include/configs/m53evk.h          |    7 +-
 include/configs/mx25pdk.h         |    7 +-
 include/configs/mx35pdk.h         |    7 +-
 include/configs/mx53ard.h         |    7 +-
 include/configs/mx53evk.h         |    7 +-
 include/configs/mx53loco.h        |    7 +-
 include/configs/mx53smd.h         |    7 +-
 include/configs/mx6qsabreauto.h   |    4 +-
 include/configs/nitrogen6x.h      |    4 +-
 include/configs/titanium.h        |    4 +-
 include/configs/vf610twr.h        |    7 +-
 include/configs/woodburn_common.h |    7 +-
 22 files changed, 143 insertions(+), 119 deletions(-)
Signature · 1 line
1.7.4.4
#1 lore raw

PATCH v2 1/3 i2c: fix init on generic board

---
 common/board_f.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
common/board_f.c +4 -0
index 0ada1af..f0664bc 100644
@@ -249,7 +249,11 @@ void dram_init_banksize(void)
 static int init_func_i2c(void)
 {
 	puts("I2C:   ");
+#ifdef CONFIG_SYS_I2C
+	i2c_init_all();
+#else
 	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+#endif
 	puts("ready\n");
 	return 0;
 }
Signature · 1 line
1.7.4.4
#2 lore raw

PATCH v2 2/3 i2c: move to new subsystem

In reply to Philippe Reynes
---
 README                         |   11 +++
 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          |  137 +++++++++++++++++++++++-----------------
 6 files changed, 93 insertions(+), 63 deletions(-)
README +11 -0
index 63706be..5d9ecc2 100644
@@ -1995,6 +1995,17 @@ 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
+		  - define speed for bus 1 with CONFIG_SYS_MXC_I2C1_SPEED
+		  - define slave for bus 1 with CONFIG_SYS_MXC_I2C1_SLAVE
+		  - define speed for bus 2 with CONFIG_SYS_MXC_I2C2_SPEED
+		  - define slave for bus 2 with CONFIG_SYS_MXC_I2C2_SLAVE
+		  - define speed for bus 3 with CONFIG_SYS_MXC_I2C3_SPEED
+		  - define slave for bus 3 with CONFIG_SYS_MXC_I2C3_SLAVE
+		If thoses defines are not set, default value is 100000
+		for speed, and 0 for slave.
+
 		additional defines:
 
 		CONFIG_SYS_NUM_I2C_BUSES
arch/arm/cpu/armv7/mx5/clock.c +1 -1
index 6bef254..fb3b128 100644
@@ -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
index 7efb0d2..8130827 100644
@@ -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
index 727a052..6c78dd9 100644
@@ -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
index 37ccbd1..2433182 100644
@@ -14,7 +14,6 @@ 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_I2C_MXS) += mxs_i2c.o
 COBJS-$(CONFIG_DRIVER_OMAP1510_I2C) += omap1510_i2c.o
 COBJS-$(CONFIG_DRIVER_OMAP24XX_I2C) += omap24xx_i2c.o
@@ -29,6 +28,7 @@ COBJS-$(CONFIG_SH_SH7734_I2C) += sh_sh7734_i2c.o
 COBJS-$(CONFIG_SYS_I2C) += i2c_core.o
 COBJS-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o
 COBJS-$(CONFIG_SYS_I2C_FTI2C010) += fti2c010.o
+COBJS-$(CONFIG_SYS_I2C_MXC) += mxc_i2c.o
 COBJS-$(CONFIG_SYS_I2C_PPC4XX) += ppc4xx_i2c.o
 COBJS-$(CONFIG_SYS_I2C_SOFT) += soft_i2c.o
 COBJS-$(CONFIG_SYS_I2C_TEGRA) += tegra_i2c.o
drivers/i2c/mxc_i2c.c +78 -59

187 lines not on this page · raw message

Signature · 1 line
1.7.4.4
#3 lore raw

PATCH v2 2/3 i2c: move to new subsystem

Hi Philippe,

Quoted 10 lines · Philippe Reynes
---
 README                         |   11 +++
 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          |  137 +++++++++++++++++++++++-----------------
 6 files changed, 93 insertions(+), 63 deletions(-)

As this affects MXC, not i2c as a whole, the patch summary should have an "mxc:" tag prepended to the "i2c:" one.

Amicalement,

Signature · 1 line
Albert.
#4 lore raw

PATCH v2 3/3 i2c: update config using mxc driver to new subsystem

In reply to Philippe Reynes
---
 include/configs/apf27.h           |   11 ++++++-----
 include/configs/flea3.h           |    9 ++++-----
 include/configs/imx31_phycore.h   |    7 +++----
 include/configs/m53evk.h          |    7 +++----
 include/configs/mx25pdk.h         |    7 +++----
 include/configs/mx35pdk.h         |    7 +++----
 include/configs/mx53ard.h         |    7 +++----
 include/configs/mx53evk.h         |    7 +++----
 include/configs/mx53loco.h        |    7 +++----
 include/configs/mx53smd.h         |    7 +++----
 include/configs/mx6qsabreauto.h   |    4 ++--
 include/configs/nitrogen6x.h      |    4 ++--
 include/configs/titanium.h        |    4 ++--
 include/configs/vf610twr.h        |    7 +++----
 include/configs/woodburn_common.h |    7 +++----
 15 files changed, 46 insertions(+), 56 deletions(-)
include/configs/apf27.h +6 -5
index e7e258f..1193013 100644
@@ -321,11 +321,12 @@
  */
 
 #ifdef CONFIG_CMD_I2C
-#define CONFIG_HARD_I2C
-#define CONFIG_I2C_MXC
-#define CONFIG_SYS_I2C_BASE		IMX_I2C1_BASE
-#define CONFIG_SYS_I2C_SPEED		100000	/* 100 kHz */
-#define CONFIG_SYS_I2C_SLAVE		0x7F
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_MXC
+#define CONFIG_SYS_MXC_I2C1_SPEED	100000	/* 100 kHz */
+#define CONFIG_SYS_MXC_I2C1_SLAVE	0x7F
+#define CONFIG_SYS_MXC_I2C2_SPEED	100000	/* 100 kHz */
+#define CONFIG_SYS_MXC_I2C2_SLAVE	0x7F
 #define CONFIG_SYS_I2C_NOPROBES		{ }
 
 #ifdef CONFIG_CMD_EEPROM
include/configs/flea3.h +4 -5
index cfcaf1b..a330d39 100644
@@ -50,11 +50,10 @@
 /*
  * Hardware drivers
  */
-#define CONFIG_HARD_I2C
-#define CONFIG_I2C_MXC
-#define CONFIG_SYS_I2C_BASE		I2C3_BASE_ADDR
-#define CONFIG_SYS_I2C_SPEED		100000
-#define CONFIG_SYS_I2C_SLAVE		0xfe
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_MXC
+#define CONFIG_SYS_SPD_BUS_NUM		2 /* I2C3 */
+#define CONFIG_SYS_MXC_I2C3_SLAVE	0xfe
 #define CONFIG_MXC_SPI
 #define CONFIG_MXC_GPIO
 
include/configs/imx31_phycore.h +3 -4
index 720e1bf..db43f19 100644
@@ -35,11 +35,10 @@
  * 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 /* I2C2 */
 #define CONFIG_SYS_I2C_CLK_OFFSET	I2C2_CLK_OFFSET
-#define CONFIG_SYS_I2C_SPEED		100000
 
 #define CONFIG_MXC_UART
 #define CONFIG_MXC_UART_BASE		UART1_BASE
include/configs/m53evk.h +3 -4
index ccb07e3..1fd8b72 100644
@@ -161,10 +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_SPEED		100000
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_MXC
+#define CONFIG_SYS_SPD_BUS_NUM		1 /* I2C2 */
 #endif
 
 /*
include/configs/mx25pdk.h +3 -4
index 543c415..256b3c1 100644
@@ -111,10 +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_SPEED		100000
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_MXC
+#define CONFIG_SYS_SPD_BUS_NUM		0 /* I2C1 */
 
 /* RTC */
 #define CONFIG_RTC_IMXDI
include/configs/mx35pdk.h +3 -4
index 68b225a..8966581 100644
@@ -41,10 +41,9 @@
 /*
  * Hardware drivers
  */
-#define CONFIG_HARD_I2C
-#define CONFIG_I2C_MXC
-#define CONFIG_SYS_I2C_BASE		I2C1_BASE_ADDR
-#define CONFIG_SYS_I2C_SPEED		100000
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_MXC
+#define CONFIG_SYS_SPD_BUS_NUM		0 /* I2C1 */
 #define CONFIG_MXC_SPI
 #define CONFIG_MXC_GPIO
 
include/configs/mx53ard.h +3 -4
index 122ffd0..f0cc483 100644
@@ -44,10 +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_SPEED            100000
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_MXC
+#define CONFIG_SYS_SPD_BUS_NUM		1 /* I2C2 */
 
 /* MMC Configs */
 #define CONFIG_FSL_ESDHC
include/configs/mx53evk.h +3 -4
index d39ce7b..2beb433 100644
@@ -37,10 +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_SPEED            100000
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_MXC
+#define CONFIG_SYS_SPD_BUS_NUM		1 /* I2C2 */
 
 /* PMIC Configs */
 #define CONFIG_POWER
include/configs/mx53loco.h +3 -4
index 7237da5..a936fb4 100644
@@ -71,10 +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_SPEED		100000
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_MXC
+#define CONFIG_SYS_SPD_BUS_NUM		0 /* I2C1 */
 
 /* PMIC Controller */
 #define CONFIG_POWER
include/configs/mx53smd.h +3 -4
index 7e4e1c9..72c21f9 100644
@@ -34,10 +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_SPEED            100000
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_MXC
+#define CONFIG_SYS_SPD_BUS_NUM		1 /* I2C2 */
 
 /* MMC Configs */
 #define CONFIG_FSL_ESDHC
include/configs/mx6qsabreauto.h +2 -2
index 5530fc6..e0200c7 100644
@@ -36,8 +36,8 @@
 
 /* I2C Configs */
 #define CONFIG_CMD_I2C
-#define CONFIG_I2C_MULTI_BUS
-#define CONFIG_I2C_MXC
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_MXC
 #define CONFIG_SYS_I2C_SPEED		100000
 
 #endif                         /* __MX6QSABREAUTO_CONFIG_H */
include/configs/nitrogen6x.h +2 -2
index 3454b86..d515e49 100644
@@ -52,8 +52,8 @@
 
 /* I2C Configs */
 #define CONFIG_CMD_I2C
-#define CONFIG_I2C_MULTI_BUS
-#define CONFIG_I2C_MXC
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_MXC
 #define CONFIG_SYS_I2C_SPEED		100000
 
 /* OCOTP Configs */
include/configs/titanium.h +2 -2
index 077e25e..0769f07 100644
@@ -41,8 +41,8 @@
 
 /* I2C Configs */
 #define CONFIG_CMD_I2C
-#define CONFIG_I2C_MULTI_BUS
-#define CONFIG_I2C_MXC
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_MXC
 #define CONFIG_SYS_I2C_SPEED		100000
 
 /* MMC Configs */
include/configs/vf610twr.h +3 -4
index 5a7a066..34861f6 100644
@@ -70,10 +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_SPEED		100000
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_MXC
+#define CONFIG_SYS_SPD_BUS_NUM		0
 
 #define CONFIG_BOOTDELAY		3
 
include/configs/woodburn_common.h +3 -4
index 6b7e81f..24f331a 100644
@@ -45,10 +45,9 @@
 /*
  * Hardware drivers
  */
-#define CONFIG_HARD_I2C
-#define CONFIG_I2C_MXC
-#define CONFIG_SYS_I2C_BASE		I2C1_BASE_ADDR
-#define CONFIG_SYS_I2C_SPEED		100000
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_MXC
+#define CONFIG_SYS_SPD_BUS_NUM		0
 #define CONFIG_MXC_SPI
 #define CONFIG_MXC_GPIO
 
Signature · 1 line
1.7.4.4