| 
									
										
										
										
											2010-06-15 18:14:19 +02:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (C) 2009-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 <asm/sizes.h>
 | 
					
						
							| 
									
										
										
										
											2012-09-14 14:14:45 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include "../hardware.h"
 | 
					
						
							| 
									
										
										
										
											2012-09-13 15:51:15 +08:00
										 |  |  | #include "devices-common.h"
 | 
					
						
							| 
									
										
										
										
											2010-06-15 18:14:19 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-15 13:34:09 +08:00
										 |  |  | #define imx_mxc_nand_data_entry_single(soc, _devid, _size)		\
 | 
					
						
							| 
									
										
										
										
											2010-08-23 11:25:52 +02:00
										 |  |  | 	{								\ | 
					
						
							| 
									
										
										
										
											2012-09-15 13:34:09 +08:00
										 |  |  | 		.devid = _devid,					\ | 
					
						
							| 
									
										
										
										
											2010-08-23 11:25:52 +02:00
										 |  |  | 		.iobase = soc ## _NFC_BASE_ADDR,			\ | 
					
						
							|  |  |  | 		.iosize = _size,					\ | 
					
						
							|  |  |  | 		.irq = soc ## _INT_NFC					\ | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-15 13:34:09 +08:00
										 |  |  | #define imx_mxc_nandv3_data_entry_single(soc, _devid, _size)		\
 | 
					
						
							| 
									
										
										
										
											2010-08-03 11:59:46 +02:00
										 |  |  | 	{								\ | 
					
						
							| 
									
										
										
										
											2012-09-15 13:34:09 +08:00
										 |  |  | 		.devid = _devid,					\ | 
					
						
							| 
									
										
										
										
											2010-08-03 11:59:46 +02:00
										 |  |  | 		.id = -1,						\ | 
					
						
							|  |  |  | 		.iobase = soc ## _NFC_BASE_ADDR,			\ | 
					
						
							|  |  |  | 		.iosize = _size,					\ | 
					
						
							|  |  |  | 		.axibase = soc ## _NFC_AXI_BASE_ADDR,			\ | 
					
						
							|  |  |  | 		.irq = soc ## _INT_NFC					\ | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-23 11:25:52 +02:00
										 |  |  | #ifdef CONFIG_SOC_IMX21
 | 
					
						
							|  |  |  | const struct imx_mxc_nand_data imx21_mxc_nand_data __initconst = | 
					
						
							| 
									
										
										
										
											2012-09-15 13:34:09 +08:00
										 |  |  | 	imx_mxc_nand_data_entry_single(MX21, "imx21-nand", SZ_4K); | 
					
						
							| 
									
										
										
										
											2010-08-23 11:25:52 +02:00
										 |  |  | #endif /* ifdef CONFIG_SOC_IMX21 */
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-11 18:35:01 +01:00
										 |  |  | #ifdef CONFIG_SOC_IMX25
 | 
					
						
							| 
									
										
										
										
											2010-08-23 11:25:52 +02:00
										 |  |  | const struct imx_mxc_nand_data imx25_mxc_nand_data __initconst = | 
					
						
							| 
									
										
										
										
											2012-09-15 13:34:09 +08:00
										 |  |  | 	imx_mxc_nand_data_entry_single(MX25, "imx25-nand", SZ_8K); | 
					
						
							| 
									
										
										
										
											2010-11-11 18:35:01 +01:00
										 |  |  | #endif /* ifdef CONFIG_SOC_IMX25 */
 | 
					
						
							| 
									
										
										
										
											2010-08-23 11:25:52 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifdef CONFIG_SOC_IMX27
 | 
					
						
							|  |  |  | const struct imx_mxc_nand_data imx27_mxc_nand_data __initconst = | 
					
						
							| 
									
										
										
										
											2012-09-15 13:34:09 +08:00
										 |  |  | 	imx_mxc_nand_data_entry_single(MX27, "imx27-nand", SZ_4K); | 
					
						
							| 
									
										
										
										
											2010-08-23 11:25:52 +02:00
										 |  |  | #endif /* ifdef CONFIG_SOC_IMX27 */
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-12 10:11:42 +01:00
										 |  |  | #ifdef CONFIG_SOC_IMX31
 | 
					
						
							| 
									
										
										
										
											2010-08-23 11:25:52 +02:00
										 |  |  | const struct imx_mxc_nand_data imx31_mxc_nand_data __initconst = | 
					
						
							| 
									
										
										
										
											2012-09-15 13:34:09 +08:00
										 |  |  | 	imx_mxc_nand_data_entry_single(MX31, "imx27-nand", SZ_4K); | 
					
						
							| 
									
										
										
										
											2010-08-23 11:25:52 +02:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-12 10:11:42 +01:00
										 |  |  | #ifdef CONFIG_SOC_IMX35
 | 
					
						
							| 
									
										
										
										
											2010-08-23 11:25:52 +02:00
										 |  |  | const struct imx_mxc_nand_data imx35_mxc_nand_data __initconst = | 
					
						
							| 
									
										
										
										
											2012-09-15 13:34:09 +08:00
										 |  |  | 	imx_mxc_nand_data_entry_single(MX35, "imx25-nand", SZ_8K); | 
					
						
							| 
									
										
										
										
											2010-08-23 11:25:52 +02:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-11-26 12:25:58 -02:00
										 |  |  | #ifdef CONFIG_SOC_IMX51
 | 
					
						
							| 
									
										
										
										
											2010-08-03 11:59:46 +02:00
										 |  |  | const struct imx_mxc_nand_data imx51_mxc_nand_data __initconst = | 
					
						
							| 
									
										
										
										
											2012-09-15 13:34:09 +08:00
										 |  |  | 	imx_mxc_nandv3_data_entry_single(MX51, "imx51-nand", SZ_16K); | 
					
						
							| 
									
										
										
										
											2010-08-03 11:59:46 +02:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-23 11:25:52 +02:00
										 |  |  | struct platform_device *__init imx_add_mxc_nand( | 
					
						
							|  |  |  | 		const struct imx_mxc_nand_data *data, | 
					
						
							|  |  |  | 		const struct mxc_nand_platform_data *pdata) | 
					
						
							| 
									
										
										
										
											2010-06-15 18:14:19 +02:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2010-08-03 11:59:46 +02:00
										 |  |  | 	/* AXI has to come first, that's how the mxc_nand driver expect it */ | 
					
						
							| 
									
										
										
										
											2010-06-15 18:14:19 +02:00
										 |  |  | 	struct resource res[] = { | 
					
						
							|  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2010-08-23 11:25:52 +02:00
										 |  |  | 			.start = data->iobase, | 
					
						
							|  |  |  | 			.end = data->iobase + data->iosize - 1, | 
					
						
							| 
									
										
										
										
											2010-06-15 18:14:19 +02:00
										 |  |  | 			.flags = IORESOURCE_MEM, | 
					
						
							|  |  |  | 		}, { | 
					
						
							| 
									
										
										
										
											2010-08-23 11:25:52 +02:00
										 |  |  | 			.start = data->irq, | 
					
						
							|  |  |  | 			.end = data->irq, | 
					
						
							| 
									
										
										
										
											2010-06-15 18:14:19 +02:00
										 |  |  | 			.flags = IORESOURCE_IRQ, | 
					
						
							| 
									
										
										
										
											2012-06-06 12:33:14 +02:00
										 |  |  | 		}, { | 
					
						
							|  |  |  | 			.start = data->axibase, | 
					
						
							|  |  |  | 			.end = data->axibase + SZ_16K - 1, | 
					
						
							|  |  |  | 			.flags = IORESOURCE_MEM, | 
					
						
							| 
									
										
										
										
											2010-06-15 18:14:19 +02:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 	}; | 
					
						
							| 
									
										
										
										
											2012-09-15 13:34:09 +08:00
										 |  |  | 	return imx_add_platform_device(data->devid, data->id, | 
					
						
							| 
									
										
										
										
											2012-06-06 12:33:14 +02:00
										 |  |  | 			res, ARRAY_SIZE(res) - !data->axibase, | 
					
						
							| 
									
										
										
										
											2010-06-15 18:14:19 +02:00
										 |  |  | 			pdata, sizeof(*pdata)); | 
					
						
							|  |  |  | } |