Uwe Kleine-König | 66384ee | 2010-06-15 18:14:19 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009-2010 Pengutronix |
| 3 | * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify it under |
| 6 | * the terms of the GNU General Public License version 2 as published by the |
| 7 | * Free Software Foundation. |
| 8 | */ |
| 9 | #include <asm/sizes.h> |
Shawn Guo | 50f2de6 | 2012-09-14 14:14:45 +0800 | [diff] [blame] | 10 | |
| 11 | #include "../hardware.h" |
Shawn Guo | e0557c0 | 2012-09-13 15:51:15 +0800 | [diff] [blame] | 12 | #include "devices-common.h" |
Uwe Kleine-König | 66384ee | 2010-06-15 18:14:19 +0200 | [diff] [blame] | 13 | |
Shawn Guo | 4d62435 | 2012-09-15 13:34:09 +0800 | [diff] [blame] | 14 | #define imx_mxc_nand_data_entry_single(soc, _devid, _size) \ |
Uwe Kleine-König | 00b57bf | 2010-08-23 11:25:52 +0200 | [diff] [blame] | 15 | { \ |
Shawn Guo | 4d62435 | 2012-09-15 13:34:09 +0800 | [diff] [blame] | 16 | .devid = _devid, \ |
Uwe Kleine-König | 00b57bf | 2010-08-23 11:25:52 +0200 | [diff] [blame] | 17 | .iobase = soc ## _NFC_BASE_ADDR, \ |
| 18 | .iosize = _size, \ |
| 19 | .irq = soc ## _INT_NFC \ |
| 20 | } |
| 21 | |
Shawn Guo | 4d62435 | 2012-09-15 13:34:09 +0800 | [diff] [blame] | 22 | #define imx_mxc_nandv3_data_entry_single(soc, _devid, _size) \ |
Sascha Hauer | 63a7c6d | 2010-08-03 11:59:46 +0200 | [diff] [blame] | 23 | { \ |
Shawn Guo | 4d62435 | 2012-09-15 13:34:09 +0800 | [diff] [blame] | 24 | .devid = _devid, \ |
Sascha Hauer | 63a7c6d | 2010-08-03 11:59:46 +0200 | [diff] [blame] | 25 | .id = -1, \ |
| 26 | .iobase = soc ## _NFC_BASE_ADDR, \ |
| 27 | .iosize = _size, \ |
| 28 | .axibase = soc ## _NFC_AXI_BASE_ADDR, \ |
| 29 | .irq = soc ## _INT_NFC \ |
| 30 | } |
| 31 | |
Uwe Kleine-König | 00b57bf | 2010-08-23 11:25:52 +0200 | [diff] [blame] | 32 | #ifdef CONFIG_SOC_IMX21 |
| 33 | const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst = |
Shawn Guo | 4d62435 | 2012-09-15 13:34:09 +0800 | [diff] [blame] | 34 | imx_mxc_nand_data_entry_single(MX21, "imx21-nand", SZ_4K); |
Uwe Kleine-König | 00b57bf | 2010-08-23 11:25:52 +0200 | [diff] [blame] | 35 | #endif /* ifdef CONFIG_SOC_IMX21 */ |
| 36 | |
Uwe Kleine-König | 972cc48 | 2010-11-11 18:35:01 +0100 | [diff] [blame] | 37 | #ifdef CONFIG_SOC_IMX25 |
Uwe Kleine-König | 00b57bf | 2010-08-23 11:25:52 +0200 | [diff] [blame] | 38 | const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst = |
Shawn Guo | 4d62435 | 2012-09-15 13:34:09 +0800 | [diff] [blame] | 39 | imx_mxc_nand_data_entry_single(MX25, "imx25-nand", SZ_8K); |
Uwe Kleine-König | 972cc48 | 2010-11-11 18:35:01 +0100 | [diff] [blame] | 40 | #endif /* ifdef CONFIG_SOC_IMX25 */ |
Uwe Kleine-König | 00b57bf | 2010-08-23 11:25:52 +0200 | [diff] [blame] | 41 | |
| 42 | #ifdef CONFIG_SOC_IMX27 |
| 43 | const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst = |
Shawn Guo | 4d62435 | 2012-09-15 13:34:09 +0800 | [diff] [blame] | 44 | imx_mxc_nand_data_entry_single(MX27, "imx27-nand", SZ_4K); |
Uwe Kleine-König | 00b57bf | 2010-08-23 11:25:52 +0200 | [diff] [blame] | 45 | #endif /* ifdef CONFIG_SOC_IMX27 */ |
| 46 | |
Uwe Kleine-König | a528bc8 | 2010-11-12 10:11:42 +0100 | [diff] [blame] | 47 | #ifdef CONFIG_SOC_IMX31 |
Uwe Kleine-König | 00b57bf | 2010-08-23 11:25:52 +0200 | [diff] [blame] | 48 | const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst = |
Shawn Guo | 4d62435 | 2012-09-15 13:34:09 +0800 | [diff] [blame] | 49 | imx_mxc_nand_data_entry_single(MX31, "imx27-nand", SZ_4K); |
Uwe Kleine-König | 00b57bf | 2010-08-23 11:25:52 +0200 | [diff] [blame] | 50 | #endif |
| 51 | |
Uwe Kleine-König | a528bc8 | 2010-11-12 10:11:42 +0100 | [diff] [blame] | 52 | #ifdef CONFIG_SOC_IMX35 |
Uwe Kleine-König | 00b57bf | 2010-08-23 11:25:52 +0200 | [diff] [blame] | 53 | const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst = |
Shawn Guo | 4d62435 | 2012-09-15 13:34:09 +0800 | [diff] [blame] | 54 | imx_mxc_nand_data_entry_single(MX35, "imx25-nand", SZ_8K); |
Uwe Kleine-König | 00b57bf | 2010-08-23 11:25:52 +0200 | [diff] [blame] | 55 | #endif |
| 56 | |
Fabio Estevam | d94ed12 | 2010-11-26 12:25:58 -0200 | [diff] [blame] | 57 | #ifdef CONFIG_SOC_IMX51 |
Sascha Hauer | 63a7c6d | 2010-08-03 11:59:46 +0200 | [diff] [blame] | 58 | const struct imx_mxc_nand_data imx51_mxc_nand_data __initconst = |
Shawn Guo | 4d62435 | 2012-09-15 13:34:09 +0800 | [diff] [blame] | 59 | imx_mxc_nandv3_data_entry_single(MX51, "imx51-nand", SZ_16K); |
Sascha Hauer | 63a7c6d | 2010-08-03 11:59:46 +0200 | [diff] [blame] | 60 | #endif |
| 61 | |
Uwe Kleine-König | 00b57bf | 2010-08-23 11:25:52 +0200 | [diff] [blame] | 62 | struct platform_device *__init imx_add_mxc_nand( |
| 63 | const struct imx_mxc_nand_data *data, |
| 64 | const struct mxc_nand_platform_data *pdata) |
Uwe Kleine-König | 66384ee | 2010-06-15 18:14:19 +0200 | [diff] [blame] | 65 | { |
Sascha Hauer | 63a7c6d | 2010-08-03 11:59:46 +0200 | [diff] [blame] | 66 | /* AXI has to come first, that's how the mxc_nand driver expect it */ |
Uwe Kleine-König | 66384ee | 2010-06-15 18:14:19 +0200 | [diff] [blame] | 67 | struct resource res[] = { |
| 68 | { |
Uwe Kleine-König | 00b57bf | 2010-08-23 11:25:52 +0200 | [diff] [blame] | 69 | .start = data->iobase, |
| 70 | .end = data->iobase + data->iosize - 1, |
Uwe Kleine-König | 66384ee | 2010-06-15 18:14:19 +0200 | [diff] [blame] | 71 | .flags = IORESOURCE_MEM, |
| 72 | }, { |
Uwe Kleine-König | 00b57bf | 2010-08-23 11:25:52 +0200 | [diff] [blame] | 73 | .start = data->irq, |
| 74 | .end = data->irq, |
Uwe Kleine-König | 66384ee | 2010-06-15 18:14:19 +0200 | [diff] [blame] | 75 | .flags = IORESOURCE_IRQ, |
Sascha Hauer | 71885b6 | 2012-06-06 12:33:14 +0200 | [diff] [blame] | 76 | }, { |
| 77 | .start = data->axibase, |
| 78 | .end = data->axibase + SZ_16K - 1, |
| 79 | .flags = IORESOURCE_MEM, |
Uwe Kleine-König | 66384ee | 2010-06-15 18:14:19 +0200 | [diff] [blame] | 80 | }, |
| 81 | }; |
Shawn Guo | 4d62435 | 2012-09-15 13:34:09 +0800 | [diff] [blame] | 82 | return imx_add_platform_device(data->devid, data->id, |
Sascha Hauer | 71885b6 | 2012-06-06 12:33:14 +0200 | [diff] [blame] | 83 | res, ARRAY_SIZE(res) - !data->axibase, |
Uwe Kleine-König | 66384ee | 2010-06-15 18:14:19 +0200 | [diff] [blame] | 84 | pdata, sizeof(*pdata)); |
| 85 | } |