[ARM] S3C: Make i2c device definition common to plat-s3c
authorBen Dooks <ben-linux@fluff.org>
Fri, 31 Oct 2008 16:14:40 +0000 (16:14 +0000)
committerBen Dooks <ben-linux@fluff.org>
Mon, 15 Dec 2008 23:40:26 +0000 (23:40 +0000)
Make the device i2c0 common to plat-s3c and move the
definitions from arch/arm/plat-s3c24xx/devs.c

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
31 files changed:
arch/arm/mach-s3c2410/include/mach/map.h
arch/arm/mach-s3c2410/mach-amlm5900.c
arch/arm/mach-s3c2410/mach-bast.c
arch/arm/mach-s3c2410/mach-h1940.c
arch/arm/mach-s3c2410/mach-n30.c
arch/arm/mach-s3c2410/mach-otom.c
arch/arm/mach-s3c2410/mach-qt2410.c
arch/arm/mach-s3c2410/mach-smdk2410.c
arch/arm/mach-s3c2410/mach-tct_hammer.c
arch/arm/mach-s3c2410/mach-vr1000.c
arch/arm/mach-s3c2412/mach-jive.c
arch/arm/mach-s3c2412/mach-smdk2413.c
arch/arm/mach-s3c2412/mach-vstms.c
arch/arm/mach-s3c2440/mach-anubis.c
arch/arm/mach-s3c2440/mach-at2440evb.c
arch/arm/mach-s3c2440/mach-nexcoder.c
arch/arm/mach-s3c2440/mach-osiris.c
arch/arm/mach-s3c2440/mach-rx3715.c
arch/arm/mach-s3c2440/mach-smdk2440.c
arch/arm/mach-s3c2443/mach-smdk2443.c
arch/arm/mach-s3c24a0/include/mach/map.h
arch/arm/mach-s3c6400/include/mach/map.h
arch/arm/plat-s3c/Makefile
arch/arm/plat-s3c/dev-i2c0.c [new file with mode: 0644]
arch/arm/plat-s3c/include/plat/devs.h
arch/arm/plat-s3c/include/plat/iic.h
arch/arm/plat-s3c24xx/Makefile
arch/arm/plat-s3c24xx/devs.c
arch/arm/plat-s3c24xx/include/plat/map.h
arch/arm/plat-s3c24xx/s3c244x.c
arch/arm/plat-s3c24xx/setup-i2c.c [new file with mode: 0644]

index d5ae682..255fdfe 100644 (file)
@@ -92,7 +92,6 @@
 #define S3C24XX_PA_TIMER    S3C2410_PA_TIMER
 #define S3C24XX_PA_USBDEV   S3C2410_PA_USBDEV
 #define S3C24XX_PA_WATCHDOG S3C2410_PA_WATCHDOG
-#define S3C24XX_PA_IIC      S3C2410_PA_IIC
 #define S3C24XX_PA_IIS      S3C2410_PA_IIS
 #define S3C24XX_PA_GPIO     S3C2410_PA_GPIO
 #define S3C24XX_PA_RTC      S3C2410_PA_RTC
 #define S3C24XX_PA_SDI      S3C2410_PA_SDI
 #define S3C24XX_PA_NAND            S3C2410_PA_NAND
 
+#define S3C_PA_IIC          S3C2410_PA_IIC
 #define S3C_PA_UART        S3C24XX_PA_UART
 #define S3C_PA_HSMMC0      S3C2443_PA_HSMMC
 
index d061fea..6d6995a 100644 (file)
@@ -52,6 +52,7 @@
 #include <mach/regs-lcd.h>
 #include <mach/regs-gpio.h>
 
+#include <plat/iic.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
 
@@ -150,7 +151,7 @@ static struct platform_device *amlm5900_devices[] __initdata = {
 #endif
        &s3c_device_adc,
        &s3c_device_wdt,
-       &s3c_device_i2c,
+       &s3c_device_i2c0,
        &s3c_device_usb,
        &s3c_device_rtc,
        &s3c_device_usbgadget,
@@ -233,6 +234,7 @@ static void __init amlm5900_init(void)
 #ifdef CONFIG_FB_S3C2410
        s3c24xx_fb_set_platdata(&amlm5900_fb_info);
 #endif
+       s3c_i2c0_set_platdata(NULL);
        platform_add_devices(amlm5900_devices, ARRAY_SIZE(amlm5900_devices));
 }
 
index c04c244..01bd767 100644 (file)
@@ -406,7 +406,7 @@ static struct platform_device bast_sio = {
  * standard 100KHz i2c bus frequency
 */
 
-static struct s3c2410_platform_i2c bast_i2c_info = {
+static struct s3c2410_platform_i2c __initdata bast_i2c_info = {
        .flags          = 0,
        .slave_addr     = 0x10,
        .bus_freq       = 100*1000,
@@ -553,7 +553,7 @@ static struct platform_device *bast_devices[] __initdata = {
        &s3c_device_usb,
        &s3c_device_lcd,
        &s3c_device_wdt,
-       &s3c_device_i2c,
+       &s3c_device_i2c0,
        &s3c_device_rtc,
        &s3c_device_nand,
        &bast_device_dm9k,
@@ -588,7 +588,8 @@ static void __init bast_map_io(void)
        s3c24xx_register_clocks(bast_clocks, ARRAY_SIZE(bast_clocks));
 
        s3c_device_nand.dev.platform_data = &bast_nand_info;
-       s3c_device_i2c.dev.platform_data = &bast_i2c_info;
+
+       s3c_i2c0_set_platdata(&bast_i2c_info);
 
        s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
        s3c24xx_init_clocks(0);
index 836508b..821a166 100644 (file)
@@ -39,6 +39,7 @@
 #include <mach/h1940-latch.h>
 #include <mach/fb.h>
 #include <plat/udc.h>
+#include <plat/iic.h>
 
 #include <plat/clock.h>
 #include <plat/devs.h>
@@ -184,7 +185,7 @@ static struct platform_device *h1940_devices[] __initdata = {
        &s3c_device_usb,
        &s3c_device_lcd,
        &s3c_device_wdt,
-       &s3c_device_i2c,
+       &s3c_device_i2c0,
        &s3c_device_iis,
        &s3c_device_usbgadget,
        &s3c_device_leds,
@@ -216,6 +217,7 @@ static void __init h1940_init(void)
 
        s3c24xx_fb_set_platdata(&h1940_fb_info);
        s3c24xx_udc_set_platdata(&h1940_udc_cfg);
+       s3c_i2c0_set_platdata(NULL);
 
        /* Turn off suspend on both USB ports, and switch the
         * selectable USB port to USB device mode. */
index 7a7c45d..1269e59 100644 (file)
@@ -320,7 +320,7 @@ static struct s3c2410fb_mach_info n30_fb_info __initdata = {
 static struct platform_device *n30_devices[] __initdata = {
        &s3c_device_lcd,
        &s3c_device_wdt,
-       &s3c_device_i2c,
+       &s3c_device_i2c0,
        &s3c_device_iis,
        &s3c_device_usb,
        &s3c_device_usbgadget,
@@ -332,7 +332,7 @@ static struct platform_device *n30_devices[] __initdata = {
 static struct platform_device *n35_devices[] __initdata = {
        &s3c_device_lcd,
        &s3c_device_wdt,
-       &s3c_device_i2c,
+       &s3c_device_i2c0,
        &s3c_device_iis,
        &s3c_device_usbgadget,
        &n35_button_device,
@@ -501,7 +501,7 @@ static void __init n30_init_irq(void)
 static void __init n30_init(void)
 {
        s3c24xx_fb_set_platdata(&n30_fb_info);
-       s3c_device_i2c.dev.platform_data = &n30_i2ccfg;
+       s3c_device_i2c0.dev.platform_data = &n30_i2ccfg;
        s3c24xx_udc_set_platdata(&n30_udc_cfg);
 
        /* Turn off suspend on both USB ports, and switch the
index d8255cf..f6c7261 100644 (file)
@@ -35,6 +35,7 @@
 #include <plat/s3c2410.h>
 #include <plat/clock.h>
 #include <plat/devs.h>
+#include <plat/iic.h>
 #include <plat/cpu.h>
 
 static struct map_desc otom11_iodesc[] __initdata = {
@@ -94,7 +95,7 @@ static struct platform_device *otom11_devices[] __initdata = {
        &s3c_device_usb,
        &s3c_device_lcd,
        &s3c_device_wdt,
-       &s3c_device_i2c,
+       &s3c_device_i2c0,
        &s3c_device_iis,
        &s3c_device_rtc,
        &otom_device_nor,
@@ -109,6 +110,7 @@ static void __init otom11_map_io(void)
 
 static void __init otom11_init(void)
 {
+       s3c_i2c0_set_platdata(NULL);
        platform_add_devices(otom11_devices, ARRAY_SIZE(otom11_devices));
 }
 
index ef86847..9678a53 100644 (file)
@@ -54,6 +54,7 @@
 #include <plat/udc.h>
 #include <mach/spi.h>
 #include <mach/spi-gpio.h>
+#include <plat/iic.h>
 
 #include <plat/common-smdk.h>
 #include <plat/devs.h>
@@ -247,7 +248,7 @@ static struct platform_device *qt2410_devices[] __initdata = {
        &s3c_device_usb,
        &s3c_device_lcd,
        &s3c_device_wdt,
-       &s3c_device_i2c,
+       &s3c_device_i2c0,
        &s3c_device_iis,
        &s3c_device_sdi,
        &s3c_device_usbgadget,
@@ -349,6 +350,7 @@ static void __init qt2410_machine_init(void)
        s3c2410_gpio_setpin(S3C2410_GPB0, 1);
 
        s3c24xx_udc_set_platdata(&qt2410_udc_cfg);
+       s3c_i2c0_set_platdata(NULL);
 
        s3c2410_gpio_cfgpin(S3C2410_GPB5, S3C2410_GPIO_OUTPUT);
 
index 152527b..c49126c 100644 (file)
@@ -47,6 +47,7 @@
 #include <asm/mach-types.h>
 
 #include <plat/regs-serial.h>
+#include <plat/iic.h>
 
 #include <plat/devs.h>
 #include <plat/cpu.h>
@@ -89,7 +90,7 @@ static struct platform_device *smdk2410_devices[] __initdata = {
        &s3c_device_usb,
        &s3c_device_lcd,
        &s3c_device_wdt,
-       &s3c_device_i2c,
+       &s3c_device_i2c0,
        &s3c_device_iis,
 };
 
@@ -102,6 +103,7 @@ static void __init smdk2410_map_io(void)
 
 static void __init smdk2410_init(void)
 {
+       s3c_i2c0_set_platdata(NULL);
        platform_add_devices(smdk2410_devices, ARRAY_SIZE(smdk2410_devices));
        smdk_machine_init();
 }
index 309dcf4..8fdb043 100644 (file)
@@ -45,6 +45,7 @@
 #include <asm/mach-types.h>
 
 #include <plat/regs-serial.h>
+#include <plat/iic.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
 
@@ -127,7 +128,7 @@ static struct s3c2410_uartcfg tct_hammer_uartcfgs[] = {
 static struct platform_device *tct_hammer_devices[] __initdata = {
        &s3c_device_adc,
        &s3c_device_wdt,
-       &s3c_device_i2c,
+       &s3c_device_i2c0,
        &s3c_device_usb,
        &s3c_device_rtc,
        &s3c_device_usbgadget,
@@ -146,6 +147,7 @@ static void __init tct_hammer_map_io(void)
 
 static void __init tct_hammer_init(void)
 {
+       s3c_i2c0_set_platdata(NULL);
        platform_add_devices(tct_hammer_devices, ARRAY_SIZE(tct_hammer_devices));
 }
 
index 941353a..61a1ea9 100644 (file)
@@ -47,6 +47,7 @@
 #include <plat/clock.h>
 #include <plat/devs.h>
 #include <plat/cpu.h>
+#include <plat/iic.h>
 
 #include "usb-simtec.h"
 #include "nor-simtec.h"
@@ -334,7 +335,7 @@ static struct platform_device *vr1000_devices[] __initdata = {
        &s3c_device_usb,
        &s3c_device_lcd,
        &s3c_device_wdt,
-       &s3c_device_i2c,
+       &s3c_device_i2c0,
        &s3c_device_adc,
        &serial_device,
        &vr1000_dm9k0,
@@ -384,6 +385,7 @@ static void __init vr1000_map_io(void)
 
 static void __init vr1000_init(void)
 {
+       s3c_i2c0_set_platdata(NULL);
        platform_add_devices(vr1000_devices, ARRAY_SIZE(vr1000_devices));
 
        i2c_register_board_info(0, vr1000_i2c_devs,
index 25ff1ec..e08a0f0 100644 (file)
@@ -53,6 +53,7 @@
 #include <plat/cpu.h>
 #include <plat/pm.h>
 #include <plat/udc.h>
+#include <plat/iic.h>
 
 static struct map_desc jive_iodesc[] __initdata = {
 };
@@ -450,14 +451,14 @@ static struct spi_board_info __initdata jive_spi_devs[] = {
 
 /* I2C bus and device configuration. */
 
-static struct s3c2410_platform_i2c jive_i2c_cfg = {
+static struct s3c2410_platform_i2c jive_i2c_cfg __initdata = {
        .max_freq       = 80 * 1000,
        .bus_freq       = 50 * 1000,
        .flags          = S3C_IICFLG_FILTER,
        .sda_delay      = 2,
 };
 
-static struct i2c_board_info jive_i2c_devs[] = {
+static struct i2c_board_info jive_i2c_devs[] __initdata = {
        [0] = {
                I2C_BOARD_INFO("lis302dl", 0x1c),
                .irq    = IRQ_EINT14,
@@ -470,7 +471,7 @@ static struct platform_device *jive_devices[] __initdata = {
        &s3c_device_usb,
        &s3c_device_rtc,
        &s3c_device_wdt,
-       &s3c_device_i2c,
+       &s3c_device_i2c0,
        &s3c_device_lcd,
        &jive_device_lcdspi,
        &jive_device_wm8750,
@@ -663,7 +664,7 @@ static void __init jive_machine_init(void)
 
        spi_register_board_info(jive_spi_devs, ARRAY_SIZE(jive_spi_devs));
 
-       s3c_device_i2c.dev.platform_data = &jive_i2c_cfg;
+       s3c_i2c0_set_platdata(&jive_i2c_cfg);
        i2c_register_board_info(0, jive_i2c_devs, ARRAY_SIZE(jive_i2c_devs));
 
        pm_power_off = jive_power_off;
index 8fd17b8..eba66aa 100644 (file)
@@ -38,6 +38,7 @@
 
 #include <mach/idle.h>
 #include <plat/udc.h>
+#include <plat/iic.h>
 #include <mach/fb.h>
 
 #include <plat/s3c2410.h>
@@ -105,7 +106,7 @@ static struct platform_device *smdk2413_devices[] __initdata = {
        &s3c_device_usb,
        //&s3c_device_lcd,
        &s3c_device_wdt,
-       &s3c_device_i2c,
+       &s3c_device_i2c0,
        &s3c_device_iis,
        &s3c_device_usbgadget,
 };
@@ -142,6 +143,7 @@ static void __init smdk2413_machine_init(void)
 
 
        s3c24xx_udc_set_platdata(&smdk2413_udc_cfg);
+       s3c_i2c0_set_platdata(NULL);
 
        platform_add_devices(smdk2413_devices, ARRAY_SIZE(smdk2413_devices));
        smdk_machine_init();
index da32a6c..11e8ad4 100644 (file)
@@ -39,6 +39,7 @@
 #include <mach/idle.h>
 #include <mach/fb.h>
 
+#include <plat/iic.h>
 #include <plat/nand.h>
 
 #include <plat/s3c2410.h>
@@ -122,7 +123,7 @@ static struct s3c2410_platform_nand vstms_nand_info = {
 static struct platform_device *vstms_devices[] __initdata = {
        &s3c_device_usb,
        &s3c_device_wdt,
-       &s3c_device_i2c,
+       &s3c_device_i2c0,
        &s3c_device_iis,
        &s3c_device_rtc,
        &s3c_device_nand,
@@ -151,6 +152,7 @@ static void __init vstms_map_io(void)
 
 static void __init vstms_init(void)
 {
+       s3c_i2c0_set_platdata(NULL);
        platform_add_devices(vstms_devices, ARRAY_SIZE(vstms_devices));
 }
 
index 334379b..a9bbc41 100644 (file)
@@ -40,6 +40,7 @@
 #include <mach/regs-mem.h>
 #include <mach/regs-lcd.h>
 #include <plat/nand.h>
+#include <plat/iic.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
@@ -404,7 +405,7 @@ static struct platform_device *anubis_devices[] __initdata = {
        &s3c_device_usb,
        &s3c_device_wdt,
        &s3c_device_adc,
-       &s3c_device_i2c,
+       &s3c_device_i2c0,
        &s3c_device_rtc,
        &s3c_device_nand,
        &anubis_device_ide0,
@@ -468,6 +469,7 @@ static void __init anubis_map_io(void)
 
 static void __init anubis_init(void)
 {
+       s3c_i2c0_set_platdata(NULL);
        platform_add_devices(anubis_devices, ARRAY_SIZE(anubis_devices));
 
        i2c_register_board_info(0, anubis_i2c_devs,
index 07b42a0..55e07ae 100644 (file)
@@ -36,6 +36,7 @@
 #include <mach/regs-mem.h>
 #include <mach/regs-lcd.h>
 #include <plat/nand.h>
+#include <plat/iic.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
@@ -166,7 +167,7 @@ static struct platform_device *at2440evb_devices[] __initdata = {
        &s3c_device_usb,
        &s3c_device_wdt,
        &s3c_device_adc,
-       &s3c_device_i2c,
+       &s3c_device_i2c0,
        &s3c_device_rtc,
        &s3c_device_nand,
        &at2440evb_device_eth,
@@ -183,6 +184,7 @@ static void __init at2440evb_map_io(void)
 
 static void __init at2440evb_init(void)
 {
+       s3c_i2c0_set_platdata(NULL);
        platform_add_devices(at2440evb_devices, ARRAY_SIZE(at2440evb_devices));
 }
 
index a546307..7aeaa97 100644 (file)
@@ -37,6 +37,7 @@
 //#include <asm/debug-ll.h>
 #include <mach/regs-gpio.h>
 #include <plat/regs-serial.h>
+#include <plat/iic.h>
 
 #include <plat/s3c2410.h>
 #include <plat/s3c2440.h>
@@ -107,7 +108,7 @@ static struct platform_device *nexcoder_devices[] __initdata = {
        &s3c_device_usb,
        &s3c_device_lcd,
        &s3c_device_wdt,
-       &s3c_device_i2c,
+       &s3c_device_i2c0,
        &s3c_device_iis,
        &s3c_device_rtc,
        &s3c_device_camif,
@@ -142,6 +143,7 @@ static void __init nexcoder_map_io(void)
 
 static void __init nexcoder_init(void)
 {
+       s3c_i2c0_set_platdata(NULL);
        platform_add_devices(nexcoder_devices, ARRAY_SIZE(nexcoder_devices));
 };
 
index 884a3c7..41a00f5 100644 (file)
@@ -38,6 +38,7 @@
 #include <mach/regs-mem.h>
 #include <mach/regs-lcd.h>
 #include <plat/nand.h>
+#include <plat/iic.h>
 
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/nand.h>
@@ -335,7 +336,7 @@ static struct i2c_board_info osiris_i2c_devs[] __initdata = {
 /* Standard Osiris devices */
 
 static struct platform_device *osiris_devices[] __initdata = {
-       &s3c_device_i2c,
+       &s3c_device_i2c0,
        &s3c_device_wdt,
        &s3c_device_nand,
        &osiris_pcmcia,
@@ -398,6 +399,8 @@ static void __init osiris_init(void)
        sysdev_class_register(&osiris_pm_sysclass);
        sysdev_register(&osiris_pm_sysdev);
 
+       s3c_i2c0_set_platdata(NULL);
+
        i2c_register_board_info(0, osiris_i2c_devs,
                                ARRAY_SIZE(osiris_i2c_devs));
 
index fbd081d..12d378f 100644 (file)
@@ -179,7 +179,7 @@ static struct platform_device *rx3715_devices[] __initdata = {
        &s3c_device_usb,
        &s3c_device_lcd,
        &s3c_device_wdt,
-       &s3c_device_i2c,
+       &s3c_device_i2c0,
        &s3c_device_iis,
        &s3c_device_nand,
 };
index fefeaaa..db6eafb 100644 (file)
@@ -37,6 +37,7 @@
 
 #include <mach/idle.h>
 #include <mach/fb.h>
+#include <plat/iic.h>
 
 #include <plat/s3c2410.h>
 #include <plat/s3c2440.h>
@@ -152,7 +153,7 @@ static struct platform_device *smdk2440_devices[] __initdata = {
        &s3c_device_usb,
        &s3c_device_lcd,
        &s3c_device_wdt,
-       &s3c_device_i2c,
+       &s3c_device_i2c0,
        &s3c_device_iis,
 };
 
@@ -166,6 +167,7 @@ static void __init smdk2440_map_io(void)
 static void __init smdk2440_machine_init(void)
 {
        s3c24xx_fb_set_platdata(&smdk2440_fb_info);
+       s3c_i2c0_set_platdata(NULL);
 
        platform_add_devices(smdk2440_devices, ARRAY_SIZE(smdk2440_devices));
        smdk_machine_init();
index 815a3bd..039a462 100644 (file)
@@ -37,6 +37,7 @@
 
 #include <mach/idle.h>
 #include <mach/fb.h>
+#include <plat/iic.h>
 
 #include <plat/s3c2410.h>
 #include <plat/s3c2440.h>
@@ -103,7 +104,7 @@ static struct s3c2410_uartcfg smdk2443_uartcfgs[] __initdata = {
 
 static struct platform_device *smdk2443_devices[] __initdata = {
        &s3c_device_wdt,
-       &s3c_device_i2c,
+       &s3c_device_i2c0,
        &s3c_device_hsmmc0,
 };
 
@@ -116,6 +117,7 @@ static void __init smdk2443_map_io(void)
 
 static void __init smdk2443_machine_init(void)
 {
+       s3c_i2c0_set_platdata(NULL);
        platform_add_devices(smdk2443_devices, ARRAY_SIZE(smdk2443_devices));
        smdk_machine_init();
 }
index 6667355..a011327 100644 (file)
@@ -71,7 +71,6 @@
 #define S3C24XX_PA_TIMER       S3C24A0_PA_TIMER
 #define S3C24XX_PA_USBDEV      S3C24A0_PA_USBDEV
 #define S3C24XX_PA_WATCHDOG    S3C24A0_PA_WATCHDOG
-#define S3C24XX_PA_IIC         S3C24A0_PA_IIC
 #define S3C24XX_PA_IIS         S3C24A0_PA_IIS
 #define S3C24XX_PA_GPIO                S3C24A0_PA_GPIO
 #define S3C24XX_PA_RTC         S3C24A0_PA_RTC
@@ -81,5 +80,6 @@
 #define S3C24XX_PA_NAND                S3C24A0_PA_NAND
 
 #define S3C_PA_UART            S3C24A0_PA_UART
+#define S3C_PA_IIC             S3C24A0_PA_IIC
 
 #endif /* __ASM_ARCH_24A0_MAP_H */
index aadaaaf..f0d6fa6 100644 (file)
@@ -40,6 +40,7 @@
 
 #define S3C64XX_PA_SYSCON      (0x7E00F000)
 #define S3C64XX_PA_TIMER       (0x7F006000)
+#define S3C64XX_PA_IIC0                (0x7F004000)
 
 #define S3C64XX_PA_GPIO                (0x7F008000)
 #define S3C64XX_VA_GPIO                S3C_ADDR(0x00500000)
@@ -58,5 +59,6 @@
 #define S3C_PA_HSMMC0          S3C64XX_PA_HSMMC0
 #define S3C_PA_HSMMC1          S3C64XX_PA_HSMMC1
 #define S3C_PA_HSMMC2          S3C64XX_PA_HSMMC2
+#define S3C_PA_IIC             S3C64XX_PA_IIC0
 
 #endif /* __ASM_ARCH_6400_MAP_H */
index 3f6544a..187fa95 100644 (file)
@@ -22,3 +22,4 @@ obj-y                         += gpio-config.o
 
 obj-$(CONFIG_S3C_DEV_HSMMC)    += dev-hsmmc.o
 obj-$(CONFIG_S3C_DEV_HSMMC1)   += dev-hsmmc1.o
+obj-y                          += dev-i2c0.o
diff --git a/arch/arm/plat-s3c/dev-i2c0.c b/arch/arm/plat-s3c/dev-i2c0.c
new file mode 100644 (file)
index 0000000..21870fd
--- /dev/null
@@ -0,0 +1,67 @@
+/* linux/arch/arm/plat-s3c/dev-i2c0.c
+ *
+ * Copyright 2008 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *     http://armlinux.simtec.co.uk/
+ *
+ * S3C series device definition for i2c device 0
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/platform_device.h>
+
+#include <mach/map.h>
+
+#include <plat/regs-iic.h>
+#include <plat/iic.h>
+#include <plat/devs.h>
+#include <plat/cpu.h>
+
+static struct resource s3c_i2c_resource[] = {
+       [0] = {
+               .start = S3C_PA_IIC,
+               .end   = S3C_PA_IIC + SZ_4K - 1,
+               .flags = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start = IRQ_IIC,
+               .end   = IRQ_IIC,
+               .flags = IORESOURCE_IRQ,
+       },
+};
+
+struct platform_device s3c_device_i2c0 = {
+       .name             = "s3c2410-i2c",
+       .id               = -1,
+       .num_resources    = ARRAY_SIZE(s3c_i2c_resource),
+       .resource         = s3c_i2c_resource,
+};
+
+struct s3c2410_platform_i2c default_i2c_data __initdata = {
+       .flags          = 0,
+       .slave_addr     = 0x10,
+       .bus_freq       = 100*1000,
+       .max_freq       = 400*1000,
+       .sda_delay      = S3C2410_IICLC_SDA_DELAY5 | S3C2410_IICLC_FILTER_ON,
+};
+
+void __init s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *pd)
+{
+       struct s3c2410_platform_i2c *npd;
+
+       if (!pd)
+               pd = &default_i2c_data;
+
+       npd = kmemdup(pd, sizeof(struct s3c2410_platform_i2c), GFP_KERNEL);
+       if (!npd)
+               printk(KERN_ERR "%s: no memory for platform data\n", __func__);
+       else if (!npd->cfg_gpio)
+               npd->cfg_gpio = s3c_i2c0_cfg_gpio;
+
+       s3c_device_i2c0.dev.platform_data = npd;
+}
index f173863..d9e0c54 100644 (file)
@@ -27,7 +27,7 @@ extern struct platform_device s3c_device_timer[];
 extern struct platform_device s3c_device_usb;
 extern struct platform_device s3c_device_lcd;
 extern struct platform_device s3c_device_wdt;
-extern struct platform_device s3c_device_i2c;
+extern struct platform_device s3c_device_i2c0;
 extern struct platform_device s3c_device_iis;
 extern struct platform_device s3c_device_rtc;
 extern struct platform_device s3c_device_adc;
index 5106aca..5073b1e 100644 (file)
@@ -28,6 +28,28 @@ struct s3c2410_platform_i2c {
        unsigned long   max_freq;       /* max frequency for the bus */
        unsigned long   min_freq;       /* min frequency for the bus */
        unsigned int    sda_delay;      /* pclks (s3c2440 only) */
+
+       void    (*cfg_gpio)(struct platform_device *dev);
 };
 
+/**
+ * s3c_i2c0_set_platdata - set platform data for i2c0 device
+ * @i2c: The platform data to set, or NULL for default data.
+ *
+ * Register the given platform data for use with the i2c0 device. This
+ * call copies the platform data, so the caller can use __initdata for
+ * their copy.
+ *
+ * This call will set cfg_gpio if is null to the default platform
+ * implementation.
+ *
+ * Any user of s3c_device_i2c0 should call this, even if it is with
+ * NULL to ensure that the device is given the default platform data
+ * as the driver will no longer carry defaults.
+ */
+extern void s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *i2c);
+
+/* defined by architecture to configure gpio */
+extern void s3c_i2c0_cfg_gpio(struct platform_device *dev);
+
 #endif /* __ASM_ARCH_IIC_H */
index 2a65ba7..763d344 100644 (file)
@@ -32,6 +32,9 @@ obj-$(CONFIG_HAVE_PWM)                += pwm.o
 obj-$(CONFIG_S3C2410_CLOCK)    += s3c2410-clock.o
 obj-$(CONFIG_S3C2410_DMA)      += dma.o
 
+# device specific setup and/or initialisation
+obj-$(CONFIG_ARCH_S3C2410)     += setup-i2c.o
+
 # SPI gpio central GPIO functions
 
 obj-$(CONFIG_S3C24XX_SPI_BUS0_GPE11_GPE12_GPE13) += spi-bus0-gpe11_12_13.o
index 3a2fcd9..3cb07b6 100644 (file)
@@ -271,31 +271,6 @@ struct platform_device s3c_device_wdt = {
 
 EXPORT_SYMBOL(s3c_device_wdt);
 
-/* I2C */
-
-static struct resource s3c_i2c_resource[] = {
-       [0] = {
-               .start = S3C24XX_PA_IIC,
-               .end   = S3C24XX_PA_IIC + S3C24XX_SZ_IIC - 1,
-               .flags = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start = IRQ_IIC,
-               .end   = IRQ_IIC,
-               .flags = IORESOURCE_IRQ,
-       }
-
-};
-
-struct platform_device s3c_device_i2c = {
-       .name             = "s3c2410-i2c",
-       .id               = -1,
-       .num_resources    = ARRAY_SIZE(s3c_i2c_resource),
-       .resource         = s3c_i2c_resource,
-};
-
-EXPORT_SYMBOL(s3c_device_i2c);
-
 /* IIS */
 
 static struct resource s3c_iis_resource[] = {
index e7be0c0..fef8ea8 100644 (file)
@@ -51,7 +51,6 @@
 
 /* Standard size definitions for peripheral blocks. */
 
-#define S3C24XX_SZ_IIC         SZ_1M
 #define S3C24XX_SZ_IIS         SZ_1M
 #define S3C24XX_SZ_ADC         SZ_1M
 #define S3C24XX_SZ_SPI         SZ_1M
index 4943684..c1de6bb 100644 (file)
@@ -68,7 +68,7 @@ void __init s3c244x_map_io(void)
        /* rename any peripherals used differing from the s3c2410 */
 
        s3c_device_sdi.name  = "s3c2440-sdi";
-       s3c_device_i2c.name  = "s3c2440-i2c";
+       s3c_device_i2c0.name  = "s3c2440-i2c";
        s3c_device_nand.name = "s3c2440-nand";
        s3c_device_usbgadget.name = "s3c2440-usbgadget";
 }
diff --git a/arch/arm/plat-s3c24xx/setup-i2c.c b/arch/arm/plat-s3c24xx/setup-i2c.c
new file mode 100644 (file)
index 0000000..d62b7e7
--- /dev/null
@@ -0,0 +1,25 @@
+/* linux/arch/arm/plat-s3c24xx/setup-i2c.c
+ *
+ * Copyright 2008 Simtec Electronics
+ *     Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C24XX Base setup for i2c device
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include <linux/kernel.h>
+
+struct platform_device;
+
+#include <plat/iic.h>
+#include <mach/hardware.h>
+#include <mach/regs-gpio.h>
+
+void s3c_i2c0_cfg_gpio(struct platform_device *dev)
+{
+       s3c2410_gpio_cfgpin(S3C2410_GPE15, S3C2410_GPE15_IICSDA);
+       s3c2410_gpio_cfgpin(S3C2410_GPE14, S3C2410_GPE14_IICSCL);
+}