ARM: Merge next-s3c24xx-dev-rtp
authorBen Dooks <ben-linux@fluff.org>
Thu, 3 Dec 2009 21:33:01 +0000 (21:33 +0000)
committerBen Dooks <ben-linux@fluff.org>
Thu, 3 Dec 2009 21:33:01 +0000 (21:33 +0000)
Merge branch 'next-s3c24xx-dev-rtp' into for-rmk

Conflicts:

arch/arm/mach-s3c2440/mach-anubis.c

19 files changed:
arch/arm/mach-s3c2410/Kconfig
arch/arm/mach-s3c2410/Makefile
arch/arm/mach-s3c2410/h1940-bluetooth.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-qt2410.c
arch/arm/mach-s3c2412/mach-jive.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-mini2440.c
arch/arm/mach-s3c2440/mach-osiris.c
arch/arm/mach-s3c2440/mach-rx3715.c
arch/arm/mach-s3c2442/mach-gta02.c
arch/arm/mach-s3c6410/mach-hmt.c
arch/arm/plat-s3c/dev-nand.c
arch/arm/plat-s3c/include/plat/nand.h
arch/arm/plat-s3c24xx/common-smdk.c

index 3d4e9da3fa52bb055b1a550961c2b20057c68ae1..dd1fcc7e67086eb01ac05230bb414a37049bc91c 100644 (file)
@@ -81,6 +81,14 @@ config ARCH_H1940
        help
          Say Y here if you are using the HP IPAQ H1940
 
+config H1940BT
+        tristate "Control the state of H1940 bluetooth chip"
+        depends on ARCH_H1940
+        select RFKILL
+        help
+          This is a simple driver that is able to control
+          the state of built in bluetooth chip on h1940.
+
 config PM_H1940
        bool
        help
index 2ab5ba4b266fa0eea87929f9ae727692176f02c5..0d468e96e83ef399b40f094f8304a1735e84957f 100644 (file)
@@ -21,7 +21,8 @@ obj-$(CONFIG_S3C2410_PLLTABLE)        += pll.o
 # Machine support
 
 obj-$(CONFIG_ARCH_SMDK2410)    += mach-smdk2410.o
-obj-$(CONFIG_ARCH_H1940)       += mach-h1940.o h1940-bluetooth.o
+obj-$(CONFIG_ARCH_H1940)       += mach-h1940.o
+obj-$(CONFIG_H1940BT)          += h1940-bluetooth.o
 obj-$(CONFIG_PM_H1940)         += pm-h1940.o
 obj-$(CONFIG_MACH_N30)         += mach-n30.o
 obj-$(CONFIG_ARCH_BAST)                += mach-bast.o usb-simtec.o
index 5aabf117cbb01742fac3e340374c471e2fb60755..b7d1f8d27bc28b5c807508fe0389095a0248fd68 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/ctype.h>
 #include <linux/leds.h>
 #include <linux/gpio.h>
+#include <linux/rfkill.h>
 
 #include <mach/regs-gpio.h>
 #include <mach/hardware.h>
 
 #define DRV_NAME              "h1940-bt"
 
-#ifdef CONFIG_LEDS_H1940
-DEFINE_LED_TRIGGER(bt_led_trigger);
-#endif
-
-static int state;
-
 /* Bluetooth control */
 static void h1940bt_enable(int on)
 {
        if (on) {
-#ifdef CONFIG_LEDS_H1940
-               /* flashing Blue */
-               led_trigger_event(bt_led_trigger, LED_HALF);
-#endif
-
                /* Power on the chip */
                h1940_latch_control(0, H1940_LATCH_BLUETOOTH_POWER);
                /* Reset the chip */
@@ -46,48 +36,31 @@ static void h1940bt_enable(int on)
                s3c2410_gpio_setpin(S3C2410_GPH(1), 1);
                mdelay(10);
                s3c2410_gpio_setpin(S3C2410_GPH(1), 0);
-
-               state = 1;
        }
        else {
-#ifdef CONFIG_LEDS_H1940
-               led_trigger_event(bt_led_trigger, 0);
-#endif
-
                s3c2410_gpio_setpin(S3C2410_GPH(1), 1);
                mdelay(10);
                s3c2410_gpio_setpin(S3C2410_GPH(1), 0);
                mdelay(10);
                h1940_latch_control(H1940_LATCH_BLUETOOTH_POWER, 0);
-
-               state = 0;
        }
 }
 
-static ssize_t h1940bt_show(struct device *dev, struct device_attribute *attr, char *buf)
+static int h1940bt_set_block(void *data, bool blocked)
 {
-       return snprintf(buf, PAGE_SIZE, "%d\n", state);
+       h1940bt_enable(!blocked);
+       return 0;
 }
 
-static ssize_t h1940bt_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
-{
-       int new_state;
-       char *endp;
-
-       new_state = simple_strtoul(buf, &endp, 0);
-       if (*endp && !isspace(*endp))
-               return -EINVAL;
-
-       h1940bt_enable(new_state);
-
-       return count;
-}
-static DEVICE_ATTR(enable, 0644,
-               h1940bt_show,
-               h1940bt_store);
+static const struct rfkill_ops h1940bt_rfkill_ops = {
+       .set_block = h1940bt_set_block,
+};
 
 static int __init h1940bt_probe(struct platform_device *pdev)
 {
+       struct rfkill *rfk;
+       int ret = 0;
+
        /* Configures BT serial port GPIOs */
        s3c2410_gpio_cfgpin(S3C2410_GPH(0), S3C2410_GPH0_nCTS0);
        s3c2410_gpio_pullup(S3C2410_GPH(0), 1);
@@ -98,21 +71,44 @@ static int __init h1940bt_probe(struct platform_device *pdev)
        s3c2410_gpio_cfgpin(S3C2410_GPH(3), S3C2410_GPH3_RXD0);
        s3c2410_gpio_pullup(S3C2410_GPH(3), 1);
 
-#ifdef CONFIG_LEDS_H1940
-       led_trigger_register_simple("h1940-bluetooth", &bt_led_trigger);
-#endif
 
-       /* disable BT by default */
-       h1940bt_enable(0);
+       rfk = rfkill_alloc(DRV_NAME, &pdev->dev, RFKILL_TYPE_BLUETOOTH,
+                       &h1940bt_rfkill_ops, NULL);
+       if (!rfk) {
+               ret = -ENOMEM;
+               goto err_rfk_alloc;
+       }
+
+       rfkill_set_led_trigger_name(rfk, "h1940-bluetooth");
+
+       ret = rfkill_register(rfk);
+       if (ret)
+               goto err_rfkill;
+
+       platform_set_drvdata(pdev, rfk);
+
+       return 0;
 
-       return device_create_file(&pdev->dev, &dev_attr_enable);
+err_rfkill:
+       rfkill_destroy(rfk);
+err_rfk_alloc:
+       return ret;
 }
 
 static int h1940bt_remove(struct platform_device *pdev)
 {
-#ifdef CONFIG_LEDS_H1940
-       led_trigger_unregister_simple(bt_led_trigger);
-#endif
+       struct rfkill *rfk = platform_get_drvdata(pdev);
+
+       platform_set_drvdata(pdev, NULL);
+
+       if (rfk) {
+               rfkill_unregister(rfk);
+               rfkill_destroy(rfk);
+       }
+       rfk = NULL;
+
+       h1940bt_enable(0);
+
        return 0;
 }
 
index c425eefb9f89d7f79fa8be026b9e0acfe5c523ef..4c79ac8a6c336bb9efd5a9d45452bb4670bf3139 100644 (file)
@@ -248,7 +248,7 @@ static int chip0_map[] = { 1 };
 static int chip1_map[] = { 2 };
 static int chip2_map[] = { 3 };
 
-static struct mtd_partition bast_default_nand_part[] = {
+static struct mtd_partition __initdata bast_default_nand_part[] = {
        [0] = {
                .name   = "Boot Agent",
                .size   = SZ_16K,
@@ -274,7 +274,7 @@ static struct mtd_partition bast_default_nand_part[] = {
  * socket.
 */
 
-static struct s3c2410_nand_set bast_nand_sets[] = {
+static struct s3c2410_nand_set __initdata bast_nand_sets[] = {
        [0] = {
                .name           = "SmartMedia",
                .nr_chips       = 1,
@@ -324,7 +324,7 @@ static void bast_nand_select(struct s3c2410_nand_set *set, int slot)
        __raw_writeb(tmp, BAST_VA_CTRL2);
 }
 
-static struct s3c2410_platform_nand bast_nand_info = {
+static struct s3c2410_platform_nand __initdata bast_nand_info = {
        .tacls          = 30,
        .twrph0         = 60,
        .twrph1         = 60,
@@ -631,7 +631,6 @@ 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_hwmon.dev.platform_data = &bast_hwmon_info;
 
        s3c24xx_init_io(bast_iodesc, ARRAY_SIZE(bast_iodesc));
@@ -645,6 +644,7 @@ static void __init bast_init(void)
        sysdev_register(&bast_pm_sysdev);
 
        s3c_i2c0_set_platdata(&bast_i2c_info);
+       s3c_nand_set_platdata(&bast_nand_info);
        s3c24xx_fb_set_platdata(&bast_fb_info);
        platform_add_devices(bast_devices, ARRAY_SIZE(bast_devices));
 
index d9cd5ddecf4a7fda05bbd275828647982adfcdd5..49053254c98d2041a9e66e70b1699e24e66ae26a 100644 (file)
 #include <linux/serial_core.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
+#include <linux/gpio.h>
+#include <linux/pwm_backlight.h>
+#include <video/platform_lcd.h>
+
+#include <linux/mmc/host.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
 #include <plat/regs-serial.h>
 #include <mach/regs-lcd.h>
-#include <mach/regs-gpio.h>
 #include <mach/regs-clock.h>
 
+#include <mach/regs-gpio.h>
+#include <mach/gpio-fns.h>
+#include <mach/gpio-nrs.h>
+
 #include <mach/h1940.h>
 #include <mach/h1940-latch.h>
 #include <mach/fb.h>
@@ -46,6 +54,7 @@
 #include <plat/cpu.h>
 #include <plat/pll.h>
 #include <plat/pm.h>
+#include <plat/mci.h>
 
 static struct map_desc h1940_iodesc[] __initdata = {
        [0] = {
@@ -171,16 +180,90 @@ static struct s3c2410fb_mach_info h1940_fb_info __initdata = {
        .gpdup_mask=    0xffffffff,
 };
 
-static struct platform_device s3c_device_leds = {
+static struct platform_device h1940_device_leds = {
        .name             = "h1940-leds",
        .id               = -1,
 };
 
-static struct platform_device s3c_device_bluetooth = {
+static struct platform_device h1940_device_bluetooth = {
        .name             = "h1940-bt",
        .id               = -1,
 };
 
+static struct s3c24xx_mci_pdata h1940_mmc_cfg = {
+       .gpio_detect   = S3C2410_GPF(5),
+       .gpio_wprotect = S3C2410_GPH(8),
+       .set_power     = NULL,
+       .ocr_avail     = MMC_VDD_32_33,
+};
+
+static int h1940_backlight_init(struct device *dev)
+{
+       gpio_request(S3C2410_GPB(0), "Backlight");
+
+       s3c2410_gpio_setpin(S3C2410_GPB(0), 0);
+       s3c2410_gpio_pullup(S3C2410_GPB(0), 0);
+       s3c2410_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
+
+       return 0;
+}
+
+static void h1940_backlight_exit(struct device *dev)
+{
+       s3c2410_gpio_cfgpin(S3C2410_GPB(0), 1/*S3C2410_GPB0_OUTP*/);
+}
+
+static struct platform_pwm_backlight_data backlight_data = {
+       .pwm_id         = 0,
+       .max_brightness = 100,
+       .dft_brightness = 50,
+       /* tcnt = 0x31 */
+       .pwm_period_ns  = 36296,
+       .init           = h1940_backlight_init,
+       .exit           = h1940_backlight_exit,
+};
+
+static struct platform_device h1940_backlight = {
+       .name = "pwm-backlight",
+       .dev  = {
+               .parent = &s3c_device_timer[0].dev,
+               .platform_data = &backlight_data,
+       },
+       .id   = -1,
+};
+
+static void h1940_lcd_power_set(struct plat_lcd_data *pd,
+                                       unsigned int power)
+{
+       int value;
+
+       if (!power) {
+               /* set to 3ec */
+               s3c2410_gpio_setpin(S3C2410_GPC(0), 0);
+               /* wait for 3ac */
+               do {
+                       value = s3c2410_gpio_getpin(S3C2410_GPC(6));
+               } while (value);
+               /* set to 38c */
+               s3c2410_gpio_setpin(S3C2410_GPC(5), 0);
+       } else {
+               /* Set to 3ac */
+               s3c2410_gpio_setpin(S3C2410_GPC(5), 1);
+               /* Set to 3ad */
+               s3c2410_gpio_setpin(S3C2410_GPC(0), 1);
+       }
+}
+
+static struct plat_lcd_data h1940_lcd_power_data = {
+       .set_power      = h1940_lcd_power_set,
+};
+
+static struct platform_device h1940_lcd_powerdev = {
+       .name                   = "platform-lcd",
+       .dev.parent             = &s3c_device_lcd.dev,
+       .dev.platform_data      = &h1940_lcd_power_data,
+};
+
 static struct platform_device *h1940_devices[] __initdata = {
        &s3c_device_usb,
        &s3c_device_lcd,
@@ -188,8 +271,13 @@ static struct platform_device *h1940_devices[] __initdata = {
        &s3c_device_i2c0,
        &s3c_device_iis,
        &s3c_device_usbgadget,
-       &s3c_device_leds,
-       &s3c_device_bluetooth,
+       &h1940_device_leds,
+       &h1940_device_bluetooth,
+       &s3c_device_sdi,
+       &s3c_device_rtc,
+       &s3c_device_timer[0],
+       &h1940_backlight,
+       &h1940_lcd_powerdev,
 };
 
 static void __init h1940_map_io(void)
@@ -219,6 +307,8 @@ static void __init h1940_init(void)
        s3c24xx_udc_set_platdata(&h1940_udc_cfg);
        s3c_i2c0_set_platdata(NULL);
 
+       s3c_device_sdi.dev.platform_data = &h1940_mmc_cfg;
+
        /* Turn off suspend on both USB ports, and switch the
         * selectable USB port to USB device mode. */
 
@@ -231,6 +321,11 @@ static void __init h1940_init(void)
              | (0x03 << S3C24XX_PLLCON_SDIVSHIFT);
        writel(tmp, S3C2410_UPLLCON);
 
+       gpio_request(S3C2410_GPC(0), "LCD power");
+       gpio_request(S3C2410_GPC(5), "LCD power");
+       gpio_request(S3C2410_GPC(6), "LCD power");
+
+
        platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
 }
 
index 0f6ed61af41513c754f6237b590c8962dc57250c..0405712c22634b8a4915afcd7ad1fa94c49a1ef0 100644 (file)
@@ -338,7 +338,7 @@ static struct platform_device *n35_devices[] __initdata = {
        &n35_button_device,
 };
 
-static struct s3c2410_platform_i2c n30_i2ccfg = {
+static struct s3c2410_platform_i2c __initdata n30_i2ccfg = {
        .flags          = 0,
        .slave_addr     = 0x10,
        .frequency      = 10*1000,
@@ -500,8 +500,8 @@ static void __init n30_init_irq(void)
 static void __init n30_init(void)
 {
        s3c24xx_fb_set_platdata(&n30_fb_info);
-       s3c_device_i2c0.dev.platform_data = &n30_i2ccfg;
        s3c24xx_udc_set_platdata(&n30_udc_cfg);
+       s3c_i2c0_set_platdata(&n30_i2ccfg);
 
        /* Turn off suspend on both USB ports, and switch the
         * selectable USB port to USB device mode. */
index 2cc9849eb448696b26b83008b8b236f2d6c9eec7..ab092bcda393a5e9287e1b3e35ad19775ddb3cca 100644 (file)
@@ -258,7 +258,7 @@ static struct platform_device *qt2410_devices[] __initdata = {
        &qt2410_led,
 };
 
-static struct mtd_partition qt2410_nand_part[] = {
+static struct mtd_partition __initdata qt2410_nand_part[] = {
        [0] = {
                .name   = "U-Boot",
                .size   = 0x30000,
@@ -286,7 +286,7 @@ static struct mtd_partition qt2410_nand_part[] = {
        },
 };
 
-static struct s3c2410_nand_set qt2410_nand_sets[] = {
+static struct s3c2410_nand_set __initdata qt2410_nand_sets[] = {
        [0] = {
                .name           = "NAND",
                .nr_chips       = 1,
@@ -299,7 +299,7 @@ static struct s3c2410_nand_set qt2410_nand_sets[] = {
  * chips and beyond.
  */
 
-static struct s3c2410_platform_nand qt2410_nand_info = {
+static struct s3c2410_platform_nand __initdata qt2410_nand_info = {
        .tacls          = 20,
        .twrph0         = 60,
        .twrph1         = 20,
@@ -331,7 +331,7 @@ static void __init qt2410_map_io(void)
 
 static void __init qt2410_machine_init(void)
 {
-       s3c_device_nand.dev.platform_data = &qt2410_nand_info;
+       s3c_nand_set_platdata(&qt2410_nand_info);
 
        switch (tft_type) {
        case 'p': /* production */
index 8df506eac9037aa25f15624e84d96c2644f772f2..c9fa3fca486c734a5f229696df02634bac707b11 100644 (file)
@@ -96,7 +96,7 @@ static struct s3c2410_uartcfg jive_uartcfgs[] = {
  * 0x017d0000-0x02bd0000 : cramfs B
  * 0x02bd0000-0x03fd0000 : yaffs
  */
-static struct mtd_partition jive_imageA_nand_part[] = {
+static struct mtd_partition __initdata jive_imageA_nand_part[] = {
 
 #ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER
        /* Don't allow access to the bootloader from linux */
@@ -154,7 +154,7 @@ static struct mtd_partition jive_imageA_nand_part[] = {
         },
 };
 
-static struct mtd_partition jive_imageB_nand_part[] = {
+static struct mtd_partition __initdata jive_imageB_nand_part[] = {
 
 #ifdef CONFIG_MACH_JIVE_SHOW_BOOTLOADER
        /* Don't allow access to the bootloader from linux */
@@ -213,7 +213,7 @@ static struct mtd_partition jive_imageB_nand_part[] = {
         },
 };
 
-static struct s3c2410_nand_set jive_nand_sets[] = {
+static struct s3c2410_nand_set __initdata jive_nand_sets[] = {
        [0] = {
                .name           = "flash",
                .nr_chips       = 1,
@@ -222,7 +222,7 @@ static struct s3c2410_nand_set jive_nand_sets[] = {
        },
 };
 
-static struct s3c2410_platform_nand jive_nand_info = {
+static struct s3c2410_platform_nand __initdata jive_nand_info = {
        /* set taken from osiris nand timings, possibly still conservative */
        .tacls          = 30,
        .twrph0         = 55,
@@ -631,7 +631,8 @@ static void __init jive_machine_init(void)
 
        s3c_pm_init();
 
-       s3c_device_nand.dev.platform_data = &jive_nand_info;
+       /** TODO - check that this is after the cmdline option! */
+       s3c_nand_set_platdata(&jive_nand_info);
 
        /* initialise the spi */
 
index 11e8ad49fc7be740a941a386a291ed9cfa31d013..a6ba591b26bb30e97e902e6dc78f4458ce992668 100644 (file)
@@ -76,7 +76,7 @@ static struct s3c2410_uartcfg vstms_uartcfgs[] __initdata = {
        }
 };
 
-static struct mtd_partition vstms_nand_part[] = {
+static struct mtd_partition __initdata vstms_nand_part[] = {
        [0] = {
                .name   = "Boot Agent",
                .size   = 0x7C000,
@@ -99,7 +99,7 @@ static struct mtd_partition vstms_nand_part[] = {
        },
 };
 
-static struct s3c2410_nand_set vstms_nand_sets[] = {
+static struct s3c2410_nand_set __initdata vstms_nand_sets[] = {
        [0] = {
                .name           = "NAND",
                .nr_chips       = 1,
@@ -112,7 +112,7 @@ static struct s3c2410_nand_set vstms_nand_sets[] = {
  * chips and beyond.
 */
 
-static struct s3c2410_platform_nand vstms_nand_info = {
+static struct s3c2410_platform_nand __initdata vstms_nand_info = {
        .tacls          = 20,
        .twrph0         = 60,
        .twrph1         = 20,
@@ -143,8 +143,6 @@ static void __init vstms_fixup(struct machine_desc *desc,
 
 static void __init vstms_map_io(void)
 {
-       s3c_device_nand.dev.platform_data = &vstms_nand_info;
-
        s3c24xx_init_io(vstms_iodesc, ARRAY_SIZE(vstms_iodesc));
        s3c24xx_init_clocks(12000000);
        s3c24xx_init_uarts(vstms_uartcfgs, ARRAY_SIZE(vstms_uartcfgs));
@@ -153,6 +151,8 @@ static void __init vstms_map_io(void)
 static void __init vstms_init(void)
 {
        s3c_i2c0_set_platdata(NULL);
+       s3c_nand_set_platdata(&vstms_nand_info);
+
        platform_add_devices(vstms_devices, ARRAY_SIZE(vstms_devices));
 }
 
index c3705b99d15ca8ce4644022ce36213bdecf55a33..62a4c3eba97f126e6dd40ec91b9560a96d4eaace 100644 (file)
@@ -139,7 +139,7 @@ static int external_map[]   = { 2 };
 static int chip0_map[]      = { 0 };
 static int chip1_map[]      = { 1 };
 
-static struct mtd_partition anubis_default_nand_part[] = {
+static struct mtd_partition __initdata anubis_default_nand_part[] = {
        [0] = {
                .name   = "Boot Agent",
                .size   = SZ_16K,
@@ -162,7 +162,7 @@ static struct mtd_partition anubis_default_nand_part[] = {
        }
 };
 
-static struct mtd_partition anubis_default_nand_part_large[] = {
+static struct mtd_partition __initdata anubis_default_nand_part_large[] = {
        [0] = {
                .name   = "Boot Agent",
                .size   = SZ_128K,
@@ -192,7 +192,7 @@ static struct mtd_partition anubis_default_nand_part_large[] = {
  * socket.
 */
 
-static struct s3c2410_nand_set anubis_nand_sets[] = {
+static struct s3c2410_nand_set __initdata anubis_nand_sets[] = {
        [1] = {
                .name           = "External",
                .nr_chips       = 1,
@@ -234,7 +234,7 @@ static void anubis_nand_select(struct s3c2410_nand_set *set, int slot)
        __raw_writeb(tmp, ANUBIS_VA_CTRL1);
 }
 
-static struct s3c2410_platform_nand anubis_nand_info = {
+static struct s3c2410_platform_nand __initdata anubis_nand_info = {
        .tacls          = 25,
        .twrph0         = 55,
        .twrph1         = 40,
@@ -466,8 +466,6 @@ static void __init anubis_map_io(void)
 
        s3c24xx_register_clocks(anubis_clocks, ARRAY_SIZE(anubis_clocks));
 
-       s3c_device_nand.dev.platform_data = &anubis_nand_info;
-
        s3c24xx_init_io(anubis_iodesc, ARRAY_SIZE(anubis_iodesc));
        s3c24xx_init_clocks(0);
        s3c24xx_init_uarts(anubis_uartcfgs, ARRAY_SIZE(anubis_uartcfgs));
@@ -488,7 +486,9 @@ static void __init anubis_map_io(void)
 static void __init anubis_init(void)
 {
        s3c_i2c0_set_platdata(NULL);
+       s3c_nand_set_platdata(&anubis_nand_info);
        simtec_audio_add(NULL, false, &anubis_audio);
+
        platform_add_devices(anubis_devices, ARRAY_SIZE(anubis_devices));
 
        i2c_register_board_info(0, anubis_i2c_devs,
index dfc7010935da451c8615831515889582d5ad6217..aa69290e04c6ae6e7e87356d161846caa83644a5 100644 (file)
@@ -96,7 +96,7 @@ static struct s3c2410_uartcfg at2440evb_uartcfgs[] __initdata = {
 
 /* NAND Flash on AT2440EVB board */
 
-static struct mtd_partition at2440evb_default_nand_part[] = {
+static struct mtd_partition __initdata at2440evb_default_nand_part[] = {
        [0] = {
                .name   = "Boot Agent",
                .size   = SZ_256K,
@@ -114,7 +114,7 @@ static struct mtd_partition at2440evb_default_nand_part[] = {
        },
 };
 
-static struct s3c2410_nand_set at2440evb_nand_sets[] = {
+static struct s3c2410_nand_set __initdata at2440evb_nand_sets[] = {
        [0] = {
                .name           = "nand",
                .nr_chips       = 1,
@@ -123,7 +123,7 @@ static struct s3c2410_nand_set at2440evb_nand_sets[] = {
        },
 };
 
-static struct s3c2410_platform_nand at2440evb_nand_info = {
+static struct s3c2410_platform_nand __initdata at2440evb_nand_info = {
        .tacls          = 25,
        .twrph0         = 55,
        .twrph1         = 40,
@@ -216,8 +216,6 @@ static struct platform_device *at2440evb_devices[] __initdata = {
 
 static void __init at2440evb_map_io(void)
 {
-       s3c_device_nand.dev.platform_data = &at2440evb_nand_info;
-       s3c_device_sdi.name = "s3c2440-sdi";
        s3c_device_sdi.dev.platform_data = &at2440evb_mci_pdata;
 
        s3c24xx_init_io(at2440evb_iodesc, ARRAY_SIZE(at2440evb_iodesc));
@@ -228,6 +226,7 @@ static void __init at2440evb_map_io(void)
 static void __init at2440evb_init(void)
 {
        s3c24xx_fb_set_platdata(&at2440evb_fb_info);
+       s3c_nand_set_platdata(&at2440evb_nand_info);
        s3c_i2c0_set_platdata(NULL);
 
        platform_add_devices(at2440evb_devices, ARRAY_SIZE(at2440evb_devices));
index 1c3382fefdd21ebbea16abc2e33c4928d6f7b929..547d4fc99131648636626cad75aa6114db3d354c 100644 (file)
@@ -532,7 +532,6 @@ static void __init mini2440_map_io(void)
        s3c24xx_init_clocks(12000000);
        s3c24xx_init_uarts(mini2440_uartcfgs, ARRAY_SIZE(mini2440_uartcfgs));
 
-       s3c_device_nand.dev.platform_data = &mini2440_nand_info;
        s3c_device_sdi.dev.platform_data = &mini2440_mmc_cfg;
 }
 
@@ -677,8 +676,11 @@ static void __init mini2440_init(void)
                printk("\n");
                s3c24xx_fb_set_platdata(&mini2440_fb_info);
        }
+
        s3c24xx_udc_set_platdata(&mini2440_udc_cfg);
+       s3c_nand_set_platdata(&mini2440_nand_info);
        s3c_i2c0_set_platdata(NULL);
+
        i2c_register_board_info(0, mini2440_i2c_devs,
                                ARRAY_SIZE(mini2440_i2c_devs));
 
index 9b04de2481d72a261decef7fee424d31a1d7b1b3..015dfb2a80dad6e9becda57be95a326a4ee518db 100644 (file)
@@ -150,7 +150,7 @@ static int external_map[]   = { 2 };
 static int chip0_map[]      = { 0 };
 static int chip1_map[]      = { 1 };
 
-static struct mtd_partition osiris_default_nand_part[] = {
+static struct mtd_partition __initdata osiris_default_nand_part[] = {
        [0] = {
                .name   = "Boot Agent",
                .size   = SZ_16K,
@@ -173,7 +173,7 @@ static struct mtd_partition osiris_default_nand_part[] = {
        }
 };
 
-static struct mtd_partition osiris_default_nand_part_large[] = {
+static struct mtd_partition __initdata osiris_default_nand_part_large[] = {
        [0] = {
                .name   = "Boot Agent",
                .size   = SZ_128K,
@@ -203,7 +203,7 @@ static struct mtd_partition osiris_default_nand_part_large[] = {
  * socket.
 */
 
-static struct s3c2410_nand_set osiris_nand_sets[] = {
+static struct s3c2410_nand_set __initdata osiris_nand_sets[] = {
        [1] = {
                .name           = "External",
                .nr_chips       = 1,
@@ -245,7 +245,7 @@ static void osiris_nand_select(struct s3c2410_nand_set *set, int slot)
        __raw_writeb(tmp, OSIRIS_VA_CTRL0);
 }
 
-static struct s3c2410_platform_nand osiris_nand_info = {
+static struct s3c2410_platform_nand __initdata osiris_nand_info = {
        .tacls          = 25,
        .twrph0         = 60,
        .twrph1         = 60,
@@ -411,8 +411,6 @@ static void __init osiris_map_io(void)
 
        s3c24xx_register_clocks(osiris_clocks, ARRAY_SIZE(osiris_clocks));
 
-       s3c_device_nand.dev.platform_data = &osiris_nand_info;
-
        s3c24xx_init_io(osiris_iodesc, ARRAY_SIZE(osiris_iodesc));
        s3c24xx_init_clocks(0);
        s3c24xx_init_uarts(osiris_uartcfgs, ARRAY_SIZE(osiris_uartcfgs));
@@ -442,6 +440,7 @@ static void __init osiris_init(void)
        sysdev_register(&osiris_pm_sysdev);
 
        s3c_i2c0_set_platdata(NULL);
+       s3c_nand_set_platdata(&osiris_nand_info);
 
        s3c_cpufreq_setboard(&osiris_cpufreq);
 
index e394ecd015106ab6a34091b931c70f1f28d9d5c9..a952a13afb1f9cc59e82b9e749e83a8047a8bcc4 100644 (file)
@@ -149,7 +149,7 @@ static struct s3c2410fb_mach_info rx3715_fb_info __initdata = {
        .gpdup_mask =   0xffffffff,
 };
 
-static struct mtd_partition rx3715_nand_part[] = {
+static struct mtd_partition __initdata rx3715_nand_part[] = {
        [0] = {
                .name           = "Whole Flash",
                .offset         = 0,
@@ -158,7 +158,7 @@ static struct mtd_partition rx3715_nand_part[] = {
        }
 };
 
-static struct s3c2410_nand_set rx3715_nand_sets[] = {
+static struct s3c2410_nand_set __initdata rx3715_nand_sets[] = {
        [0] = {
                .name           = "Internal",
                .nr_chips       = 1,
@@ -167,7 +167,7 @@ static struct s3c2410_nand_set rx3715_nand_sets[] = {
        },
 };
 
-static struct s3c2410_platform_nand rx3715_nand_info = {
+static struct s3c2410_platform_nand __initdata rx3715_nand_info = {
        .tacls          = 25,
        .twrph0         = 50,
        .twrph1         = 15,
@@ -186,8 +186,6 @@ static struct platform_device *rx3715_devices[] __initdata = {
 
 static void __init rx3715_map_io(void)
 {
-       s3c_device_nand.dev.platform_data = &rx3715_nand_info;
-
        s3c24xx_init_io(rx3715_iodesc, ARRAY_SIZE(rx3715_iodesc));
        s3c24xx_init_clocks(16934000);
        s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
@@ -205,6 +203,7 @@ static void __init rx3715_init_machine(void)
 #endif
        s3c_pm_init();
 
+       s3c_nand_set_platdata(&rx3715_nand_info);
        s3c24xx_fb_set_platdata(&rx3715_fb_info);
        platform_add_devices(rx3715_devices, ARRAY_SIZE(rx3715_devices));
 }
index 0fb385bd9cd9c44eaa164cfe14d6721063eab8d3..f76d6ff4aeb932359eacdeed6a758d79f691ed57 100644 (file)
@@ -423,7 +423,7 @@ static struct i2c_board_info gta02_i2c_devs[] __initdata = {
        },
 };
 
-static struct s3c2410_nand_set gta02_nand_sets[] = {
+static struct s3c2410_nand_set __initdata gta02_nand_sets[] = {
        [0] = {
                /*
                 * This name is also hard-coded in the boot loaders, so
@@ -442,7 +442,7 @@ static struct s3c2410_nand_set gta02_nand_sets[] = {
  * data sheet (K5D2G13ACM-D075 MCP Memory).
  */
 
-static struct s3c2410_platform_nand gta02_nand_info = {
+static struct s3c2410_platform_nand __initdata gta02_nand_info = {
        .tacls          = 0,
        .twrph0         = 25,
        .twrph1         = 15,
@@ -621,9 +621,9 @@ static void __init gta02_machine_init(void)
 #endif
 
        s3c_device_usb.dev.platform_data = &gta02_usb_info;
-       s3c_device_nand.dev.platform_data = &gta02_nand_info;
 
        s3c24xx_udc_set_platdata(&gta02_udc_cfg);
+       s3c_nand_set_platdata(&gta02_nand_info);
        s3c_i2c0_set_platdata(NULL);
 
        i2c_register_board_info(0, gta02_i2c_devs, ARRAY_SIZE(gta02_i2c_devs));
index c5741056193fcdbf7076c2dd483e3a53607460e1..cdd4b5378552a9a30d699046838d906b87ae4b47 100644 (file)
@@ -250,7 +250,7 @@ static void __init hmt_machine_init(void)
 {
        s3c_i2c0_set_platdata(NULL);
        s3c_fb_set_platdata(&hmt_lcd_pdata);
-       s3c_device_nand.dev.platform_data = &hmt_nand_info;
+       s3c_nand_set_platdata(&hmt_nand_info);
 
        gpio_request(S3C64XX_GPC(7), "usb power");
        gpio_direction_output(S3C64XX_GPC(7), 0);
index 4e532373243486f959d9b432310f7c96f97d0f44..e771e77dcd54011f82e70e11f6810c7953ab44f4 100644 (file)
@@ -9,8 +9,12 @@
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+
 #include <mach/map.h>
 #include <plat/devs.h>
+#include <plat/nand.h>
 
 static struct resource s3c_nand_resource[] = {
        [0] = {
@@ -28,3 +32,96 @@ struct platform_device s3c_device_nand = {
 };
 
 EXPORT_SYMBOL(s3c_device_nand);
+
+/**
+ * s3c_nand_copy_set() - copy nand set data
+ * @set: The new structure, directly copied from the old.
+ *
+ * Copy all the fields from the NAND set field from what is probably __initdata
+ * to new kernel memory. The code returns 0 if the copy happened correctly or
+ * an error code for the calling function to display.
+ *
+ * Note, we currently do not try and look to see if we've already copied the
+ * data in a previous set.
+ */
+static int __init s3c_nand_copy_set(struct s3c2410_nand_set *set)
+{
+       void *ptr;
+       int size;
+
+       size = sizeof(struct mtd_partition) * set->nr_partitions;
+       if (size) {
+               ptr = kmemdup(set->partitions, size, GFP_KERNEL);
+               set->partitions = ptr;
+
+               if (!ptr)
+                       return -ENOMEM;
+       }
+       
+       size = sizeof(int) * set->nr_chips;
+       if (size) {
+               ptr = kmemdup(set->nr_map, size, GFP_KERNEL);
+               set->nr_map = ptr;
+
+               if (!ptr)
+                       return -ENOMEM;
+       }
+
+       if (set->ecc_layout) {
+               ptr = kmemdup(set->ecc_layout,
+                             sizeof(struct nand_ecclayout), GFP_KERNEL);
+               set->ecc_layout = ptr;
+
+               if (!ptr)
+                       return -ENOMEM;
+       }
+       
+       return 0;
+}
+
+void __init s3c_nand_set_platdata(struct s3c2410_platform_nand *nand)
+{
+       struct s3c2410_platform_nand *npd;
+       int size;
+       int ret;
+
+       /* note, if we get a failure in allocation, we simply drop out of the
+        * function. If there is so little memory available at initialisation
+        * time then there is little chance the system is going to run.
+        */ 
+
+       npd = kmemdup(nand, sizeof(struct s3c2410_platform_nand), GFP_KERNEL);
+       if (!npd) {
+               printk(KERN_ERR "%s: failed copying platform data\n", __func__);
+               return;
+       }
+
+       /* now see if we need to copy any of the nand set data */
+
+       size = sizeof(struct s3c2410_nand_set) * npd->nr_sets;
+       if (size) {
+               struct s3c2410_nand_set *from = npd->sets;
+               struct s3c2410_nand_set *to;
+               int i;
+
+               to = kmemdup(from, size, GFP_KERNEL);
+               npd->sets = to; /* set, even if we failed */
+
+               if (!to) {
+                       printk(KERN_ERR "%s: no memory for sets\n", __func__);
+                       return;
+               }
+               
+               for (i = 0; i < npd->nr_sets; i++) {
+                       ret = s3c_nand_copy_set(to);
+                       if (!ret) {
+                               printk(KERN_ERR "%s: failed to copy set %d\n",
+                               __func__, i);
+                               return;
+                       }
+                       to++;
+               }
+       }
+}
+
+EXPORT_SYMBOL_GPL(s3c_nand_set_platdata);
index 18f958801e64c16957d26ac9a1a41da39bf72e9e..065985978413087f432d0b171dc2f2fd19d138c6 100644 (file)
@@ -55,3 +55,11 @@ struct s3c2410_platform_nand {
                                               int chip);
 };
 
+/**
+ * s3c_nand_set_platdata() - register NAND platform data.
+ * @nand: The NAND platform data to register with s3c_device_nand.
+ *
+ * This function copies the given NAND platform data, @nand and registers
+ * it with the s3c_device_nand. This allows @nand to be __initdata.
+*/
+extern void s3c_nand_set_platdata(struct s3c2410_platform_nand *nand);
index aa119863c5cec428691353b4869dfc93d5df1af4..9e0e20ad2e4678fabafd8cf06986a21212f1296e 100644 (file)
@@ -198,7 +198,7 @@ void __init smdk_machine_init(void)
        if (machine_is_smdk2443())
                smdk_nand_info.twrph0 = 50;
 
-       s3c_device_nand.dev.platform_data = &smdk_nand_info;
+       s3c_nand_set_platdata(&smdk_nand_info);
 
        platform_add_devices(smdk_devs, ARRAY_SIZE(smdk_devs));