linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] port ndfc driver to arch/powerpc
@ 2008-08-02  3:30 Sean MacLennan
  2008-08-04 16:25 ` Arnd Bergmann
  0 siblings, 1 reply; 18+ messages in thread
From: Sean MacLennan @ 2008-08-02  3:30 UTC (permalink / raw)
  To: linuxppc-dev

This is a port of the ndfc driver from arch/ppc to arch/powerpc. Since
arch/ppc has been removed, references to CONFIG_PPC_MERGE where removed.

For an example of how to use the driver see
arch/powerpc/platforms/44x/warp-nand.c .

Signed-off-by: Sean MacLennan <smaclennan@pikatech.com>
---
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 02f9cc3..b0d408e 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -165,7 +165,7 @@ config MTD_NAND_S3C2410_HWECC
 
 config MTD_NAND_NDFC
 	tristate "NDFC NanD Flash Controller"
-	depends on 4xx && !PPC_MERGE
+	depends on 4xx
 	select MTD_NAND_ECC_SMC
 	help
 	 NDFC Nand Flash Controllers are integrated in IBM/AMCC's 4xx SoCs
diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
index 955959e..efb1ab6 100644
--- a/drivers/mtd/nand/ndfc.c
+++ b/drivers/mtd/nand/ndfc.c
@@ -21,14 +21,11 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/ndfc.h>
 #include <linux/mtd/mtd.h>
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
 #include <linux/platform_device.h>
 
 #include <asm/io.h>
-#ifdef CONFIG_40x
-#include <asm/ibm405.h>
-#else
-#include <asm/ibm44x.h>
-#endif
 
 struct ndfc_nand_mtd {
 	struct mtd_info			mtd;
@@ -103,8 +100,9 @@ static int ndfc_calculate_ecc(struct mtd_info *mtd,
 
 	wmb();
 	ecc = __raw_readl(ndfc->ndfcbase + NDFC_ECC);
-	ecc_code[0] = p[1];
-	ecc_code[1] = p[2];
+	/* The NDFC uses Smart Media (SMC) bytes order */
+	ecc_code[0] = p[2];
+	ecc_code[1] = p[1];
 	ecc_code[2] = p[3];
 
 	return 0;
@@ -234,11 +232,7 @@ static int ndfc_nand_probe(struct platform_device *pdev)
 	struct ndfc_controller *ndfc = &ndfc_ctrl;
 	unsigned long long phys = settings->ndfc_erpn | res->start;
 
-#ifndef CONFIG_PHYS_64BIT
 	ndfc->ndfcbase = ioremap((phys_addr_t)phys, res->end - res->start + 1);
-#else
-	ndfc->ndfcbase = ioremap64(phys, res->end - res->start + 1);
-#endif
 	if (!ndfc->ndfcbase) {
 		printk(KERN_ERR "NDFC: ioremap failed\n");
 		return -EIO;
@@ -300,9 +294,16 @@ static int __init ndfc_nand_init(void)
 	init_waitqueue_head(&ndfc_ctrl.ndfc_control.wq);
 
 	ret = platform_driver_register(&ndfc_nand_driver);
-	if (!ret)
-		ret = platform_driver_register(&ndfc_chip_driver);
-	return ret;
+	if (ret)
+		return ret;
+
+	ret = platform_driver_register(&ndfc_chip_driver);
+	if (ret) {
+		platform_driver_unregister(&ndfc_nand_driver);
+		return ret;
+	}
+
+	return 0;
 }
 
 static void __exit ndfc_nand_exit(void)

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2008-08-15 17:29 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-02  3:30 [PATCH] port ndfc driver to arch/powerpc Sean MacLennan
2008-08-04 16:25 ` Arnd Bergmann
2008-08-04 17:24   ` Sean MacLennan
2008-08-13 21:36     ` [PATCH 1/2] port ndfc driver to of platform Sean MacLennan
2008-08-14  9:53       ` Arnd Bergmann
2008-08-14 16:08         ` Sean MacLennan
2008-08-14 17:21           ` Sean MacLennan
2008-08-14 20:16           ` Arnd Bergmann
2008-08-14 20:54             ` Sean MacLennan
2008-08-14 23:10               ` Sean MacLennan
2008-08-15  7:27                 ` Arnd Bergmann
2008-08-15 17:29                   ` Sean MacLennan
2008-08-13 21:45     ` [PATCH 2/2] " Sean MacLennan
2008-08-14 10:08       ` Arnd Bergmann
2008-08-14 16:32         ` Jon Loeliger
2008-08-14 23:20         ` Sean MacLennan
2008-08-15  5:24           ` Sean MacLennan
2008-08-15  7:28             ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).