Skip to contentSkip to conversation

NAND support for Freescale i.MX27 (and probably i.MX31)

PATCH New Sascha Hauer 1 participant 1 message Aug 19, 2008

Subsystems (5)
lore
Share & tools
lore

Sascha Hauer

author maintainer
#0 lore raw

PATCH 1/1 NAND support for Freescale i.MX27 (and probably i.MX31)

Subject: [ARM] MXC family: Add NAND flash controller driver
From: Sascha Hauer <[email protected]>

This patch adds support for the integrated NAND flash controller of the i.MX2 and i.MX3 family. Any comments welcome

Sascha

---
 arch/arm/mach-mx2/devices.c               |   19 
 arch/arm/mach-mx2/devices.h               |    1 
 arch/arm/plat-mxc/include/mach/mxc_nand.h |   27 
 drivers/mtd/nand/Kconfig                  |    7 
 drivers/mtd/nand/Makefile                 |    1 
 drivers/mtd/nand/mxc_nand.c               | 1109 ++++++++++++++++++++++++++++++
 6 files changed, 1164 insertions(+)
arch/arm/mach-mx2/devices.c renamed from arch/arm/mach-mx2/devices.c.orig +19 -0
Index: arch/arm/mach-mx2/devices.c
===================================================================
@@ -201,6 +201,25 @@ struct platform_device mxc_wdt = {
 	.resource = mxc_wdt_resources,
 };
 
+static struct resource mxc_nand_resources[] = {
+	{
+		.start	= NFC_BASE_ADDR,
+		.end	= NFC_BASE_ADDR + 0xfff,
+		.flags	= IORESOURCE_MEM
+	}, {
+		.start	= MXC_INT_NANDFC,
+		.end	= MXC_INT_NANDFC,
+		.flags	= IORESOURCE_IRQ
+	},
+};
+
+struct platform_device mxc_nand_device = {
+	.name = "mxc_nand",
+	.id = 0,
+	.num_resources = ARRAY_SIZE(mxc_nand_resources),
+	.resource = mxc_nand_resources,
+};
+
 /* GPIO port description */
 static struct mxc_gpio_port imx_gpio_ports[] = {
 	[0] = {
drivers/mtd/nand/Kconfig renamed from drivers/mtd/nand/Kconfig.orig +7 -0
Index: drivers/mtd/nand/Kconfig
===================================================================
@@ -406,4 +406,11 @@ config MTD_NAND_FSL_UPM
 	  Enables support for NAND Flash chips wired onto Freescale PowerPC
 	  processor localbus with User-Programmable Machine support.
 
+config MTD_NAND_MXC
+	tristate "MXC NAND support"
+	depends on ARCH_MX2
+	help
+	  This enables the driver for the NAND flash controller on the
+	  MXC processors.
+
 endif # MTD_NAND
drivers/mtd/nand/Makefile renamed from drivers/mtd/nand/Makefile.orig +1 -0
Index: drivers/mtd/nand/Makefile
===================================================================
@@ -34,5 +34,6 @@ obj-$(CONFIG_MTD_NAND_PASEMI)		+= pasemi
 obj-$(CONFIG_MTD_NAND_ORION)		+= orion_nand.o
 obj-$(CONFIG_MTD_NAND_FSL_ELBC)		+= fsl_elbc_nand.o
 obj-$(CONFIG_MTD_NAND_FSL_UPM)		+= fsl_upm.o
+obj-$(CONFIG_MTD_NAND_MXC)		+= mxc_nand.o
 
 nand-objs := nand_base.o nand_bbt.o
drivers/mtd/nand/mxc_nand.c new file +1109 -0

1,109 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/mxc_nand.h new file +27 -0
Index: arch/arm/plat-mxc/include/mach/mxc_nand.h
===================================================================
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Copyright 2008 Sascha Hauer, [email protected]
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#ifndef __ASM_ARCH_NAND_H
+#define __ASM_ARCH_NAND_H
+
+struct mxc_nand_platform_data {
+	int width;	/* data bus width in bytes */
+	int hw_ecc;	/* 0 if supress hardware ECC */
+};
+#endif /* __ASM_ARCH_NAND_H */
arch/arm/mach-mx2/devices.h renamed from arch/arm/mach-mx2/devices.h.orig +1 -0
Index: arch/arm/mach-mx2/devices.h
===================================================================
@@ -13,3 +13,4 @@ extern struct platform_device mxc_uart_d
 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_nand_device;
Signature · 4 lines
 Pengutronix - Linux Solutions for Science and Industry
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
     Hannoversche Str. 2, 31134 Hildesheim, Germany
   Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9