ar71xx: remove a non-upstream spi core patch
[openwrt/openwrt.git] / target / linux / ar71xx / files / drivers / mtd / nand / rb4xx_nand.c
index d6c684309dc7059fff179793c0d41083942afc7e..981bfcf69d4a328f7ea8e1cf8ced349ee6978400 100644 (file)
@@ -12,6 +12,8 @@
  *  by the Free Software Foundation.
  */
 
+#include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/init.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/mtd.h>
@@ -22,8 +24,8 @@
 #include <linux/gpio.h>
 #include <linux/slab.h>
 
-#include <asm/mach-ar71xx/ar71xx.h>
-#include <asm/mach-ar71xx/rb4xx_cpld.h>
+#include <asm/mach-ath79/ath79.h>
+#include <asm/mach-ath79/rb4xx_cpld.h>
 
 #define DRV_NAME        "rb4xx-nand"
 #define DRV_VERSION     "0.2.0"
@@ -60,7 +62,7 @@ static struct mtd_partition rb4xx_nand_partitions[] = {
        {
                .name   = "kernel",
                .offset = (256 * 1024),
-               .size   = (6 * 1024 * 1024) - (256 * 1024),
+               .size   = (4 * 1024 * 1024) - (256 * 1024),
        },
        {
                .name   = "rootfs",
@@ -105,7 +107,7 @@ static unsigned char rb4xx_nand_read_byte(struct mtd_info *mtd)
        unsigned char data = 0;
        int err;
 
-       err = rb4xx_cpld_read(&data, NULL, 1);
+       err = rb4xx_cpld_read(&data, 1);
        if (err) {
                pr_err("rb4xx_nand: read data failed, err=%d\n", err);
                data = 0xff;
@@ -129,12 +131,12 @@ static void rb4xx_nand_read_buf(struct mtd_info *mtd, unsigned char *buf,
 {
        int err;
 
-       err = rb4xx_cpld_read(buf, NULL, len);
+       err = rb4xx_cpld_read(buf, len);
        if (err)
                pr_err("rb4xx_nand: read buf failed, err=%d\n", err);
 }
 
-static int __init rb4xx_nand_probe(struct platform_device *pdev)
+static int rb4xx_nand_probe(struct platform_device *pdev)
 {
        struct rb4xx_nand_info  *info;
        int ret;
@@ -213,17 +215,13 @@ static int __init rb4xx_nand_probe(struct platform_device *pdev)
        info->chip.read_byte    = rb4xx_nand_read_byte;
        info->chip.write_buf    = rb4xx_nand_write_buf;
        info->chip.read_buf     = rb4xx_nand_read_buf;
-#if 0
-       info->chip.verify_buf   = rb4xx_nand_verify_buf;
-#endif
 
        info->chip.chip_delay   = 25;
        info->chip.ecc.mode     = NAND_ECC_SOFT;
-       info->chip.options      |= NAND_NO_AUTOINCR;
 
        platform_set_drvdata(pdev, info);
 
-       ret = nand_scan_ident(&info->mtd, 1);
+       ret = nand_scan_ident(&info->mtd, 1, NULL);
        if (ret) {
                ret = -ENXIO;
                goto err_free_info;
@@ -238,12 +236,8 @@ static int __init rb4xx_nand_probe(struct platform_device *pdev)
                goto err_set_drvdata;
        }
 
-#ifdef CONFIG_MTD_PARTITIONS
-       ret = add_mtd_partitions(&info->mtd, rb4xx_nand_partitions,
+       mtd_device_register(&info->mtd, rb4xx_nand_partitions,
                                ARRAY_SIZE(rb4xx_nand_partitions));
-#else
-       ret = add_mtd_device(&info->mtd);
-#endif
        if (ret)
                goto err_release_nand;
 
@@ -267,7 +261,7 @@ err:
        return ret;
 }
 
-static int __devexit rb4xx_nand_remove(struct platform_device *pdev)
+static int rb4xx_nand_remove(struct platform_device *pdev)
 {
        struct rb4xx_nand_info *info = platform_get_drvdata(pdev);
 
@@ -284,7 +278,7 @@ static int __devexit rb4xx_nand_remove(struct platform_device *pdev)
 
 static struct platform_driver rb4xx_nand_driver = {
        .probe  = rb4xx_nand_probe,
-       .remove = __devexit_p(rb4xx_nand_remove),
+       .remove = rb4xx_nand_remove,
        .driver = {
                .name   = DRV_NAME,
                .owner  = THIS_MODULE,