[U-Boot] [PATCH v3 04/12] i2c:multi_i2c: adapt file to new i2c framework

Piotr Wilczek p.wilczek at samsung.com
Fri May 17 14:55:47 CEST 2013


This patch change get bus macro to i2c_get_bus_num() function
New macros CONFIG_SOFT_I2C_I2C8_SCL/SDA is added.

Signed-off-by: Piotr Wilczek <p.wilczek at samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
CC: Lukasz Majewski <l.majewski at samsung.com>

---
Changes in v3:
- I2C_GET_BUS replaced by i2c_get_bus_num() function

Changes in v2:
- new patch

 board/samsung/common/multi_i2c.c |   37 +++++++++++++++++++++++++++++++++++--
 1 file changed, 35 insertions(+), 2 deletions(-)

diff --git a/board/samsung/common/multi_i2c.c b/board/samsung/common/multi_i2c.c
index d6c3d37..f4735c7 100644
--- a/board/samsung/common/multi_i2c.c
+++ b/board/samsung/common/multi_i2c.c
@@ -24,15 +24,44 @@
 #include <common.h>
 #include <i2c.h>
 
+#ifndef CONFIG_SOFT_I2C_I2C5_SCL
+#define CONFIG_SOFT_I2C_I2C5_SCL 0
+#endif
+#ifndef CONFIG_SOFT_I2C_I2C7_SCL
+#define CONFIG_SOFT_I2C_I2C7_SCL 0
+#endif
+#ifndef CONFIG_SOFT_I2C_I2C8_SCL
+#define CONFIG_SOFT_I2C_I2C8_SCL 0
+#endif
+#ifndef CONFIG_SOFT_I2C_I2C9_SCL
+#define CONFIG_SOFT_I2C_I2C9_SCL 0
+#endif
+#ifndef CONFIG_SOFT_I2C_I2C5_SDA
+#define CONFIG_SOFT_I2C_I2C5_SDA 0
+#endif
+#ifndef CONFIG_SOFT_I2C_I2C7_SDA
+#define CONFIG_SOFT_I2C_I2C7_SDA 0
+#endif
+#ifndef CONFIG_SOFT_I2C_I2C8_SDA
+#define CONFIG_SOFT_I2C_I2C8_SDA 0
+#endif
+#ifndef CONFIG_SOFT_I2C_I2C9_SDA
+#define CONFIG_SOFT_I2C_I2C9_SDA 0
+#endif
+
 /* Handle multiple I2C buses instances */
 int get_multi_scl_pin(void)
 {
-	unsigned int bus = I2C_GET_BUS();
+	unsigned int bus = i2c_get_bus_num();
 
 	switch (bus) {
 	case I2C_0: /* I2C_0 definition - compatibility layer */
 	case I2C_5:
 		return CONFIG_SOFT_I2C_I2C5_SCL;
+	case I2C_7:
+		return CONFIG_SOFT_I2C_I2C7_SCL;
+	case I2C_8:
+		return CONFIG_SOFT_I2C_I2C8_SCL;
 	case I2C_9:
 		return CONFIG_SOFT_I2C_I2C9_SCL;
 	default:
@@ -44,12 +73,16 @@ int get_multi_scl_pin(void)
 
 int get_multi_sda_pin(void)
 {
-	unsigned int bus = I2C_GET_BUS();
+	unsigned int bus = i2c_get_bus_num();
 
 	switch (bus) {
 	case I2C_0: /* I2C_0 definition - compatibility layer */
 	case I2C_5:
 		return CONFIG_SOFT_I2C_I2C5_SDA;
+	case I2C_7:
+		return CONFIG_SOFT_I2C_I2C7_SDA;
+	case I2C_8:
+		return CONFIG_SOFT_I2C_I2C8_SDA;
 	case I2C_9:
 		return CONFIG_SOFT_I2C_I2C9_SDA;
 	default:
-- 
1.7.9.5



More information about the U-Boot mailing list