]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ARM: OMAP: Use I2C bus registration helper
authorJarkko Nikula <jarkko.nikula@nokia.com>
Wed, 7 Nov 2007 10:54:32 +0000 (12:54 +0200)
committerTony Lindgren <tony@atomide.com>
Thu, 15 Nov 2007 21:56:51 +0000 (13:56 -0800)
This patch starts using introduced I2C bus registration helper by cleaning
up registration currently done in various places and by doing necessary
board file modifications.

Patch modifies those board files that are merged upstream. Most of the
boards except osk and 2430sdp are configured to use 100 kHz I2C clock
until they are verified for higher clock.

Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Tony Lindgren <tony@atomide.com>
20 files changed:
arch/arm/mach-omap1/board-ams-delta.c
arch/arm/mach-omap1/board-fsample.c
arch/arm/mach-omap1/board-generic.c
arch/arm/mach-omap1/board-h2.c
arch/arm/mach-omap1/board-h3.c
arch/arm/mach-omap1/board-innovator.c
arch/arm/mach-omap1/board-nokia770.c
arch/arm/mach-omap1/board-osk.c
arch/arm/mach-omap1/board-palmte.c
arch/arm/mach-omap1/board-palmtt.c
arch/arm/mach-omap1/board-palmz71.c
arch/arm/mach-omap1/board-perseus2.c
arch/arm/mach-omap1/board-sx1.c
arch/arm/mach-omap1/board-voiceblue.c
arch/arm/mach-omap2/board-2430sdp.c
arch/arm/mach-omap2/board-apollon.c
arch/arm/mach-omap2/board-generic.c
arch/arm/mach-omap2/board-h4.c
arch/arm/mach-omap2/devices.c
arch/arm/plat-omap/devices.c

index c73ca61e585ef6f49385e8fc377a7a6974e12082..fc38f0391edf384f06a72bcd884c76d8046c9fe5 100644 (file)
@@ -227,6 +227,7 @@ static void __init ams_delta_init(void)
        omap_board_config = ams_delta_config;
        omap_board_config_size = ARRAY_SIZE(ams_delta_config);
        omap_serial_init();
+       omap_register_i2c_bus(1, 100, NULL, 0);
 
        /* Clear latch2 (NAND, LCD, modem enable) */
        ams_delta_latch2_write(~0, 0);
index d5f6ea14fc7bdf241cbc9f26568d0abc3ac57e03..eaf9ef5a06af4df6cddff6eaa570677315078a26 100644 (file)
@@ -233,6 +233,7 @@ static void __init omap_fsample_init(void)
        omap_board_config = fsample_config;
        omap_board_config_size = ARRAY_SIZE(fsample_config);
        omap_serial_init();
+       omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
 static void __init fsample_init_smc91x(void)
index 4b35f1676f45dadf9649d22a7d1493662f992545..54a430fd90d700c16a6753b2d8a53b5a70c5059d 100644 (file)
@@ -100,6 +100,7 @@ static void __init omap_generic_init(void)
        omap_board_config = generic_config;
        omap_board_config_size = ARRAY_SIZE(generic_config);
        omap_serial_init();
+       omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
 static void __init omap_generic_map_io(void)
index d2214ad30a3b5e6b2632776dfbd24e5a39e1cb44..722c5a46a983358bf35573d45a9b0ed742c3b1f1 100644 (file)
@@ -530,6 +530,7 @@ static void __init h2_init(void)
        omap_board_config = h2_config;
        omap_board_config_size = ARRAY_SIZE(h2_config);
        omap_serial_init();
+       omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
 static void __init h2_map_io(void)
index f6095f05742ef10123ffb6d401e6bea203af8ce2..5a26fb755535073c9f178fb5c0dfa1c47e037e71 100644 (file)
@@ -687,6 +687,7 @@ static void __init h3_init(void)
        omap_board_config = h3_config;
        omap_board_config_size = ARRAY_SIZE(h3_config);
        omap_serial_init();
+       omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
 static void __init h3_init_smc91x(void)
index 7e63a41e37c699838471a97ab52004f28bd1a71d..48c0c41182518c6edbc52c5ebf29af2b342a26d1 100644 (file)
@@ -411,6 +411,7 @@ static void __init innovator_init(void)
        omap_board_config = innovator_config;
        omap_board_config_size = ARRAY_SIZE(innovator_config);
        omap_serial_init();
+       omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
 static void __init innovator_map_io(void)
index df5bda2f44c12a6495dca0a800ebc5176c9c220e..da0b90f7d778a7448e6b3246cd2809856c9be92a 100644 (file)
@@ -373,6 +373,7 @@ static void __init omap_nokia770_init(void)
        omap_board_config_size = ARRAY_SIZE(nokia770_config);
        omap_gpio_init();
        omap_serial_init();
+       omap_register_i2c_bus(1, 100, NULL, 0);
        omap_dsp_init();
        hwa742_dev_init();
        ads7846_dev_init();
index 5fab8f46911ae9c9fb674cdc2debd0d3c5fa4913..7d2f21eeb0f9809cdd36751e50eeac1e5420aeca 100644 (file)
@@ -473,10 +473,9 @@ static void __init osk_init(void)
        if (gpio_request(OMAP_MPUIO(1), "tps65010") == 0)
                gpio_direction_input(OMAP_MPUIO(1));
 
-       i2c_register_board_info(1, osk_i2c_board_info,
-                       ARRAY_SIZE(osk_i2c_board_info));
-
        omap_serial_init();
+       omap_register_i2c_bus(1, 400, osk_i2c_board_info,
+                             ARRAY_SIZE(osk_i2c_board_info));
        osk_mistral_init();
 }
 
index e5e095772d075633e8826e16bebbff6471b35da6..ccd83cf0564cc3f2b8e93e1194bd9ff6e7a1ee2d 100644 (file)
@@ -416,6 +416,7 @@ static void __init omap_palmte_init(void)
 
        palmte_misc_gpio_setup();
        omap_serial_init();
+       omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
 static void __init omap_palmte_map_io(void)
index dd69e01533d8a5d30595b3cc83b62a39cec978e3..38c9ba95942fc6a1e25df6735bc444e4a904e868 100644 (file)
@@ -339,6 +339,7 @@ static void __init omap_palmtt_init(void)
 
        spi_register_board_info(palmtt_boardinfo,ARRAY_SIZE(palmtt_boardinfo));
        omap_serial_init();
+       omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
 static void __init omap_palmtt_map_io(void)
index 6b49c71b69f658f2ecaf2a3d4a9c384824d7fc9c..b2ed1cbd90f9da953240147ad602eec3cf35bb75 100644 (file)
@@ -364,6 +364,7 @@ omap_palmz71_init(void)
        spi_register_board_info(palmz71_boardinfo,
                                ARRAY_SIZE(palmz71_boardinfo));
        omap_serial_init();
+       omap_register_i2c_bus(1, 100, NULL, 0);
        palmz71_gpio_setup(0);
 }
 
index e9e352e2543ba1aadec8e3afe7752cf3aacba4f0..1b39b6bb6f6375ebb67ec24e55412006c6d86236 100644 (file)
@@ -233,6 +233,7 @@ static void __init omap_perseus2_init(void)
        omap_board_config = perseus2_config;
        omap_board_config_size = ARRAY_SIZE(perseus2_config);
        omap_serial_init();
+       omap_register_i2c_bus(1, 100, NULL, 0);
 }
 
 static void __init perseus2_init_smc91x(void)
index f25ec6f39fc4434ffead10421c92e27689052901..389d3fa1137b5240574aadec6f924fb6f27a8276 100644 (file)
@@ -439,6 +439,7 @@ static void __init omap_sx1_init(void)
        omap_board_config = sx1_config;
        omap_board_config_size = ARRAY_SIZE(sx1_config);
        omap_serial_init();
+       omap_register_i2c_bus(1, 100, NULL, 0);
 
        /* turn on USB power */
        /* sx1_setusbpower(1); cant do it here because i2c is not ready */
index 214dd19889aca953922e77d6fc49efbb33c4daca..04d9e8c3f047889f5d34188deb226933a51ff058 100644 (file)
@@ -198,6 +198,7 @@ static void __init voiceblue_init(void)
        omap_board_config = voiceblue_config;
        omap_board_config_size = ARRAY_SIZE(voiceblue_config);
        omap_serial_init();
+       omap_register_i2c_bus(1, 100, NULL, 0);
 
        /* There is a good chance board is going up, so enable power LED
         * (it is connected through invertor) */
index acfdf3ac3483aab3f70aa9d8a4289747b5790750..0886f51c80b6e99c07d4476ddb5216ce201806d7 100644 (file)
@@ -361,75 +361,10 @@ static struct omap_board_config_kernel sdp2430_config[] __initdata = {
        {OMAP_TAG_SERIAL_CONSOLE, &sdp2430_serial_console_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();
+       omap_register_i2c_bus(1, 400, NULL, 0);
+       omap_register_i2c_bus(2, 2600, NULL, 0);
        return 0;
 }
 
index ff8459c7c95058c5274b88929490759ca61e3492..1932d73463f55789ff967b90b0c3be466cb13238 100644 (file)
@@ -381,6 +381,8 @@ static void __init omap_apollon_init(void)
        omap_board_config = apollon_config;
        omap_board_config_size = ARRAY_SIZE(apollon_config);
        omap_serial_init();
+       omap_register_i2c_bus(1, 100, NULL, 0);
+       omap_register_i2c_bus(2, 100, NULL, 0);
 
        spi_register_board_info(apollon_spi_board_info,
                                ARRAY_SIZE(apollon_spi_board_info));
index d8da3c10a8c92d9e931e10c22c45deb827348526..4226464b465f8e5d2787fbeb431f5c738f65b0a7 100644 (file)
@@ -61,6 +61,8 @@ static void __init omap_generic_init(void)
        omap_board_config = generic_config;
        omap_board_config_size = ARRAY_SIZE(generic_config);
        omap_serial_init();
+       omap_register_i2c_bus(1, 100, NULL, 0);
+       omap_register_i2c_bus(2, 100, NULL, 0);
 }
 
 static void __init omap_generic_map_io(void)
index fc30021c0a324b9bca194176a3f7fdc3f4922182..85649bb157fa391e30aefb0f0b8d0fe85085a971 100644 (file)
@@ -701,13 +701,12 @@ static void __init omap_h4_init(void)
        /* Menelaus interrupt */
        omap_cfg_reg(W19_24XX_SYS_NIRQ);
 
-       i2c_register_board_info(1, h4_i2c_board_info,
-                       ARRAY_SIZE(h4_i2c_board_info));
-
        platform_add_devices(h4_devices, ARRAY_SIZE(h4_devices));
        omap_board_config = h4_config;
        omap_board_config_size = ARRAY_SIZE(h4_config);
        omap_serial_init();
+       omap_register_i2c_bus(1, 100, h4_i2c_board_info,
+                             ARRAY_SIZE(h4_i2c_board_info));
 
        /* smc91x, debug leds, ps/2, extra uarts */
        h4_init_debug();
index 376b49ff28f7891167e562e56fdbe372262dc08a..85bc01a248c32e36f3344cb023a0819051036c19 100644 (file)
@@ -56,55 +56,6 @@ static inline void omap_init_camera(void)
 }
 #endif
 
-#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,
-               .end            = OMAP2_I2C_BASE2 + 0x3f,
-               .flags          = IORESOURCE_MEM,
-       },
-       {
-               .start          = OMAP2_I2C_INT2,
-               .flags          = IORESOURCE_IRQ,
-       },
-};
-
-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,
-       },
-};
-
-/* See also arch/arm/plat-omap/devices.c for first I2C on 24xx */
-static void omap_init_i2c(void)
-{
-       /* REVISIT: Second I2C not in use on H4? */
-       if (machine_is_omap_h4())
-               return;
-
-       omap_cfg_reg(J15_24XX_I2C2_SCL);
-       omap_cfg_reg(H19_24XX_I2C2_SDA);
-
-       (void) platform_device_register(&omap_i2c_device2);
-}
-
-#else
-
-static void omap_init_i2c(void) {}
-
-#endif
-#endif
-
 #if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
 #define OMAP2_MBOX_BASE                IO_ADDRESS(OMAP24XX_MAILBOX_BASE)
 
@@ -278,9 +229,6 @@ static int __init omap2_init_devices(void)
         * in alphabetical order so they're easier to sort through.
         */
        omap_init_camera();
-       if (!cpu_is_omap2430()) {
-               omap_init_i2c();
-       }
        omap_init_mbox();
        omap_init_mcspi();
        omap_init_sti();
index 6b795ab24e3bfcb4c667941552286edce8462259..b84e7f8c18fb2fa685af661baafaa913ceaf235c 100644 (file)
@@ -88,76 +88,6 @@ EXPORT_SYMBOL(dsp_kfunc_device_register);
 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
-#define OMAP2_I2C_BASE1                0x48070000
-#define OMAP_I2C_SIZE          0x3f
-#define OMAP1_I2C_INT          INT_I2C
-#define OMAP2_I2C_INT1         56
-
-static u32 omap2_i2c1_clkrate  = 100;
-
-static struct resource i2c_resources1[] = {
-       {
-               .start          = 0,
-               .end            = 0,
-               .flags          = IORESOURCE_MEM,
-       },
-       {
-               .start          = 0,
-               .flags          = IORESOURCE_IRQ,
-       },
-};
-
-/* DMA not used; works around erratum writing to non-empty i2c fifo */
-
-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,
-       },
-};
-
-/* See also arch/arm/mach-omap2/devices.c for second I2C on 24xx */
-static void omap_init_i2c(void)
-{
-       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;
-       } else {
-               i2c_resources1[0].start = OMAP1_I2C_BASE;
-               i2c_resources1[0].end = OMAP1_I2C_BASE + OMAP_I2C_SIZE;
-               i2c_resources1[1].start = OMAP1_I2C_INT;
-       }
-
-       /* FIXME define and use a boot tag, in case of boards that
-        * either don't wire up I2C, or chips that mux it differently...
-        * it can include clocking and address info, maybe more.
-        */
-       if (cpu_class_is_omap2()) {
-               if (machine_is_omap_h4()) {
-                       omap_cfg_reg(M19_24XX_I2C1_SCL);
-                       omap_cfg_reg(L15_24XX_I2C1_SDA);
-               }
-       } else {
-               omap_cfg_reg(I2C_SCL);
-               omap_cfg_reg(I2C_SDA);
-       }
-
-       (void) platform_device_register(&omap_i2c_device1);
-}
-
-#else
-static inline void omap_init_i2c(void) {}
-#endif
-#endif
 /*-------------------------------------------------------------------------*/
 #if    defined(CONFIG_KEYBOARD_OMAP) || defined(CONFIG_KEYBOARD_OMAP_MODULE)
 
@@ -539,9 +469,6 @@ static int __init omap_init_devices(void)
        omap_init_uwire();
        omap_init_wdt();
        omap_init_rng();
-       if (!cpu_is_omap2430() && !cpu_is_omap34xx()) {
-               omap_init_i2c();
-       }
        return 0;
 }
 arch_initcall(omap_init_devices);