Skip to contentSkip to conversation

i2c: sh_i2c: Update to new CONFIG_SYS_I2C framework

PATCH Superseded Nobuhiro Iwamatsu 2 participants 7 messages Oct 17, 2013 – Oct 21, 2013 I2C

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 i2c: sh_i2c: Update to new CONFIG_SYS_I2C framework

This updates to new I2C framwwork on sh_i2c.

---
 README               |  18 ++++
 drivers/i2c/Makefile |   2 +-
 drivers/i2c/sh_i2c.c | 294 +++++++++++++++++++++++----------------------------
 3 files changed, 150 insertions(+), 164 deletions(-)
README +18 -0
index 60e4a45..12784f0 100644
@@ -2017,6 +2017,24 @@ CBFS (Coreboot Filesystem) support
 		  - CONFIG_SYS_I2C_RCAR_SPEED3 for for the speed channel 3
 		  - CONFIF_SYS_I2C_RCAR_NUM_CONTROLLERS for nummber of i2c buses
 
+		- drivers/i2c/sh_i2c.c:
+		  - activate this driver with CONFIG_SYS_I2C_SH
+		  - This driver adds from 2 to 5 i2c buses
+
+		  - CONFIG_SYS_I2C_SH_BASE0 for setting the register channel 0
+		  - CONFIG_SYS_I2C_SH_SPEED0 for for the speed channel 0
+		  - CONFIG_SYS_I2C_SH_BASE1 for setting the register channel 1
+		  - CONFIG_SYS_I2C_SH_SPEED1 for for the speed channel 1
+		  - CONFIG_SYS_I2C_SH_BASE2 for setting the register channel 2
+		  - CONFIG_SYS_I2C_SH_SPEED2 for for the speed channel 2
+		  - CONFIG_SYS_I2C_SH_BASE3 for setting the register channel 3
+		  - CONFIG_SYS_I2C_SH_SPEED3 for for the speed channel 3
+		  - CONFIG_SYS_I2C_SH_BASE4 for setting the register channel 4
+		  - CONFIG_SYS_I2C_SH_SPEED4 for for the speed channel 4
+		  - CONFIG_SYS_I2C_SH_BASE5 for setting the register channel 5
+		  - CONFIG_SYS_I2C_SH_SPEED5 for for the speed channel 5
+		  - CONFIF_SYS_I2C_SH_NUM_CONTROLLERS for nummber of i2c buses
+
 		additional defines:
 
 		CONFIG_SYS_NUM_I2C_BUSES
drivers/i2c/Makefile +1 -1
index cde9d92..4a426d0 100644
@@ -23,13 +23,13 @@ COBJS-$(CONFIG_PCA9564_I2C) += pca9564_i2c.o
 COBJS-$(CONFIG_DRIVER_S3C24X0_I2C) += s3c24x0_i2c.o
 COBJS-$(CONFIG_TSI108_I2C) += tsi108_i2c.o
 COBJS-$(CONFIG_U8500_I2C) += u8500_i2c.o
-COBJS-$(CONFIG_SH_I2C) += sh_i2c.o
 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_PPC4XX) += ppc4xx_i2c.o
 COBJS-$(CONFIG_SYS_I2C_RCAR) += rcar_i2c.o
+COBJS-$(CONFIG_SYS_I2C_SH) += sh_i2c.o
 COBJS-$(CONFIG_SYS_I2C_SOFT) += soft_i2c.o
 COBJS-$(CONFIG_SYS_I2C_TEGRA) += tegra_i2c.o
 COBJS-$(CONFIG_ZYNQ_I2C) += zynq_i2c.o
drivers/i2c/sh_i2c.c +131 -163

425 lines not on this page · raw message

Signature · 1 line
1.8.4.rc3
#1 lore raw

PATCH 2/3 arm: kzm9g: Update to new I2C framework

Kzm9g uses sh_i2c driver. sh_i2c driver updated to new I2C framwork. This updates kzm9g to this change.

---
 board/kmc/kzm9g/kzm9g.c |  2 +-
 include/configs/kzm9g.h | 31 ++++++++++++++++---------------
 2 files changed, 17 insertions(+), 16 deletions(-)
board/kmc/kzm9g/kzm9g.c +1 -1
index b669ffe..0ec5e8e 100644
@@ -289,7 +289,7 @@ void adjust_core_voltage(void)
 {
 	u8 data;
 
-	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+	i2c_init(CONFIG_SYS_I2C_SH_SPEED0, CONFIG_SYS_I2C_SLAVE);
 	data = 0x35;
 	i2c_set_bus_num(0);
 	i2c_write(0x40, 3, 1, &data, 1);
include/configs/kzm9g.h +16 -15
index 6323050..9a3d2f8 100644
@@ -141,21 +141,22 @@
 
 /* I2C */
 #define CONFIG_CMD_I2C
-#define CONFIG_SH_I2C 1
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_SH
+#define CONFIG_SYS_I2C_SH_NUM_CONTROLLERS 5
+#define CONFIG_SYS_I2C_SH_BASE0	0xE6820000
+#define CONFIG_SYS_I2C_SH_SPEED0	100000
+#define CONFIG_SYS_I2C_SH_BASE1	0xE6822000
+#define CONFIG_SYS_I2C_SH_SPEED1	100000
+#define CONFIG_SYS_I2C_SH_BASE2	0xE6824000
+#define CONFIG_SYS_I2C_SH_SPEED2	100000
+#define CONFIG_SYS_I2C_SH_BASE3	0xE6826000
+#define CONFIG_SYS_I2C_SH_SPEED3	100000
+#define CONFIG_SYS_I2C_SH_BASE4	0xE6828000
+#define CONFIG_SYS_I2C_SH_SPEED4	100000
 #define CONFIG_SH_I2C_8BIT
-#define CONFIG_HARD_I2C
-#define CONFIG_I2C_MULTI_BUS
-#define CONFIG_SYS_MAX_I2C_BUS  (5)
-#define CONFIG_SYS_I2C_MODULE
-#define CONFIG_SYS_I2C_SPEED    (100000) /* 100 kHz */
-#define CONFIG_SYS_I2C_SLAVE    (0x7F)
-#define CONFIG_SH_I2C_DATA_HIGH (4)
-#define CONFIG_SH_I2C_DATA_LOW  (5)
-#define CONFIG_SH_I2C_CLOCK     (104000000) /* 104 MHz */
-#define CONFIG_SH_I2C_BASE0     (0xE6820000)
-#define CONFIG_SH_I2C_BASE1     (0xE6822000)
-#define CONFIG_SH_I2C_BASE2     (0xE6824000)
-#define CONFIG_SH_I2C_BASE3     (0xE6826000)
-#define CONFIG_SH_I2C_BASE4     (0xE6828000)
+#define CONFIG_SH_I2C_DATA_HIGH 4
+#define CONFIG_SH_I2C_DATA_LOW  5
+#define CONFIG_SH_I2C_CLOCK     104000000 /* 104 MHz */
 
 #endif /* __KZM9G_H */
Signature · 1 line
1.8.4.rc3
#2 lore raw

PATCH 2/3 arm: kzm9g: Update to new I2C framework

Hello Nobuhiro,

Am 17.10.2013 09:18, schrieb Nobuhiro Iwamatsu:

Quoted 9 lines

Kzm9g uses sh_i2c driver. sh_i2c driver updated to new I2C framwork. This updates kzm9g to this change.

---
  board/kmc/kzm9g/kzm9g.c |  2 +-
  include/configs/kzm9g.h | 31 ++++++++++++++++---------------
  2 files changed, 17 insertions(+), 16 deletions(-)

Could you sqash this patch into http://patchwork.ozlabs.org/patch/284106
so we get no problems with "git bisect".

Beside of that only one comment:

board/kmc/kzm9g/kzm9g.c void adjust_core_voltage(void) · line 292

Quoted 10 lines
board/kmc/kzm9g/kzm9g.c +1 -1
index b669ffe..0ec5e8e 100644
@@ -289,7 +289,7 @@ void adjust_core_voltage(void)
  {
  	u8 data;
 
-	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+	i2c_init(CONFIG_SYS_I2C_SH_SPEED0, CONFIG_SYS_I2C_SLAVE);

You no longer need to call i2c_init, as this does i2c_set_bus_num() for you. Please remove this and test, thanks!

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#3 lore raw

PATCH 2/3 arm: kzm9g: Update to new I2C framework

Hi,

Thanks for your review.

2013/10/17 Heiko Schocher <[email protected]>:

Quoted 9 lines

Hello Nobuhiro,

Am 17.10.2013 09:18, schrieb Nobuhiro Iwamatsu:

Quoted 5 lines

Kzm9g uses sh_i2c driver. sh_i2c driver updated to new I2C framwork. This updates kzm9g to this change.

Quoted 8 lines
Quoted 4 lines
---
  board/kmc/kzm9g/kzm9g.c |  2 +-
  include/configs/kzm9g.h | 31 ++++++++++++++++---------------
  2 files changed, 17 insertions(+), 16 deletions(-)

Could you sqash this patch into http://patchwork.ozlabs.org/patch/284106
so we get no problems with "git bisect".

OK, I will squash this patch and re-send.

Quoted 12 lines

Beside of that only one comment:

Quoted 8 lines
board/kmc/kzm9g/kzm9g.c +0 -0
index b669ffe..0ec5e8e 100644
@@ -289,7 +289,7 @@ void adjust_core_voltage(void)
  {
        u8 data;
 
Quoted 6 lines

board/kmc/kzm9g/kzm9g.c void adjust_core_voltage(void) · line 292

Quoted 2 lines
board/kmc/kzm9g/kzm9g.c +1 -1
-       i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+       i2c_init(CONFIG_SYS_I2C_SH_SPEED0, CONFIG_SYS_I2C_SLAVE);

You no longer need to call i2c_init, as this does i2c_set_bus_num() for you. Please remove this and test, thanks!

I see. I will update this patch.

Quoted 3 lines

bye,
Heiko

Best regards,
Nobuhiro

Signature · 1 line
Nobuhiro Iwamatsu
#4 lore raw

PATCH 3/3 sh: ecovec: Update to new I2C framework

In reply to Nobuhiro Iwamatsu

Ecovec uses sh_i2c driver. sh_i2c driver updated to new I2C framwork. This updates ecovec to this change.

---
 board/renesas/ecovec/ecovec.c |  4 ++--
 include/configs/ecovec.h      | 15 +++++++--------
 2 files changed, 9 insertions(+), 10 deletions(-)
board/renesas/ecovec/ecovec.c +2 -2
index e2d365a..4289d2d 100644
@@ -57,8 +57,8 @@ int board_late_init(void)
 
 	outl(inl(MSTPCR2) & ~0x10000000, MSTPCR2);
 
-	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
-	i2c_set_bus_num(CONFIG_SYS_I2C_MODULE); /* Use I2C 1 */
+	i2c_init(CONFIG_SYS_I2C_SH_SPEED1, CONFIG_SYS_I2C_SLAVE);
+	i2c_set_bus_num(1); /* Use I2C 1 */
 
 	/* Read MAC address */
 	i2c_read(0x50, 0x10, 0, mac, 6);
include/configs/ecovec.h +7 -8
index 34bd0b3..b0c41b1 100644
@@ -58,18 +58,17 @@
 
 /* I2C */
 #define CONFIG_CMD_I2C
-#define CONFIG_SH_I2C 1
-#define CONFIG_HARD_I2C		1
-#define CONFIG_I2C_MULTI_BUS	1
-#define CONFIG_SYS_MAX_I2C_BUS	2
-#define CONFIG_SYS_I2C_MODULE	1
-#define CONFIG_SYS_I2C_SPEED	100000 /* 100 kHz */
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_SH
 #define CONFIG_SYS_I2C_SLAVE	0x7F
+#define CONFIG_SYS_I2C_SH_NUM_CONTROLLERS 2
+#define CONFIG_SYS_I2C_SH_BASE0	0xA4470000
+#define CONFIG_SYS_I2C_SH_SPEED0	100000
+#define CONFIG_SYS_I2C_SH_BASE1	0xA4750000
+#define CONFIG_SYS_I2C_SH_SPEED1	100000
 #define CONFIG_SH_I2C_DATA_HIGH	4
 #define CONFIG_SH_I2C_DATA_LOW 	5
 #define CONFIG_SH_I2C_CLOCK  	41666666
-#define CONFIG_SH_I2C_BASE0		0xA4470000
-#define CONFIG_SH_I2C_BASE1		0xA4750000
 
 /* Ether */
 #define CONFIG_SH_ETHER 1
Signature · 1 line
1.8.4.rc3
#5 lore raw

PATCH 3/3 sh: ecovec: Update to new I2C framework

Hello Nobuhiro,

Am 17.10.2013 09:18, schrieb Nobuhiro Iwamatsu:

Quoted 8 lines

Ecovec uses sh_i2c driver. sh_i2c driver updated to new I2C framwork. This updates ecovec to this change.

---
  board/renesas/ecovec/ecovec.c |  4 ++--
  include/configs/ecovec.h      | 15 +++++++--------
  2 files changed, 9 insertions(+), 10 deletions(-)

Could you sqash this patch into http://patchwork.ozlabs.org/patch/284106
so we get no problems with "git bisect".

Beside of that only one comment:

board/renesas/ecovec/ecovec.c int board_late_init(void) · line 61

Quoted 12 lines
board/renesas/ecovec/ecovec.c +2 -2
index e2d365a..4289d2d 100644
@@ -57,8 +57,8 @@ int board_late_init(void)
 
  	outl(inl(MSTPCR2)&  ~0x10000000, MSTPCR2);
 
-	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
-	i2c_set_bus_num(CONFIG_SYS_I2C_MODULE); /* Use I2C 1 */
+	i2c_init(CONFIG_SYS_I2C_SH_SPEED1, CONFIG_SYS_I2C_SLAVE);
+	i2c_set_bus_num(1); /* Use I2C 1 */

same comment as for your patch for the kzm9g board, remove i2c_init() call, as it is no longer necessary, thanks!

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#6 lore raw

PATCH 3/3 sh: ecovec: Update to new I2C framework

Hi,

Thanks for your review

2013/10/17 Heiko Schocher <[email protected]>:

Quoted 14 lines

Hello Nobuhiro,

Am 17.10.2013 09:18, schrieb Nobuhiro Iwamatsu:

Quoted 8 lines

Ecovec uses sh_i2c driver. sh_i2c driver updated to new I2C framwork. This updates ecovec to this change.

---
  board/renesas/ecovec/ecovec.c |  4 ++--
  include/configs/ecovec.h      | 15 +++++++--------
  2 files changed, 9 insertions(+), 10 deletions(-)
Quoted 2 lines

Could you sqash this patch into http://patchwork.ozlabs.org/patch/284106
so we get no problems with "git bisect".

OK , I will bisect and re-send.

Quoted 12 lines

Beside of that only one comment:

Quoted 9 lines
board/renesas/ecovec/ecovec.c +0 -0
index e2d365a..4289d2d 100644
@@ -57,8 +57,8 @@ int board_late_init(void)
 
        outl(inl(MSTPCR2)&  ~0x10000000, MSTPCR2);
 
 
Quoted 9 lines

board/renesas/ecovec/ecovec.c int board_late_init(void) · line 61

Quoted 4 lines
board/renesas/ecovec/ecovec.c +2 -2
-       i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
-       i2c_set_bus_num(CONFIG_SYS_I2C_MODULE); /* Use I2C 1 */
+       i2c_init(CONFIG_SYS_I2C_SH_SPEED1, CONFIG_SYS_I2C_SLAVE);
+       i2c_set_bus_num(1); /* Use I2C 1 */

same comment as for your patch for the kzm9g board, remove i2c_init() call, as it is no longer necessary, thanks!

I see. I will remove i2c_init().

Quoted 2 lines

bye,
Heiko

Best regards,
Nobuhiro

Signature · 1 line
Nobuhiro Iwamatsu