Commit 00b57bf9 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Sascha Hauer

ARM: imx: reorganize nand registration to use a struct

Addiontionally make the interrupt #defines match the base address
defines MX.._NFC_BASE_ADDR.
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
parent 40e2eda9
...@@ -25,8 +25,9 @@ extern const struct imx_imx_uart_1irq_data imx21_imx_uart_data[] __initconst; ...@@ -25,8 +25,9 @@ extern const struct imx_imx_uart_1irq_data imx21_imx_uart_data[] __initconst;
#define imx21_add_imx_uart2(pdata) imx21_add_imx_uart(2, pdata) #define imx21_add_imx_uart2(pdata) imx21_add_imx_uart(2, pdata)
#define imx21_add_imx_uart3(pdata) imx21_add_imx_uart(3, pdata) #define imx21_add_imx_uart3(pdata) imx21_add_imx_uart(3, pdata)
extern const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst;
#define imx21_add_mxc_nand(pdata) \ #define imx21_add_mxc_nand(pdata) \
imx_add_mxc_nand_v1(MX21_NFC_BASE_ADDR, MX21_INT_NANDFC, pdata) imx_add_mxc_nand(&imx21_mxc_nand_data, pdata)
extern const struct imx_spi_imx_data imx21_cspi_data[] __initconst; extern const struct imx_spi_imx_data imx21_cspi_data[] __initconst;
#define imx21_add_cspi(id, pdata) \ #define imx21_add_cspi(id, pdata) \
......
...@@ -27,8 +27,9 @@ extern const struct imx_imx_uart_1irq_data imx27_imx_uart_data[] __initconst; ...@@ -27,8 +27,9 @@ extern const struct imx_imx_uart_1irq_data imx27_imx_uart_data[] __initconst;
#define imx27_add_imx_uart4(pdata) imx27_add_imx_uart(4, pdata) #define imx27_add_imx_uart4(pdata) imx27_add_imx_uart(4, pdata)
#define imx27_add_imx_uart5(pdata) imx27_add_imx_uart(5, pdata) #define imx27_add_imx_uart5(pdata) imx27_add_imx_uart(5, pdata)
extern const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst;
#define imx27_add_mxc_nand(pdata) \ #define imx27_add_mxc_nand(pdata) \
imx_add_mxc_nand_v1(MX27_NFC_BASE_ADDR, MX27_INT_NANDFC, pdata) imx_add_mxc_nand(&imx27_mxc_nand_data, pdata)
extern const struct imx_spi_imx_data imx27_cspi_data[] __initconst; extern const struct imx_spi_imx_data imx27_cspi_data[] __initconst;
#define imx27_add_cspi(id, pdata) \ #define imx27_add_cspi(id, pdata) \
......
...@@ -34,8 +34,9 @@ extern const struct imx_imx_uart_1irq_data imx25_imx_uart_data[] __initconst; ...@@ -34,8 +34,9 @@ extern const struct imx_imx_uart_1irq_data imx25_imx_uart_data[] __initconst;
#define imx25_add_imx_uart3(pdata) imx25_add_imx_uart(3, pdata) #define imx25_add_imx_uart3(pdata) imx25_add_imx_uart(3, pdata)
#define imx25_add_imx_uart4(pdata) imx25_add_imx_uart(4, pdata) #define imx25_add_imx_uart4(pdata) imx25_add_imx_uart(4, pdata)
extern const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst;
#define imx25_add_mxc_nand(pdata) \ #define imx25_add_mxc_nand(pdata) \
imx_add_mxc_nand_v21(MX25_NFC_BASE_ADDR, MX25_INT_NANDFC, pdata) imx_add_mxc_nand(&imx25_mxc_nand_data, pdata)
extern const struct imx_spi_imx_data imx25_spi_imx_data[] __initconst; extern const struct imx_spi_imx_data imx25_spi_imx_data[] __initconst;
#define imx25_add_spi_imx(id, pdata) \ #define imx25_add_spi_imx(id, pdata) \
......
...@@ -29,8 +29,9 @@ extern const struct imx_imx_uart_1irq_data imx31_imx_uart_data[] __initconst; ...@@ -29,8 +29,9 @@ extern const struct imx_imx_uart_1irq_data imx31_imx_uart_data[] __initconst;
#define imx31_add_imx_uart3(pdata) imx31_add_imx_uart(3, pdata) #define imx31_add_imx_uart3(pdata) imx31_add_imx_uart(3, pdata)
#define imx31_add_imx_uart4(pdata) imx31_add_imx_uart(4, pdata) #define imx31_add_imx_uart4(pdata) imx31_add_imx_uart(4, pdata)
extern const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst;
#define imx31_add_mxc_nand(pdata) \ #define imx31_add_mxc_nand(pdata) \
imx_add_mxc_nand_v1(MX31_NFC_BASE_ADDR, MX31_INT_NANDFC, pdata) imx_add_mxc_nand(&imx31_mxc_nand_data, pdata)
extern const struct imx_spi_imx_data imx31_cspi_data[] __initconst; extern const struct imx_spi_imx_data imx31_cspi_data[] __initconst;
#define imx31_add_cspi(id, pdata) \ #define imx31_add_cspi(id, pdata) \
......
...@@ -32,8 +32,9 @@ extern const struct imx_imx_uart_1irq_data imx35_imx_uart_data[] __initconst; ...@@ -32,8 +32,9 @@ extern const struct imx_imx_uart_1irq_data imx35_imx_uart_data[] __initconst;
#define imx35_add_imx_uart1(pdata) imx35_add_imx_uart(1, pdata) #define imx35_add_imx_uart1(pdata) imx35_add_imx_uart(1, pdata)
#define imx35_add_imx_uart2(pdata) imx35_add_imx_uart(2, pdata) #define imx35_add_imx_uart2(pdata) imx35_add_imx_uart(2, pdata)
extern const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst;
#define imx35_add_mxc_nand(pdata) \ #define imx35_add_mxc_nand(pdata) \
imx_add_mxc_nand_v21(MX35_NFC_BASE_ADDR, MX35_INT_NANDFC, pdata) imx_add_mxc_nand(&imx35_mxc_nand_data, pdata)
extern const struct imx_spi_imx_data imx35_cspi_data[] __initconst; extern const struct imx_spi_imx_data imx35_cspi_data[] __initconst;
#define imx35_add_cspi(id, pdata) \ #define imx35_add_cspi(id, pdata) \
......
...@@ -7,38 +7,56 @@ ...@@ -7,38 +7,56 @@
* Free Software Foundation. * Free Software Foundation.
*/ */
#include <asm/sizes.h> #include <asm/sizes.h>
#include <mach/hardware.h>
#include <mach/devices-common.h> #include <mach/devices-common.h>
static struct platform_device *__init imx_add_mxc_nand(resource_size_t iobase, #define imx_mxc_nand_data_entry_single(soc, _size) \
int irq, const struct mxc_nand_platform_data *pdata, { \
resource_size_t iosize) .iobase = soc ## _NFC_BASE_ADDR, \
.iosize = _size, \
.irq = soc ## _INT_NFC \
}
#ifdef CONFIG_SOC_IMX21
const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst =
imx_mxc_nand_data_entry_single(MX21, SZ_4K);
#endif /* ifdef CONFIG_SOC_IMX21 */
#ifdef CONFIG_ARCH_MX25
const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst =
imx_mxc_nand_data_entry_single(MX25, SZ_8K);
#endif /* ifdef CONFIG_ARCH_MX25 */
#ifdef CONFIG_SOC_IMX27
const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst =
imx_mxc_nand_data_entry_single(MX27, SZ_4K);
#endif /* ifdef CONFIG_SOC_IMX27 */
#ifdef CONFIG_ARCH_MX31
const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst =
imx_mxc_nand_data_entry_single(MX31, SZ_4K);
#endif
#ifdef CONFIG_ARCH_MX35
const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst =
imx_mxc_nand_data_entry_single(MX35, SZ_8K);
#endif
struct platform_device *__init imx_add_mxc_nand(
const struct imx_mxc_nand_data *data,
const struct mxc_nand_platform_data *pdata)
{ {
static int id = 0;
struct resource res[] = { struct resource res[] = {
{ {
.start = iobase, .start = data->iobase,
.end = iobase + iosize - 1, .end = data->iobase + data->iosize - 1,
.flags = IORESOURCE_MEM, .flags = IORESOURCE_MEM,
}, { }, {
.start = irq, .start = data->irq,
.end = irq, .end = data->irq,
.flags = IORESOURCE_IRQ, .flags = IORESOURCE_IRQ,
}, },
}; };
return imx_add_platform_device("mxc_nand", 0, res, ARRAY_SIZE(res),
return imx_add_platform_device("mxc_nand", id++, res, ARRAY_SIZE(res),
pdata, sizeof(*pdata)); pdata, sizeof(*pdata));
} }
struct platform_device *__init imx_add_mxc_nand_v1(resource_size_t iobase,
int irq, const struct mxc_nand_platform_data *pdata)
{
return imx_add_mxc_nand(iobase, irq, pdata, SZ_4K);
}
struct platform_device *__init imx_add_mxc_nand_v21(resource_size_t iobase,
int irq, const struct mxc_nand_platform_data *pdata)
{
return imx_add_mxc_nand(iobase, irq, pdata, SZ_8K);
}
...@@ -70,10 +70,14 @@ struct platform_device *__init imx_add_imx_uart_1irq( ...@@ -70,10 +70,14 @@ struct platform_device *__init imx_add_imx_uart_1irq(
const struct imxuart_platform_data *pdata); const struct imxuart_platform_data *pdata);
#include <mach/mxc_nand.h> #include <mach/mxc_nand.h>
struct platform_device *__init imx_add_mxc_nand_v1(resource_size_t iobase, struct imx_mxc_nand_data {
int irq, const struct mxc_nand_platform_data *pdata); resource_size_t iobase;
struct platform_device *__init imx_add_mxc_nand_v21(resource_size_t iobase, resource_size_t iosize;
int irq, const struct mxc_nand_platform_data *pdata); resource_size_t irq;
};
struct platform_device *__init imx_add_mxc_nand(
const struct imx_mxc_nand_data *data,
const struct mxc_nand_platform_data *pdata);
#include <mach/spi.h> #include <mach/spi.h>
struct imx_spi_imx_data { struct imx_spi_imx_data {
......
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
#define MX21_INT_GPT1 26 #define MX21_INT_GPT1 26
#define MX21_INT_WDOG 27 #define MX21_INT_WDOG 27
#define MX21_INT_PCMCIA 28 #define MX21_INT_PCMCIA 28
#define MX21_INT_NANDFC 29 #define MX21_INT_NFC 29
#define MX21_INT_BMI 30 #define MX21_INT_BMI 30
#define MX21_INT_CSI 31 #define MX21_INT_CSI 31
#define MX21_INT_DMACH0 32 #define MX21_INT_DMACH0 32
......
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
#define MX25_INT_KPP 24 #define MX25_INT_KPP 24
#define MX25_INT_DRYICE 25 #define MX25_INT_DRYICE 25
#define MX25_INT_UART2 32 #define MX25_INT_UART2 32
#define MX25_INT_NANDFC 33 #define MX25_INT_NFC 33
#define MX25_INT_LCDC 39 #define MX25_INT_LCDC 39
#define MX25_INT_UART5 40 #define MX25_INT_UART5 40
#define MX25_INT_CAN1 43 #define MX25_INT_CAN1 43
......
...@@ -167,7 +167,7 @@ static inline void mx27_setup_weimcs(size_t cs, ...@@ -167,7 +167,7 @@ static inline void mx27_setup_weimcs(size_t cs,
#define MX27_INT_GPT1 26 #define MX27_INT_GPT1 26
#define MX27_INT_WDOG 27 #define MX27_INT_WDOG 27
#define MX27_INT_PCMCIA 28 #define MX27_INT_PCMCIA 28
#define MX27_INT_NANDFC 29 #define MX27_INT_NFC 29
#define MX27_INT_ATA 30 #define MX27_INT_ATA 30
#define MX27_INT_CSI 31 #define MX27_INT_CSI 31
#define MX27_INT_DMACH0 32 #define MX27_INT_DMACH0 32
......
...@@ -168,7 +168,7 @@ static inline void mx31_setup_weimcs(size_t cs, ...@@ -168,7 +168,7 @@ static inline void mx31_setup_weimcs(size_t cs,
#define MX31_INT_POWER_FAIL 30 #define MX31_INT_POWER_FAIL 30
#define MX31_INT_CCM_DVFS 31 #define MX31_INT_CCM_DVFS 31
#define MX31_INT_UART2 32 #define MX31_INT_UART2 32
#define MX31_INT_NANDFC 33 #define MX31_INT_NFC 33
#define MX31_INT_SDMA 34 #define MX31_INT_SDMA 34
#define MX31_INT_USB1 35 #define MX31_INT_USB1 35
#define MX31_INT_USB2 36 #define MX31_INT_USB2 36
......
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
#define MX35_INT_GPT 29 #define MX35_INT_GPT 29
#define MX35_INT_POWER_FAIL 30 #define MX35_INT_POWER_FAIL 30
#define MX35_INT_UART2 32 #define MX35_INT_UART2 32
#define MX35_INT_NANDFC 33 #define MX35_INT_NFC 33
#define MX35_INT_SDMA 34 #define MX35_INT_SDMA 34
#define MX35_INT_USBHS 35 #define MX35_INT_USBHS 35
#define MX35_INT_USBOTG 37 #define MX35_INT_USBOTG 37
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment