ARM: imx: Change the way nand devices are registered (imx31)
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 16 Jun 2010 10:23:11 +0000 (12:23 +0200)
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Wed, 30 Jun 2010 07:00:34 +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-mx3/Kconfig
arch/arm/mach-mx3/devices-imx31.h [new file with mode: 0644]
arch/arm/mach-mx3/devices.c
arch/arm/mach-mx3/devices.h
arch/arm/mach-mx3/mach-armadillo5x0.c
arch/arm/mach-mx3/mach-mx31_3ds.c
arch/arm/mach-mx3/mach-mx31lite.c
arch/arm/mach-mx3/mach-pcm037.c

index 344753fdf25ef47ac6856ff5058f9cc8a193120a..cb9368f71596f6fb414be2dd0104c55b94afa051 100644 (file)
@@ -34,6 +34,7 @@ config MACH_MX31ADS_WM1133_EV1
 config MACH_PCM037
        bool "Support Phytec pcm037 (i.MX31) platforms"
        select ARCH_MX31
+       select IMX_HAVE_PLATFORM_MXC_NAND
        select MXC_ULPI if USB_ULPI
        help
          Include support for Phytec pcm037 platform. This includes
@@ -51,6 +52,7 @@ config MACH_MX31LITE
        bool "Support MX31 LITEKIT (LogicPD)"
        select ARCH_MX31
        select MXC_ULPI if USB_ULPI
+       select IMX_HAVE_PLATFORM_MXC_NAND
        help
          Include support for MX31 LITEKIT platform. This includes specific
          configurations for the board and its peripherals.
@@ -58,6 +60,7 @@ config MACH_MX31LITE
 config MACH_MX31_3DS
        bool "Support MX31PDK (3DS)"
        select ARCH_MX31
+       select IMX_HAVE_PLATFORM_MXC_NAND
        help
          Include support for MX31PDK (3DS) platform. This includes specific
          configurations for the board and its peripherals.
@@ -105,6 +108,7 @@ config MACH_PCM043
 config MACH_ARMADILLO5X0
        bool "Support Atmark Armadillo-500 Development Base Board"
        select ARCH_MX31
+       select IMX_HAVE_PLATFORM_MXC_NAND
        select MXC_ULPI if USB_ULPI
        help
          Include support for Atmark Armadillo-500 platform. This includes
diff --git a/arch/arm/mach-mx3/devices-imx31.h b/arch/arm/mach-mx3/devices-imx31.h
new file mode 100644 (file)
index 0000000..8bd8b38
--- /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/mx31.h>
+#include <mach/devices-common.h>
+
+#define imx31_add_mxc_nand(pdata)      \
+       imx_add_mxc_nand_v1(MX31_NFC_BASE_ADDR, MX31_INT_NANDFC, pdata)
index f6da0ffbe7190e24ce5098a0139d2e69dacc65a5..baa4bd117b33a59c01fea7f96e352fe38ab26a55 100644 (file)
@@ -167,6 +167,7 @@ struct platform_device mxc_w1_master_device = {
        .resource = mxc_w1_master_resources,
 };
 
+#if defined(CONFIG_ARCH_MX35)
 static struct resource mxc_nand_resources[] = {
        {
                .start  = 0, /* runtime dependent */
@@ -185,6 +186,7 @@ struct platform_device mxc_nand_device = {
        .num_resources = ARRAY_SIZE(mxc_nand_resources),
        .resource = mxc_nand_resources,
 };
+#endif
 
 static struct resource mxc_i2c0_resources[] = {
        {
@@ -628,13 +630,14 @@ struct platform_device imx_kpp_device = {
 
 static int __init mx3_devices_init(void)
 {
+#if defined(CONFIG_ARCH_MX31)
        if (cpu_is_mx31()) {
-               mxc_nand_resources[0].start = MX31_NFC_BASE_ADDR;
-               mxc_nand_resources[0].end = MX31_NFC_BASE_ADDR + 0xfff;
                imx_wdt_resources[0].start = MX31_WDOG_BASE_ADDR;
                imx_wdt_resources[0].end = MX31_WDOG_BASE_ADDR + 0x3fff;
                mxc_register_device(&mxc_rnga_device, NULL);
        }
+#endif
+#if defined(CONFIG_ARCH_MX35)
        if (cpu_is_mx35()) {
                mxc_nand_resources[0].start = MX35_NFC_BASE_ADDR;
                mxc_nand_resources[0].end = MX35_NFC_BASE_ADDR + 0x1fff;
@@ -653,6 +656,7 @@ static int __init mx3_devices_init(void)
                imx_wdt_resources[0].start = MX35_WDOG_BASE_ADDR;
                imx_wdt_resources[0].end = MX35_WDOG_BASE_ADDR + 0x3fff;
        }
+#endif
 
        return 0;
 }
index 2c3c8646a29ef701c3872483ddf44901332b4858..6bb71d334c658103d4c2ea3658f59a7b43a2f2ab 100644 (file)
@@ -5,7 +5,9 @@ extern struct platform_device mxc_uart_device2;
 extern struct platform_device mxc_uart_device3;
 extern struct platform_device mxc_uart_device4;
 extern struct platform_device mxc_w1_master_device;
+#if defined(CONFIG_ARCH_MX35)
 extern struct platform_device mxc_nand_device;
+#endif
 extern struct platform_device mxc_i2c_device0;
 extern struct platform_device mxc_i2c_device1;
 extern struct platform_device mxc_i2c_device2;
index 2a8de89e0b68660c2eeed2e4142d9aee60999f06..633107a69acd226407028edd782139ea3ecc0a8f 100644 (file)
 #include <mach/mmc.h>
 #include <mach/ipu.h>
 #include <mach/mx3fb.h>
-#include <mach/mxc_nand.h>
 #include <mach/mxc_ehci.h>
 #include <mach/ulpi.h>
 
+#include "devices-imx31.h"
 #include "devices.h"
 #include "crm_regs.h"
 
@@ -300,7 +300,8 @@ static struct platform_device armadillo5x0_button_device = {
 /*
  * NAND Flash
  */
-static struct mxc_nand_platform_data armadillo5x0_nand_flash_pdata = {
+static const struct mxc_nand_platform_data
+armadillo5x0_nand_board_info __initconst = {
        .width          = 1,
        .hw_ecc         = 1,
 };
@@ -531,7 +532,7 @@ static void __init armadillo5x0_init(void)
                            &armadillo5x0_nor_flash_pdata);
 
        /* Register NAND Flash */
-       mxc_register_device(&mxc_nand_device, &armadillo5x0_nand_flash_pdata);
+       imx31_add_mxc_nand(&armadillo5x0_nand_board_info);
 
        /* set NAND page size to 2k if not configured via boot mode pins */
        __raw_writel(__raw_readl(MXC_CCM_RCSR) | (1 << 30), MXC_CCM_RCSR);
index 33f2554fe31cd0e9fcd3109ff3d23fd6c9845c4f..c730c090208acc8dc1d8b96c15545d9de8d6ff45 100644 (file)
@@ -35,8 +35,9 @@
 #include <mach/common.h>
 #include <mach/imx-uart.h>
 #include <mach/iomux-mx3.h>
-#include <mach/mxc_nand.h>
 #include <mach/spi.h>
+
+#include "devices-imx31.h"
 #include "devices.h"
 
 /* Definitions for components on the Debug board */
@@ -189,7 +190,8 @@ static struct spi_board_info mx31_3ds_spi_devs[] __initdata = {
 /*
  * NAND Flash
  */
-static struct mxc_nand_platform_data imx31_3ds_nand_flash_pdata = {
+static const struct mxc_nand_platform_data
+mx31_3ds_nand_board_info __initconst = {
        .width          = 1,
        .hw_ecc         = 1,
 #ifdef MACH_MX31_3DS_MXC_NAND_USE_BBT
@@ -415,7 +417,7 @@ static void __init mxc_board_init(void)
                                      "mx31_3ds");
 
        mxc_register_device(&mxc_uart_device0, &uart_pdata);
-       mxc_register_device(&mxc_nand_device, &imx31_3ds_nand_flash_pdata);
+       imx31_add_mxc_nand(&mx31_3ds_nand_board_info);
 
        mxc_register_device(&mxc_spi_device1, &spi1_pdata);
        spi_register_board_info(mx31_3ds_spi_devs,
index edcc7114e82956bc0a8cb0e44d644a319873970e..f0a68e64e00468966d71bd4f872a341a0a375218 100644 (file)
 #include <mach/imx-uart.h>
 #include <mach/iomux-mx3.h>
 #include <mach/irqs.h>
-#include <mach/mxc_nand.h>
 #include <mach/spi.h>
 #include <mach/mxc_ehci.h>
 #include <mach/ulpi.h>
 
+#include "devices-imx31.h"
 #include "devices.h"
 
 /*
@@ -65,7 +65,8 @@ static unsigned int mx31lite_pins[] = {
        MX31_PIN_CSPI2_SS2__SS2,
 };
 
-static struct mxc_nand_platform_data mx31lite_nand_board_info = {
+static const struct mxc_nand_platform_data
+mx31lite_nand_board_info __initconst  = {
        .width = 1,
        .hw_ecc = 1,
 };
@@ -249,7 +250,7 @@ static void __init mxc_board_init(void)
 
        /* NOR and NAND flash */
        platform_device_register(&physmap_flash_device);
-       mxc_register_device(&mxc_nand_device, &mx31lite_nand_board_info);
+       imx31_add_mxc_nand(&mx31lite_nand_board_info);
 
        mxc_register_device(&mxc_spi_device1, &spi1_pdata);
        spi_register_board_info(&mc13783_spi_dev, 1);
index c1f335c5b2c6fed2c8066fe5171c0141f8949ead..d7fef469990a92d3d9c543ab994fa3eaea2970a5 100644 (file)
 #include <mach/mmc.h>
 #include <mach/mx3_camera.h>
 #include <mach/mx3fb.h>
-#include <mach/mxc_nand.h>
 #include <mach/mxc_ehci.h>
 #include <mach/ulpi.h>
 
+#include "devices-imx31.h"
 #include "devices.h"
 #include "pcm037.h"
 
@@ -274,7 +274,8 @@ static struct platform_device pcm037_sram_device = {
        .resource = &pcm038_sram_resource,
 };
 
-static struct mxc_nand_platform_data pcm037_nand_board_info = {
+static const struct mxc_nand_platform_data
+pcm037_nand_board_info __initconst = {
        .width = 1,
        .hw_ecc = 1,
 };
@@ -632,7 +633,7 @@ static void __init mxc_board_init(void)
        mxc_register_device(&mxc_i2c_device1, &pcm037_i2c_1_data);
        mxc_register_device(&mxc_i2c_device2, &pcm037_i2c_2_data);
 
-       mxc_register_device(&mxc_nand_device, &pcm037_nand_board_info);
+       imx31_add_mxc_nand(&pcm037_nand_board_info);
        mxc_register_device(&mxcsdhc_device0, &sdhc_pdata);
        mxc_register_device(&mx3_ipu, &mx3_ipu_data);
        mxc_register_device(&mx3_fb, &mx3fb_pdata);
This page took 0.038902 seconds and 5 git commands to generate.