public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] driver: i2c:s3c24x0: init each channel during probe
@ 2013-11-22  8:48 Naveen Krishna Chatradhi
  2013-11-22  8:50 ` Naveen Krishna Ch
  0 siblings, 1 reply; 3+ messages in thread
From: Naveen Krishna Chatradhi @ 2013-11-22  8:48 UTC (permalink / raw)
  To: u-boot

Each I2C channel must be inited during the probe and then set "active"
instead of initing the channel for every time we select the bus
using "i2c dev bus"

Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com>
---
 drivers/i2c/s3c24x0_i2c.c |   29 +++++++++++++----------------
 1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c
index f77a9d1..7136771 100644
--- a/drivers/i2c/s3c24x0_i2c.c
+++ b/drivers/i2c/s3c24x0_i2c.c
@@ -408,22 +408,7 @@ static void exynos5_i2c_reset(struct s3c24x0_i2c_bus *i2c_bus)
 #ifdef CONFIG_I2C_MULTI_BUS
 int i2c_set_bus_num(unsigned int bus)
 {
-	struct s3c24x0_i2c_bus *i2c_bus;
-
-	i2c_bus = get_bus(bus);
-	if (!i2c_bus)
-		return -1;
 	g_current_bus = bus;
-
-	if (i2c_bus->is_highspeed) {
-		if (hsi2c_get_clk_details(i2c_bus))
-			return -1;
-		hsi2c_ch_init(i2c_bus);
-	} else {
-		i2c_ch_init(i2c_bus->regs, i2c_bus->clock_frequency,
-						CONFIG_SYS_I2C_SLAVE);
-	}
-
 	return 0;
 }
 
@@ -989,7 +974,6 @@ static void process_nodes(const void *blob, int node_list[], int count,
 			continue;
 
 		bus = &i2c_bus[i];
-		bus->active = true;
 		bus->is_highspeed = is_highspeed;
 
 		if (is_highspeed)
@@ -1009,6 +993,19 @@ static void process_nodes(const void *blob, int node_list[], int count,
 
 		/* Mark position as used */
 		node_list[i] = -1;
+
+		if (bus->is_highspeed) {
+			if (hsi2c_get_clk_details(bus)) {
+				bus->active = false;
+				break;
+			}
+			hsi2c_ch_init(bus);
+			exynos5_i2c_reset(bus);
+		} else {
+			i2c_ch_init(bus->regs, bus->clock_frequency,
+							CONFIG_SYS_I2C_SLAVE);
+		}
+		bus->active = true;
 	}
 }
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-25  6:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-22  8:48 [U-Boot] [PATCH] driver: i2c:s3c24x0: init each channel during probe Naveen Krishna Chatradhi
2013-11-22  8:50 ` Naveen Krishna Ch
2013-11-25  6:46   ` Heiko Schocher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox