]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ARM: OMAP: Add support for high-speed I2C init
authorSyed Mohammed Khasim <x0khasim@ti.com>
Thu, 26 Apr 2007 18:29:55 +0000 (18:29 +0000)
committerTony Lindgren <tony@atomide.com>
Thu, 26 Apr 2007 21:12:55 +0000 (21:12 +0000)
Omap2430 has additional support for high-speed I2C.

This patch moves I2C speed parameter (from module) to platform data.
Also added basic High Speed support based on I2C bus speed.

Signed-off-by: Syed Mohammed Khasim <x0khasim@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/board-2430sdp.c
arch/arm/mach-omap2/clock.h
arch/arm/mach-omap2/devices.c
arch/arm/plat-omap/devices.c

index 7ccc3c141dbdc7413403a95858df753436cab3aa..ceff143d28685a8cac856c940c9a8a2966a33b48 100644 (file)
@@ -192,6 +192,78 @@ static struct omap_board_config_kernel sdp2430_config[] = {
        {OMAP_TAG_UART, &sdp2430_uart_config},
 };
 
+#if    defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
+
+#define OMAP2_I2C_BASE1                0x48070000
+#define OMAP2_I2C_BASE2                0x48072000
+#define OMAP2_I2C_INT1         56
+#define OMAP2_I2C_INT2         57
+
+static u32 omap2_i2c1_clkrate  = 400;
+static u32 omap2_i2c2_clkrate  = 2600;
+
+static struct resource i2c_resources1[] = {
+       {
+               .start  = OMAP2_I2C_BASE1,
+               .end    = OMAP2_I2C_BASE1 + 0x3f,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = OMAP2_I2C_INT1,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct resource i2c_resources2[] = {
+       {
+               .start  = OMAP2_I2C_BASE2,
+               .end    = OMAP2_I2C_BASE2 + 0x3f,
+               .flags  = IORESOURCE_MEM,
+       },
+       {
+               .start  = OMAP2_I2C_INT2,
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device omap_i2c_device1 = {
+       .name           = "i2c_omap",
+       .id             = 1,
+       .num_resources  = ARRAY_SIZE(i2c_resources1),
+       .resource       = i2c_resources1,
+       .dev            = {
+               .platform_data  = &omap2_i2c1_clkrate,
+       },
+};
+
+static struct platform_device omap_i2c_device2 = {
+       .name           = "i2c_omap",
+       .id             = 2,
+       .num_resources  = ARRAY_SIZE(i2c_resources2),
+       .resource       = i2c_resources2,
+       .dev            = {
+               .platform_data  = &omap2_i2c2_clkrate,
+       },
+};
+
+static void omap_init_i2c(void)
+{
+       (void) platform_device_register(&omap_i2c_device2);
+       (void) platform_device_register(&omap_i2c_device1);
+}
+
+#else
+
+static void omap_init_i2c(void) {}
+
+#endif
+
+static int __init omap2430_i2c_init(void)
+{
+       omap_init_i2c();
+       return 0;
+}
+
 static void __init omap_2430sdp_init(void)
 {
        platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices));
@@ -205,6 +277,8 @@ static void __init omap_2430sdp_map_io(void)
        omap2_map_common_io();
 }
 
+arch_initcall(omap2430_i2c_init);
+
 MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
        /* Maintainer: Syed Khasim - Texas Instruments Inc */
        .phys_io        = 0x48000000,
index 54bd1164251572e72c7abfe6720fc66426c62142..71e6185ec9d2ae2d6ba1ff199ce930ba2f96b6b4 100644 (file)
@@ -1761,7 +1761,8 @@ static struct clk i2c2_fck = {
 };
 
 static struct clk i2chs2_fck = {
-       .name           = "i2chs2_fck",
+       .name           = "i2chs_fck",
+       .id             = 2,
        .parent         = &func_96m_ck,
        .flags          = CLOCK_IN_OMAP243X,
        .enable_reg     = (void __iomem *)&CM_FCLKEN2_CORE,
@@ -1790,7 +1791,8 @@ static struct clk i2c1_fck = {
 };
 
 static struct clk i2chs1_fck = {
-       .name           = "i2chs1_fck",
+       .name           = "i2chs_fck",
+       .id             = 1,
        .parent         = &func_96m_ck,
        .flags          = CLOCK_IN_OMAP243X,
        .enable_reg     = (void __iomem *)&CM_FCLKEN2_CORE,
index 767140c7db07382155b932dd2823d6992c154e97..f1eb871130cd977805d528f281cf9d07af066c2c 100644 (file)
 #include <asm/arch/gpio.h>
 #include <asm/arch/eac.h>
 
+#if    !defined(CONFIG_ARCH_OMAP243X)
 #if    defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
 
 #define OMAP2_I2C_BASE2                0x48072000
 #define OMAP2_I2C_INT2         57
 
+static u32 omap2_i2c2_clkrate  = 100;
 static struct resource i2c_resources2[] = {
        {
                .start          = OMAP2_I2C_BASE2,
@@ -47,6 +49,9 @@ static struct platform_device omap_i2c_device2 = {
        .id             = 2,
        .num_resources  = ARRAY_SIZE(i2c_resources2),
        .resource       = i2c_resources2,
+       .dev            = {
+               .platform_data  = &omap2_i2c2_clkrate,
+       },
 };
 
 /* See also arch/arm/plat-omap/devices.c for first I2C on 24xx */
@@ -56,10 +61,9 @@ static void omap_init_i2c(void)
        if (machine_is_omap_h4())
                return;
 
-       if (!cpu_is_omap2430()) {
-               omap_cfg_reg(J15_24XX_I2C2_SCL);
-               omap_cfg_reg(H19_24XX_I2C2_SDA);
-       }
+       omap_cfg_reg(J15_24XX_I2C2_SCL);
+       omap_cfg_reg(H19_24XX_I2C2_SDA);
+
        (void) platform_device_register(&omap_i2c_device2);
 }
 
@@ -67,6 +71,7 @@ static void omap_init_i2c(void)
 
 static void omap_init_i2c(void) {}
 
+#endif
 #endif
 
 #if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
@@ -241,7 +246,9 @@ static int __init omap2_init_devices(void)
        /* please keep these calls, and their implementations above,
         * in alphabetical order so they're easier to sort through.
         */
-       omap_init_i2c();
+       if (!cpu_is_omap2430()) {
+               omap_init_i2c();
+       }
        omap_init_mbox();
        omap_init_mcspi();
        omap_init_sti();
index b8a0fcb5270ebe30e941ded2db78eb03c7d5d718..f8a341bdb9d624fc2cea026a2dbad3af9f87d4a6 100644 (file)
@@ -89,6 +89,7 @@ static inline void omap_init_dsp(void) { }
 #endif /* CONFIG_OMAP_DSP */
 
 /*-------------------------------------------------------------------------*/
+#if    !defined(CONFIG_ARCH_OMAP243X)
 #if    defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
 
 #define        OMAP1_I2C_BASE          0xfffb3800
@@ -97,6 +98,8 @@ static inline void omap_init_dsp(void) { }
 #define OMAP1_I2C_INT          INT_I2C
 #define OMAP2_I2C_INT1         56
 
+static u32 omap2_i2c1_clkrate  = 100;
+
 static struct resource i2c_resources1[] = {
        {
                .start          = 0,
@@ -116,12 +119,15 @@ static struct platform_device omap_i2c_device1 = {
        .id             = 1,
        .num_resources  = ARRAY_SIZE(i2c_resources1),
        .resource       = i2c_resources1,
+       .dev            = {
+               .platform_data  = &omap2_i2c1_clkrate,
+       },
 };
 
 /* See also arch/arm/mach-omap2/devices.c for second I2C on 24xx */
 static void omap_init_i2c(void)
 {
-       if (cpu_is_omap24xx()) {
+       if (cpu_is_omap242x()) {
                i2c_resources1[0].start = OMAP2_I2C_BASE1;
                i2c_resources1[0].end = OMAP2_I2C_BASE1 + OMAP_I2C_SIZE;
                i2c_resources1[1].start = OMAP2_I2C_INT1;
@@ -151,7 +157,7 @@ static void omap_init_i2c(void)
 #else
 static inline void omap_init_i2c(void) {}
 #endif
-
+#endif
 /*-------------------------------------------------------------------------*/
 #if    defined(CONFIG_KEYBOARD_OMAP) || defined(CONFIG_KEYBOARD_OMAP_MODULE)
 
@@ -258,6 +264,7 @@ static struct omap_mmc_conf mmc2_conf;
 
 static u64 mmc2_dmamask = 0xffffffff;
 
+
 static struct resource mmc2_resources[] = {
        {
                .start          = OMAP_MMC2_BASE,
@@ -519,7 +526,9 @@ static int __init omap_init_devices(void)
        omap_init_uwire();
        omap_init_wdt();
        omap_init_rng();
-       omap_init_i2c();
+       if (!cpu_is_omap2430()) {
+               omap_init_i2c();
+       }
        return 0;
 }
 arch_initcall(omap_init_devices);