ARM: imx: Change the way nand devices are registered (imx27)
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 16 Jun 2010 05:35:31 +0000 (07:35 +0200)
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 30 Jun 2010 07:00:33 +0000 (09:00 +0200)
Make use of new mechanism to register a nand device.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
arch/arm/mach-imx/Kconfig
arch/arm/mach-imx/devices-imx27.h [new file with mode: 0644]
arch/arm/mach-imx/devices.c
arch/arm/mach-imx/devices.h
arch/arm/mach-imx/mach-cpuimx27.c
arch/arm/mach-imx/mach-mx27ads.c
arch/arm/mach-imx/mach-mxt_td60.c
arch/arm/mach-imx/mach-pca100.c
arch/arm/mach-imx/mach-pcm038.c

index 23671824abd9ca40b517338434d81498af71fba6..5af1c22112a703a4818d1dd30ac289bf9d0cee1f 100644 (file)
@@ -81,12 +81,14 @@ comment "MX27 platforms:"
 
 config MACH_MX27ADS
        bool "MX27ADS platform"
+       select IMX_HAVE_PLATFORM_MXC_NAND
        help
          Include support for MX27ADS platform. This includes specific
          configurations for the board and its peripherals.
 
 config MACH_PCM038
        bool "Phytec phyCORE-i.MX27 CPU module (pcm038)"
+       select IMX_HAVE_PLATFORM_MXC_NAND
        select MXC_ULPI if USB_ULPI
        help
          Include support for phyCORE-i.MX27 (aka pcm038) platform. This
@@ -108,6 +110,7 @@ endchoice
 
 config MACH_CPUIMX27
        bool "Eukrea CPUIMX27 module"
+       select IMX_HAVE_PLATFORM_MXC_NAND
        help
          Include support for Eukrea CPUIMX27 platform. This includes
          specific configurations for the module and its peripherals.
@@ -147,6 +150,7 @@ config MACH_IMX27LITE
 
 config MACH_PCA100
        bool "Phytec phyCARD-s (pca100)"
+       select IMX_HAVE_PLATFORM_MXC_NAND
        select MXC_ULPI if USB_ULPI
        help
          Include support for phyCARD-s (aka pca100) platform. This
@@ -154,6 +158,7 @@ config MACH_PCA100
 
 config MACH_MXT_TD60
        bool "Maxtrack i-MXT TD60"
+       select IMX_HAVE_PLATFORM_MXC_NAND
        help
          Include support for i-MXT (aka td60) platform. This
          includes specific configurations for the module and its peripherals.
diff --git a/arch/arm/mach-imx/devices-imx27.h b/arch/arm/mach-imx/devices-imx27.h
new file mode 100644 (file)
index 0000000..b2f6a12
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * Copyright (C) 2010 Pengutronix
+ * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
+ *
+ * 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 <mach/mx27.h>
+#include <mach/devices-common.h>
+
+#define imx27_add_mxc_nand(pdata)      \
+       imx_add_mxc_nand_v1(MX27_NFC_BASE_ADDR, MX27_INT_NANDFC, pdata)
index dbd1460e46cf31dddc8c5a6ec4ac283f2fbda75b..3a599e94a65c033f30f511711798a76db5cff43a 100644 (file)
@@ -337,30 +337,6 @@ struct platform_device mxc_w1_master_device = {
        .resource = mxc_w1_master_resources,
 };
 
-#define DEFINE_MXC_NAND_DEVICE(pfx, baseaddr, irq)                     \
-       static struct resource pfx ## _nand_resources[] = {             \
-               {                                                       \
-                       .start = baseaddr,                              \
-                       .end = baseaddr + SZ_4K - 1,                    \
-                       .flags = IORESOURCE_MEM,                        \
-               }, {                                                    \
-                       .start = irq,                                   \
-                       .end = irq,                                     \
-                       .flags = IORESOURCE_IRQ,                        \
-               },                                                      \
-       };                                                              \
-                                                                       \
-       struct platform_device pfx ## _nand_device = {                  \
-               .name = "mxc_nand",                                     \
-               .id = 0,                                                \
-               .num_resources = ARRAY_SIZE(pfx ## _nand_resources),    \
-               .resource = pfx ## _nand_resources,                     \
-       }
-
-#ifdef CONFIG_MACH_MX27
-DEFINE_MXC_NAND_DEVICE(imx27, MX27_NFC_BASE_ADDR, MX27_INT_NANDFC);
-#endif
-
 /*
  * lcdc:
  * - i.MX1: the basic controller
index d3c381f2c74f4fccfd2b01a139b10cb644483733..4ce7eef943f69b8f632d298ea5273ae9a82e1366 100644 (file)
@@ -26,9 +26,6 @@ extern struct platform_device imx2x_uart_device4;
 extern struct platform_device imx2x_uart_device5;
 #endif
 extern struct platform_device mxc_w1_master_device;
-#ifdef CONFIG_MACH_MX27
-extern struct platform_device imx27_nand_device;
-#endif
 extern struct platform_device mxc_fb_device;
 extern struct platform_device mxc_fec_device;
 extern struct platform_device mxc_pwm_device;
index 866a99a337f2cbb24b933671fd56450d44ec624e..5d07c2ab47114d98d4ea8fa92169f8093bcafec1 100644 (file)
@@ -40,6 +40,7 @@
 #include <mach/imx-uart.h>
 #include <mach/mxc_nand.h>
 
+#include "devices-imx27.h"
 #include "devices.h"
 
 static int eukrea_cpuimx27_pins[] = {
@@ -119,7 +120,8 @@ static struct imxuart_platform_data uart_pdata[] = {
        },
 };
 
-static struct mxc_nand_platform_data eukrea_cpuimx27_nand_board_info = {
+static const struct mxc_nand_platform_data
+cpuimx27_nand_board_info __initconst = {
        .width = 1,
        .hw_ecc = 1,
 };
@@ -189,8 +191,7 @@ static void __init eukrea_cpuimx27_init(void)
 
        mxc_register_device(&imx2x_uart_device0, &uart_pdata[0]);
 
-       mxc_register_device(&imx27_nand_device,
-                       &eukrea_cpuimx27_nand_board_info);
+       imx27_add_mxc_nand(&cpuimx27_nand_board_info);
 
        i2c_register_board_info(0, eukrea_cpuimx27_i2c_devices,
                                ARRAY_SIZE(eukrea_cpuimx27_i2c_devices));
index 186b93a8c08e7240ea70aafabde8db763e0a59e3..1a3ebf5dab26c81c8b27831d7f22f2e03f0f681d 100644 (file)
@@ -35,6 +35,7 @@
 #include <mach/imxfb.h>
 #include <mach/mmc.h>
 
+#include "devices-imx27.h"
 #include "devices.h"
 
 /*
@@ -166,7 +167,8 @@ static unsigned int mx27ads_pins[] = {
        PB9_PF_SD2_CLK,
 };
 
-static struct mxc_nand_platform_data mx27ads_nand_board_info = {
+static const struct mxc_nand_platform_data
+mx27ads_nand_board_info __initconst = {
        .width = 1,
        .hw_ecc = 1,
 };
@@ -315,7 +317,7 @@ static void __init mx27ads_board_init(void)
        mxc_register_device(&imx2x_uart_device3, &uart_pdata[3]);
        mxc_register_device(&imx2x_uart_device4, &uart_pdata[4]);
        mxc_register_device(&imx2x_uart_device5, &uart_pdata[5]);
-       mxc_register_device(&imx27_nand_device, &mx27ads_nand_board_info);
+       imx27_add_mxc_nand(&mx27ads_nand_board_info);
 
        /* only the i2c master 1 is used on this CPU card */
        i2c_register_board_info(1, mx27ads_i2c_devices,
index 0e5ddbabcba6cde6a687194fb72d85191087230c..447c68fe43838b988ece9a75ca450178c968d3e6 100644 (file)
@@ -36,6 +36,7 @@
 #include <mach/imxfb.h>
 #include <mach/mmc.h>
 
+#include "devices-imx27.h"
 #include "devices.h"
 
 static unsigned int mxt_td60_pins[] __initdata = {
@@ -124,7 +125,8 @@ static unsigned int mxt_td60_pins[] __initdata = {
        PB9_PF_SD2_CLK,
 };
 
-static struct mxc_nand_platform_data mxt_td60_nand_board_info = {
+static const struct mxc_nand_platform_data
+mxt_td60_nand_board_info __initconst = {
        .width = 1,
        .hw_ecc = 1,
 };
@@ -253,7 +255,7 @@ static void __init mxt_td60_board_init(void)
        mxc_register_device(&imx2x_uart_device0, &uart_pdata[0]);
        mxc_register_device(&imx2x_uart_device1, &uart_pdata[1]);
        mxc_register_device(&imx2x_uart_device2, &uart_pdata[2]);
-       mxc_register_device(&imx27_nand_device, &mxt_td60_nand_board_info);
+       imx27_add_mxc_nand(&mxt_td60_nand_board_info);
 
        i2c_register_board_info(0, mxt_td60_i2c_devices,
                                ARRAY_SIZE(mxt_td60_i2c_devices));
index 984c4caeebdc391626572beaf9e0787f6840c216..6efbc6e13be97d29879043fc10acb6ef6b0350a5 100644 (file)
@@ -50,6 +50,7 @@
 #include <mach/mxc_ehci.h>
 #include <mach/ulpi.h>
 
+#include "devices-imx27.h"
 #include "devices.h"
 
 #define OTG_PHY_CS_GPIO (GPIO_PORTB + 23)
@@ -137,7 +138,8 @@ static struct imxuart_platform_data uart_pdata = {
        .flags = IMXUART_HAVE_RTSCTS,
 };
 
-static struct mxc_nand_platform_data pca100_nand_board_info = {
+static const struct mxc_nand_platform_data
+pca100_nand_board_info __initconst = {
        .width = 1,
        .hw_ecc = 1,
 };
@@ -325,7 +327,7 @@ static void __init pca100_init(void)
        mxc_gpio_mode(GPIO_PORTC | 29 | GPIO_GPIO | GPIO_IN);
        mxc_register_device(&mxc_sdhc_device1, &sdhc_pdata);
 
-       mxc_register_device(&imx27_nand_device, &pca100_nand_board_info);
+       imx27_add_mxc_nand(&pca100_nand_board_info);
 
        /* only the i2c master 1 is used on this CPU card */
        i2c_register_board_info(1, pca100_i2c_devices,
index b6a15bac0c3d63e3066e4db8c2fb968204c8a7c8..bc44d6faf47d7654504e34345a866b0947a55c23 100644 (file)
@@ -43,6 +43,7 @@
 #include <mach/mxc_ehci.h>
 #include <mach/ulpi.h>
 
+#include "devices-imx27.h"
 #include "devices.h"
 
 static int pcm038_pins[] = {
@@ -172,7 +173,8 @@ static struct imxuart_platform_data uart_pdata[] = {
        },
 };
 
-static struct mxc_nand_platform_data pcm038_nand_board_info = {
+static const struct mxc_nand_platform_data
+pcm038_nand_board_info __initconst = {
        .width = 1,
        .hw_ecc = 1,
 };
@@ -310,7 +312,7 @@ static void __init pcm038_init(void)
        mxc_register_device(&imx2x_uart_device2, &uart_pdata[2]);
 
        mxc_gpio_mode(PE16_AF_OWIRE);
-       mxc_register_device(&imx27_nand_device, &pcm038_nand_board_info);
+       imx27_add_mxc_nand(&pcm038_nand_board_info);
 
        /* only the i2c master 1 is used on this CPU card */
        i2c_register_board_info(1, pcm038_i2c_devices,