[U-Boot] [PATCH 3/3] i2c: sh_i2c.c: adjust for SH73A0

2012-09-11 Thread Tetsuyuki Kobayashi
Adjust i2c_raw_read() in sh_i2c.c to work for SH73A0.
After this patch, i2c md and i2c mw command on U-Boot work properly on 
KZM-A9-GT board.

Signed-off-by: Tetsuyuki Kobayashi k...@kmckk.co.jp
---
 drivers/i2c/sh_i2c.c|4 
 include/configs/kzm9g.h |2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/sh_i2c.c b/drivers/i2c/sh_i2c.c
index 84f1f5b..e8efdc9 100644
--- a/drivers/i2c/sh_i2c.c
+++ b/drivers/i2c/sh_i2c.c
@@ -153,8 +153,12 @@ static u8 i2c_raw_read(struct sh_i2c *base, u8 id, u8 reg)
 {
u8 ret;
 
+#if defined(CONFIG_SH73A0)
+   i2c_set_addr(base, id, reg, 0);
+#else
i2c_set_addr(base, id, reg, 1);
udelay(100);
+#endif
 
writeb((SH_I2C_ICCR_ICE|SH_I2C_ICCR_RTS|SH_I2C_ICCR_BUSY), base-iccr);
irq_dte(base);
diff --git a/include/configs/kzm9g.h b/include/configs/kzm9g.h
index a1ae718..5eccd29 100644
--- a/include/configs/kzm9g.h
+++ b/include/configs/kzm9g.h
@@ -163,7 +163,7 @@
 #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 (4166)
+#define CONFIG_SH_I2C_CLOCK (10400) /* 104 MHz */
 #define CONFIG_SH_I2C_BASE0 (0xE682)
 #define CONFIG_SH_I2C_BASE1 (0xE6822000)
 
-- 
1.7.9.5

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3] i2c: sh_i2c.c: adjust for SH73A0

2012-09-11 Thread Nobuhiro Iwamatsu
Hi,

I add Heiko Schocher h...@denx.de to Cc:
Heiko is I2C maintainer.

On Tue, Sep 11, 2012 at 2:58 PM, Tetsuyuki Kobayashi k...@kmckk.co.jp wrote:
 Adjust i2c_raw_read() in sh_i2c.c to work for SH73A0.
 After this patch, i2c md and i2c mw command on U-Boot work properly on 
 KZM-A9-GT board.

 Signed-off-by: Tetsuyuki Kobayashi k...@kmckk.co.jp

Acked-by: Nobuhiro Iwamatsu nobuhiro.iwamatsu...@renesas.com

 ---
  drivers/i2c/sh_i2c.c|4 
  include/configs/kzm9g.h |2 +-
  2 files changed, 5 insertions(+), 1 deletion(-)

 diff --git a/drivers/i2c/sh_i2c.c b/drivers/i2c/sh_i2c.c
 index 84f1f5b..e8efdc9 100644
 --- a/drivers/i2c/sh_i2c.c
 +++ b/drivers/i2c/sh_i2c.c
 @@ -153,8 +153,12 @@ static u8 i2c_raw_read(struct sh_i2c *base, u8 id, u8 
 reg)
  {
 u8 ret;

 +#if defined(CONFIG_SH73A0)
 +   i2c_set_addr(base, id, reg, 0);
 +#else
 i2c_set_addr(base, id, reg, 1);
 udelay(100);
 +#endif

 writeb((SH_I2C_ICCR_ICE|SH_I2C_ICCR_RTS|SH_I2C_ICCR_BUSY), 
 base-iccr);
 irq_dte(base);
 diff --git a/include/configs/kzm9g.h b/include/configs/kzm9g.h
 index a1ae718..5eccd29 100644
 --- a/include/configs/kzm9g.h
 +++ b/include/configs/kzm9g.h
 @@ -163,7 +163,7 @@
  #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 (4166)
 +#define CONFIG_SH_I2C_CLOCK (10400) /* 104 MHz */
  #define CONFIG_SH_I2C_BASE0 (0xE682)
  #define CONFIG_SH_I2C_BASE1 (0xE6822000)

 --
 1.7.9.5


Best regards,
  Nobuhiro


-- 
Nobuhiro Iwamatsu
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot