aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2010-08-03 05:59:46 -0400
committerSascha Hauer <s.hauer@pengutronix.de>2010-10-01 03:33:03 -0400
commit63a7c6d7507ed6f4ea24a8ed008efa1bb22a2a97 (patch)
tree4824f195ebc2856bc9613624c31e5d5fac6de595 /arch
parent00b57bf9786ca701508333112c8917d1e0860129 (diff)
ARM: mx5: dynamically register mxc-nand device
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-mx5/devices-imx51.h4
-rw-r--r--arch/arm/plat-mxc/devices/platform-mxc_nand.c23
-rw-r--r--arch/arm/plat-mxc/include/mach/devices-common.h7
-rw-r--r--arch/arm/plat-mxc/include/mach/mx51.h2
4 files changed, 34 insertions, 2 deletions
diff --git a/arch/arm/mach-mx5/devices-imx51.h b/arch/arm/mach-mx5/devices-imx51.h
index 782b45bd916b..41d93c3d7d0b 100644
--- a/arch/arm/mach-mx5/devices-imx51.h
+++ b/arch/arm/mach-mx5/devices-imx51.h
@@ -21,6 +21,10 @@ extern const struct imx_imx_uart_1irq_data imx51_imx_uart_data[] __initconst;
21#define imx51_add_imx_uart(id, pdata) \ 21#define imx51_add_imx_uart(id, pdata) \
22 imx_add_imx_uart_1irq(&imx51_imx_uart_data[id], pdata) 22 imx_add_imx_uart_1irq(&imx51_imx_uart_data[id], pdata)
23 23
24extern const struct imx_mxc_nand_data imx51_mxc_nand_data __initconst;
25#define imx51_add_mxc_nand(pdata) \
26 imx_add_mxc_nand(&imx51_mxc_nand_data, pdata)
27
24extern const struct imx_spi_imx_data imx51_cspi_data __initconst; 28extern const struct imx_spi_imx_data imx51_cspi_data __initconst;
25#define imx51_add_cspi(pdata) \ 29#define imx51_add_cspi(pdata) \
26 imx_add_spi_imx(&imx51_cspi_data, pdata) 30 imx_add_spi_imx(&imx51_cspi_data, pdata)
diff --git a/arch/arm/plat-mxc/devices/platform-mxc_nand.c b/arch/arm/plat-mxc/devices/platform-mxc_nand.c
index 6d3a4785f95b..3fdcc32e3d67 100644
--- a/arch/arm/plat-mxc/devices/platform-mxc_nand.c
+++ b/arch/arm/plat-mxc/devices/platform-mxc_nand.c
@@ -17,6 +17,15 @@
17 .irq = soc ## _INT_NFC \ 17 .irq = soc ## _INT_NFC \
18 } 18 }
19 19
20#define imx_mxc_nandv3_data_entry_single(soc, _size) \
21 { \
22 .id = -1, \
23 .iobase = soc ## _NFC_BASE_ADDR, \
24 .iosize = _size, \
25 .axibase = soc ## _NFC_AXI_BASE_ADDR, \
26 .irq = soc ## _INT_NFC \
27 }
28
20#ifdef CONFIG_SOC_IMX21 29#ifdef CONFIG_SOC_IMX21
21const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst = 30const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst =
22 imx_mxc_nand_data_entry_single(MX21, SZ_4K); 31 imx_mxc_nand_data_entry_single(MX21, SZ_4K);
@@ -42,12 +51,22 @@ const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst =
42 imx_mxc_nand_data_entry_single(MX35, SZ_8K); 51 imx_mxc_nand_data_entry_single(MX35, SZ_8K);
43#endif 52#endif
44 53
54#ifdef CONFIG_ARCH_MX51
55const struct imx_mxc_nand_data imx51_mxc_nand_data __initconst =
56 imx_mxc_nandv3_data_entry_single(MX51, SZ_16K);
57#endif
58
45struct platform_device *__init imx_add_mxc_nand( 59struct platform_device *__init imx_add_mxc_nand(
46 const struct imx_mxc_nand_data *data, 60 const struct imx_mxc_nand_data *data,
47 const struct mxc_nand_platform_data *pdata) 61 const struct mxc_nand_platform_data *pdata)
48{ 62{
63 /* AXI has to come first, that's how the mxc_nand driver expect it */
49 struct resource res[] = { 64 struct resource res[] = {
50 { 65 {
66 .start = data->axibase,
67 .end = data->axibase + SZ_16K - 1,
68 .flags = IORESOURCE_MEM,
69 }, {
51 .start = data->iobase, 70 .start = data->iobase,
52 .end = data->iobase + data->iosize - 1, 71 .end = data->iobase + data->iosize - 1,
53 .flags = IORESOURCE_MEM, 72 .flags = IORESOURCE_MEM,
@@ -57,6 +76,8 @@ struct platform_device *__init imx_add_mxc_nand(
57 .flags = IORESOURCE_IRQ, 76 .flags = IORESOURCE_IRQ,
58 }, 77 },
59 }; 78 };
60 return imx_add_platform_device("mxc_nand", 0, res, ARRAY_SIZE(res), 79 return imx_add_platform_device("mxc_nand", data->id,
80 res + !data->axibase,
81 ARRAY_SIZE(res) - !data->axibase,
61 pdata, sizeof(*pdata)); 82 pdata, sizeof(*pdata));
62} 83}
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index 371336ee9d7f..f87aa1ad6685 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -71,8 +71,15 @@ struct platform_device *__init imx_add_imx_uart_1irq(
71 71
72#include <mach/mxc_nand.h> 72#include <mach/mxc_nand.h>
73struct imx_mxc_nand_data { 73struct imx_mxc_nand_data {
74 /*
75 * id is traditionally 0, but -1 is more appropriate. We use -1 for new
76 * machines but don't change existing devices as the nand device usually
77 * appears in the kernel command line to pass its partitioning.
78 */
79 int id;
74 resource_size_t iobase; 80 resource_size_t iobase;
75 resource_size_t iosize; 81 resource_size_t iosize;
82 resource_size_t axibase;
76 resource_size_t irq; 83 resource_size_t irq;
77}; 84};
78struct platform_device *__init imx_add_mxc_nand( 85struct platform_device *__init imx_add_mxc_nand(
diff --git a/arch/arm/plat-mxc/include/mach/mx51.h b/arch/arm/plat-mxc/include/mach/mx51.h
index b47d65b1c112..c99eeab6fe09 100644
--- a/arch/arm/plat-mxc/include/mach/mx51.h
+++ b/arch/arm/plat-mxc/include/mach/mx51.h
@@ -287,7 +287,7 @@
287#define MX51_MXC_INT_RESV5 5 287#define MX51_MXC_INT_RESV5 5
288#define MX51_MXC_INT_SDMA 6 288#define MX51_MXC_INT_SDMA 6
289#define MX51_MXC_INT_IOMUX 7 289#define MX51_MXC_INT_IOMUX 7
290#define MX51_MXC_INT_NFC 8 290#define MX51_INT_NFC 8
291#define MX51_MXC_INT_VPU 9 291#define MX51_MXC_INT_VPU 9
292#define MX51_MXC_INT_IPU_ERR 10 292#define MX51_MXC_INT_IPU_ERR 10
293#define MX51_MXC_INT_IPU_SYN 11 293#define MX51_MXC_INT_IPU_SYN 11