[U-Boot-Users] [PATCH] I2C register access functions for omap1510_i2c driver

Ladislav Michl ladis at linux-mips.org
Sat Feb 9 00:25:35 CET 2008


drivers/i2c/omap1510_i2c.c does not implement i2c_reg_read and
i2c_reg_write which leads to unresolved symbols when using ds1307
driver. While there, enable CONFIG_CMD_DATE for Voiceblue board to have
nice test case :-)

Signed-off-by: Ladislav Michl <ladis at linux-mips.org>

diff --git a/drivers/i2c/omap1510_i2c.c b/drivers/i2c/omap1510_i2c.c
index 04400fb..f0fc15e 100644
--- a/drivers/i2c/omap1510_i2c.c
+++ b/drivers/i2c/omap1510_i2c.c
@@ -240,6 +240,19 @@ int i2c_write (uchar chip, uint addr, int alen, uchar * buffer, int len)
 	return 0;
 }
 
+uchar i2c_reg_read (uchar chip, uchar reg)
+{
+	uchar val;
+
+	i2c_read_byte(chip, reg, &val);
+	return val;
+}
+
+void i2c_reg_write(uchar chip, uchar reg, uchar val)
+{
+	i2c_write_byte(chip, reg, val);
+}
+
 static void wait_for_bb (void)
 {
 	int timeout = 10;
diff --git a/include/configs/voiceblue.h b/include/configs/voiceblue.h
index 8c827af..63e3530 100644
--- a/include/configs/voiceblue.h
+++ b/include/configs/voiceblue.h
@@ -126,6 +126,7 @@
 
 #define CONFIG_CMD_BDI
 #define CONFIG_CMD_BOOTD
+#define CONFIG_CMD_DATE
 #define CONFIG_CMD_DHCP
 #define CONFIG_CMD_ENV
 #define CONFIG_CMD_FLASH
diff --git a/board/voiceblue/voiceblue.c b/board/voiceblue/voiceblue.c
index c8dde36..fbbbe9d 100644
--- a/board/voiceblue/voiceblue.c
+++ b/board/voiceblue/voiceblue.c
@@ -56,6 +56,7 @@ int dram_init(void)
 int misc_init_r(void)
 {
 	*((volatile unsigned short *) VOICEBLUE_LED_REG) = 0x55;
+	i2c_reg_write(CFG_I2C_RTC_ADDR, 0x10, 0xaa);	/* Trickle charge */
 
 	return 0;
 }





More information about the U-Boot mailing list