Skip to contentSkip to conversation

resend Freescale i.MX2 NAND driver

PATCH In review Sascha Hauer 2 participants 4 messages Aug 27, 2008 – Sep 2, 2008

Subsystems (5)
lore
Share & tools
lore

Sascha Hauer

author maintainer
#0 lore raw

PATCH 1/1 resend Freescale i.MX2 NAND driver

Hi list, David,

I received no reactions on this so far, so I send this one again. I would be glad to see this in 2.6.28. Any comments on the patch?

Sascha

Changes from the last version I sent:

- replace ioread/iowrite with read[bwl]/write[bwl]
- remove lowlevel erase function

This patch adds support for the integrated NAND flash controller of the i.MX2 and i.MX3 family. It is tested on MX27 but should work on MX3 aswell.

---
 arch/arm/mach-mx2/devices.c               |   19 
 arch/arm/mach-mx2/devices.h               |    2 
 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               | 1075 ++++++++++++++++++++++++++++++
 6 files changed, 1130 insertions(+), 1 deletion(-)
arm/mach-mx2/devices.c renamed from arm/mach-mx2/devices.c.orig +19 -0
Index: arch/arm/mach-mx2/devices.c
===================================================================
@@ -190,6 +190,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] = {
mtd/nand/Kconfig renamed from 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
mtd/nand/Makefile renamed from 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
mtd/nand/mxc_nand.c new file +1075 -0

1,075 lines not on this page · raw message

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 */
arm/mach-mx2/devices.h renamed from arm/mach-mx2/devices.h.orig +1 -1
Index: arch/arm/mach-mx2/devices.h
===================================================================
@@ -12,4 +12,4 @@ extern struct platform_device mxc_uart_d
 extern struct platform_device mxc_uart_device3;
 extern struct platform_device mxc_uart_device4;
 extern struct platform_device mxc_uart_device5;
-
+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
#1 lore raw
Quoted 2 lines · Sascha Hauer

I received no reactions on this so far, so I send this one again. I would be glad to see this in 2.6.28. Any comments on the patch?

Can I have a version which applies to the current git tree, please?

Signature · 2 lines
David Woodhouse                            Open Source Technology Centre
[email protected]                              Intel Corporation
author maintainer Acked-by Juergen Beisert
#2 lore raw
Quoted 5 lines · David Woodhouse
Quoted 2 lines · Sascha Hauer

I received no reactions on this so far, so I send this one again. I would be glad to see this in 2.6.28. Any comments on the patch?

Can I have a version which applies to the current git tree, please?

Of course. I just removed the arch/arm chunks. They better go via rmk anyway since there are some mx27 related changes pending.

Sascha

This patch adds support for the integrated NAND flash controller of the i.MX2 and i.MX3 family. It is tested on MX27 but should work on MX3 aswell.

---
 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               | 1075 ++++++++++++++++++++++++++++++
 4 files changed, 1110 insertions(+)
drivers/mtd/nand/Kconfig +7 -0
Index: linux-2.6/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 +1 -0
Index: linux-2.6/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 +896 -0

896 lines not on this page · raw message

arch/arm/plat-mxc/include/mach/mxc_nand.h new file +27 -0
Index: linux-2.6/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 */
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
author maintainer Acked-by Juergen Beisert
#3 lore raw
In reply to David Woodhouse
Quoted 5 lines · David Woodhouse
Quoted 2 lines · Sascha Hauer

I received no reactions on this so far, so I send this one again. I would be glad to see this in 2.6.28. Any comments on the patch?

Can I have a version which applies to the current git tree, please?

Another try, checkpatch.pl cleaned this time. Sorry for the noise

Sascha

This patch adds support for the integrated NAND flash controller of the i.MX2 and i.MX3 family. It is tested on MX27 but should work on MX3 aswell.

---
 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               | 1077 ++++++++++++++++++++++++++++++
 4 files changed, 1112 insertions(+)
drivers/mtd/nand/Kconfig +7 -0
Index: linux-2.6/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 +1 -0
Index: linux-2.6/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 +972 -0

972 lines not on this page · raw message

arch/arm/plat new file +0 -0
Index: linux-2.6/arch/arm/plat-mxc/include/mach/mxc_nand.h
===================================================================

+ * 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 */

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