[U-Boot] [PATCH] Exynos5250: I2C: Fix driver as per new I2C multibus/multiadapter support

Rajeshwari S Shinde rajeshwari.s at samsung.com
Tue Sep 3 08:20:14 CEST 2013


This patch fixes the S3C24xx I2C driver as per new I2C
multibus/multiadapter support for Exynos5250.

Change-Id: I95873fef7d312310670e3bb33ad9532c10f60463
Signed-off-by: Rajeshwari S Shinde <rajeshwari.s at samsung.com>
---
 drivers/i2c/s3c24x0_i2c.c       | 14 +++++++-------
 include/configs/exynos5250-dt.h |  3 ++-
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c
index cd09c78..5fdb85f 100644
--- a/drivers/i2c/s3c24x0_i2c.c
+++ b/drivers/i2c/s3c24x0_i2c.c
@@ -53,7 +53,7 @@
 static unsigned int g_current_bus __attribute__((section(".data")));
 #ifdef CONFIG_OF_CONTROL
 static int i2c_busses __attribute__((section(".data")));
-static struct s3c24x0_i2c_bus i2c_bus[CONFIG_MAX_I2C_NUM]
+static struct s3c24x0_i2c_bus i2c_bus_data[CONFIG_SYS_NUM_I2C_BUSES]
 			__attribute__((section(".data")));
 #endif
 
@@ -160,7 +160,7 @@ int i2c_set_bus_num(unsigned int bus)
 {
 	struct s3c24x0_i2c *i2c;
 
-	if ((bus < 0) || (bus >= CONFIG_MAX_I2C_NUM)) {
+	if ((bus < 0) || (bus >= CONFIG_SYS_NUM_I2C_BUSES)) {
 		debug("Bad bus: %d\n", bus);
 		return -1;
 	}
@@ -503,12 +503,12 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
 void board_i2c_init(const void *blob)
 {
 	int i;
-	int node_list[CONFIG_MAX_I2C_NUM];
+	int node_list[CONFIG_SYS_NUM_I2C_BUSES];
 	int count;
 
 	count = fdtdec_find_aliases_for_id(blob, "i2c",
 		COMPAT_SAMSUNG_S3C2440_I2C, node_list,
-		CONFIG_MAX_I2C_NUM);
+		CONFIG_SYS_NUM_I2C_BUSES);
 
 	for (i = 0; i < count; i++) {
 		struct s3c24x0_i2c_bus *bus;
@@ -516,7 +516,7 @@ void board_i2c_init(const void *blob)
 
 		if (node <= 0)
 			continue;
-		bus = &i2c_bus[i];
+		bus = &i2c_bus_data[i];
 		bus->regs = (struct s3c24x0_i2c *)
 			fdtdec_get_addr(blob, node, "reg");
 		bus->id = pinmux_decode_periph_id(blob, node);
@@ -529,7 +529,7 @@ void board_i2c_init(const void *blob)
 static struct s3c24x0_i2c_bus *get_bus(unsigned int bus_idx)
 {
 	if (bus_idx < i2c_busses)
-		return &i2c_bus[bus_idx];
+		return &i2c_bus_data[bus_idx];
 
 	debug("Undefined bus: %d\n", bus_idx);
 	return NULL;
@@ -540,7 +540,7 @@ int i2c_get_bus_num_fdt(int node)
 	int i;
 
 	for (i = 0; i < i2c_busses; i++) {
-		if (node == i2c_bus[i].node)
+		if (node == i2c_bus_data[i].node)
 			return i;
 	}
 
diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h
index 2b93a45..e6a2cd0 100644
--- a/include/configs/exynos5250-dt.h
+++ b/include/configs/exynos5250-dt.h
@@ -254,8 +254,9 @@
 #define CONFIG_SYS_I2C_SPEED	100000		/* 100 Kbps */
 #define CONFIG_DRIVER_S3C24X0_I2C
 #define CONFIG_I2C_MULTI_BUS
-#define CONFIG_MAX_I2C_NUM	8
 #define CONFIG_SYS_I2C_SLAVE    0x0
+#define CONFIG_SYS_I2C_MAX_HOPS 1
+#define CONFIG_SYS_NUM_I2C_BUSES 8
 #define CONFIG_I2C_EDID
 
 /* PMIC */
-- 
1.7.12.4



More information about the U-Boot mailing list