Skip to contentSkip to conversation

U-boot-V2:Boards:SDP3430: Enable i2c bus1

PATCH New Menon 2 participants 3 messages Jun 18, 2008

lore
Share & tools
lore

Menon

#0 lore raw

PATCH 9/9 U-boot-V2:Boards:SDP3430: Enable i2c bus1

Enable the i2c bus 1 if the adapter is enabled in defconfig.

This patch also fixes a sparse warning of sdram dev not being static

---
 board/omap/board-sdp343x.c |   26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
board/omap/board-sdp343x.c 2008-06-17 17:01:31.000000000 -0500 renamed from board/omap/board-sdp343x.c 2008-06-17 16:52:25.000000000 -0500 +25 -1
Index: u-boot-v2.git/board/omap/board-sdp343x.c
===================================================================
@@ -54,6 +54,7 @@
 #include <asm/arch/syslib.h>
 #include <asm/arch/control.h>
 #include <asm/arch/omap3-mux.h>
+#include <asm/arch/i2c.h>
 #include "board-sdp343x.h"
 
 /******************** Board Boot Time *******************/
@@ -642,7 +643,7 @@
 console_initcall(sdp3430_console_init);
 #endif                         /* CONFIG_DRIVER_SERIAL_NS16550 */
 
-struct device_d sdram_dev = {
+static struct device_d sdram_dev = {
        .name = "ram",
        .id = "ram0",
 
@@ -665,6 +666,23 @@
 };
 #endif
 
+#ifdef CONFIG_I2C_OMAP
+static struct i2c_omap_platform_data sdp343_i2c1 = {
+       .bus_id = 0,
+       .i2c_clock_speed = OMAP_I2C_CLK_2P6M,
+       .func_clk = OMAP_I2C_FCLK_96MHZ,
+       .info = NULL,
+       .len = 0,
+};
+static struct device_d sdp3430_i2c1 = {
+       .name = OMAP_I2C_ADAPTER_NAME,
+       .id = "omap-i2c0",
+       .map_base = OMAP_I2C1_BASE,
+       .platform_data = (void *)&sdp343_i2c1,
+       .type = DEVICE_TYPE_I2C,
+};
+#endif
+
 static int sdp3430_devices_init(void)
 {
        int ret;
@@ -676,6 +694,12 @@
        if (ret)
                goto failed;
 #endif
+#ifdef CONFIG_I2C_OMAP
+       ret = register_device(&sdp3430_i2c1);
+       if (ret)
+               goto failed;
+#endif
+
 failed:
        return ret;
 }
#1 lore raw

PATCH 9/9 U-boot-V2:Boards:SDP3430: Enable i2c bus1

Quoted 1 line · Nishanth

Enable the i2c bus 1 if the adapter is enabled in defconfig.

How does the bus find its devices? Are they probed? Experience showed that probing i2c devices is not safe, so this should be explicitly allowed on board level.

Sascha

Quoted 68 lines

This patch also fixes a sparse warning of sdram dev not being static

---
 board/omap/board-sdp343x.c |   26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

Index: u-boot-v2.git/board/omap/board-sdp343x.c
===================================================================

board/omap/board-sdp343x.c 2008-06-17 17:01:31.000000000 -0500 renamed from board/omap/board-sdp343x.c 2008-06-17 16:52:25.000000000 -0500 +25 -1
@@ -54,6 +54,7 @@
 #include <asm/arch/syslib.h>
 #include <asm/arch/control.h>
 #include <asm/arch/omap3-mux.h>
+#include <asm/arch/i2c.h>
 #include "board-sdp343x.h"
 
 /******************** Board Boot Time *******************/
@@ -642,7 +643,7 @@
 console_initcall(sdp3430_console_init);
 #endif                         /* CONFIG_DRIVER_SERIAL_NS16550 */
 
-struct device_d sdram_dev = {
+static struct device_d sdram_dev = {
        .name = "ram",
        .id = "ram0",
 
@@ -665,6 +666,23 @@
 };
 #endif
 
+#ifdef CONFIG_I2C_OMAP
+static struct i2c_omap_platform_data sdp343_i2c1 = {
+       .bus_id = 0,
+       .i2c_clock_speed = OMAP_I2C_CLK_2P6M,
+       .func_clk = OMAP_I2C_FCLK_96MHZ,
+       .info = NULL,
+       .len = 0,
+};
+static struct device_d sdp3430_i2c1 = {
+       .name = OMAP_I2C_ADAPTER_NAME,
+       .id = "omap-i2c0",
+       .map_base = OMAP_I2C1_BASE,
+       .platform_data = (void *)&sdp343_i2c1,
+       .type = DEVICE_TYPE_I2C,
+};
+#endif
+
 static int sdp3430_devices_init(void)
 {
        int ret;
@@ -676,6 +694,12 @@
        if (ret)
                goto failed;
 #endif
+#ifdef CONFIG_I2C_OMAP
+       ret = register_device(&sdp3430_i2c1);
+       if (ret)
+               goto failed;
+#endif
+
 failed:
        return ret;
 }
Signature · 4 lines
Pengutronix e.K. - Linux Solutions for Science and Industry
-----------------------------------------------------------
Kontakt-Informationen finden Sie im Header dieser Mail oder
auf der Webseite -> http://www.pengutronix.de/impressum/ <-
#2 lore raw

PATCH 9/9 U-boot-V2:Boards:SDP3430: Enable i2c bus1

Sascha,

Quoted 8 lines

-----Original Message-----
From: Sascha Hauer [mailto:s.hauer at pengutronix.de]
Sent: Wednesday, June 18, 2008 10:34 AM
To: Menon, Nishanth
Cc: Kamat, Nishant; u-boot-users at lists.sourceforge.net; Laurent Desnogues; philip.balister at gmail.com; dirk.behme at googlemail.com
Subject: Re: [Patch 9/9] U-boot-V2:Boards:SDP3430: Enable i2c bus1

Quoted 6 lines
Quoted 1 line · Nishanth

Enable the i2c bus 1 if the adapter is enabled in defconfig.

How does the bus find its devices? Are they probed? Experience showed that probing i2c devices is not safe, so this should be explicitly allowed on board level.

Bus does not scan by default. The rules are same as in linux kernel. The adapters that choose this limitation can request for platform_device with custom flags they want. Regards,
Nishanth Menon