From: Sean MacLennan <smaclennan@pikatech.com>
To: linuxppc-dev <linuxppc-dev@ozlabs.org>
Subject: [PATCH] port ndfc driver to arch/powerpc
Date: Fri, 1 Aug 2008 23:30:00 -0400 [thread overview]
Message-ID: <20080801233000.3574434f@lappy.seanm.ca> (raw)
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)
next reply other threads:[~2008-08-02 3:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-02 3:30 Sean MacLennan [this message]
2008-08-04 16:25 ` [PATCH] port ndfc driver to arch/powerpc 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080801233000.3574434f@lappy.seanm.ca \
--to=smaclennan@pikatech.com \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).