diff options
author | Florian Fainelli <florian@openwrt.org> | 2007-10-08 09:39:38 +0000 |
---|---|---|
committer | Florian Fainelli <florian@openwrt.org> | 2007-10-08 09:39:38 +0000 |
commit | 91298e7d33bf3aa1e63376a982688a8e3e9b6151 (patch) | |
tree | a6f3626a3708becb2a9a625b2c1273f45e587590 /target/linux/rb532 | |
parent | 73bf41af854bbbb4e9b0c62845282c491c48cd94 (diff) | |
download | master-187ad058-91298e7d33bf3aa1e63376a982688a8e3e9b6151.tar.gz master-187ad058-91298e7d33bf3aa1e63376a982688a8e3e9b6151.tar.bz2 master-187ad058-91298e7d33bf3aa1e63376a982688a8e3e9b6151.zip |
Remove the old rbmipsnand driver, we now use the plat_nand driver
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@9188 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/rb532')
-rw-r--r-- | target/linux/rb532/files/drivers/mtd/nand/rbmipsnand.c | 219 | ||||
-rw-r--r-- | target/linux/rb532/patches/500-Nand.patch | 29 |
2 files changed, 0 insertions, 248 deletions
diff --git a/target/linux/rb532/files/drivers/mtd/nand/rbmipsnand.c b/target/linux/rb532/files/drivers/mtd/nand/rbmipsnand.c deleted file mode 100644 index 1db33a252f..0000000000 --- a/target/linux/rb532/files/drivers/mtd/nand/rbmipsnand.c +++ /dev/null @@ -1,219 +0,0 @@ -#include <linux/io.h> -#include <linux/module.h> -#include <linux/platform_device.h> -#include <linux/mtd/nand.h> -#include <linux/mtd/mtd.h> -#include <linux/mtd/partitions.h> -#include <linux/delay.h> - -#include <asm/io.h> -#include <asm/irq.h> -#include <asm/bootinfo.h> - -#define IDT434_REG_BASE ((volatile void *) KSEG1ADDR(0x18000000)) - -#define GPIOF 0x050000 -#define GPIOC 0x050004 -#define GPIOD 0x050008 - -#define GPIO_RDY (1 << 0x08) -#define GPIO_WPX (1 << 0x09) -#define GPIO_ALE (1 << 0x0a) -#define GPIO_CLE (1 << 0x0b) - -#define DEV2BASE 0x010020 - -#define LO_WPX (1 << 0) -#define LO_ALE (1 << 1) -#define LO_CLE (1 << 2) -#define LO_CEX (1 << 3) -#define LO_FOFF (1 << 5) -#define LO_SPICS (1 << 6) -#define LO_ULED (1 << 7) - -#define MEM32(x) *((volatile unsigned *) (x)) - -extern char *board_type; - -struct rb500_nand_info { - struct nand_chip chip; - struct mtd_info mtd; - void __iomem *io_base; -#ifdef CONFIG_MTD_PARTITIONS - int nr_parts; - struct mtd_partition *parts; -#endif - int init_ok; - int flags1; - int flags2; -}; - -static struct mtd_partition partition_info[] = { - { - name:"RouterBoard NAND Boot", - offset:0, - size:4 * 1024 * 1024}, - { - name:"rootfs", - offset:MTDPART_OFS_NXTBLK, - size:MTDPART_SIZ_FULL} -}; - -extern void changeLatchU5(unsigned char orMask, unsigned char nandMask); - -static int rb500_dev_ready(struct mtd_info *mtd) -{ - return MEM32(IDT434_REG_BASE + GPIOD) & GPIO_RDY; -} - -/* - * hardware specific access to control-lines - * - * ctrl: - * NAND_CLE: bit 2 -> bit 3 - * NAND_ALE: bit 3 -> bit 2 - */ -static void rbmips_hwcontrol500(struct mtd_info *mtd, int cmd, - unsigned int ctrl) -{ - struct nand_chip *chip = mtd->priv; - unsigned char orbits, nandbits; - - if (ctrl & NAND_CTRL_CHANGE) { - - orbits = (ctrl & NAND_CLE) << 1; - orbits |= (ctrl & NAND_ALE) >> 1; - - nandbits = (~ctrl & NAND_CLE) << 1; - nandbits |= (~ctrl & NAND_ALE) >> 1; - - changeLatchU5(orbits, nandbits); - } - if (cmd != NAND_CMD_NONE) - writeb(cmd, chip->IO_ADDR_W); - -} - -unsigned get_rbnand_block_size(struct rb500_nand_info *data) -{ - if (data->init_ok) - return data->mtd.writesize; - else - return 0; -} - -EXPORT_SYMBOL(get_rbnand_block_size); - -static int rbmips_probe(struct platform_device *pdev) -{ - struct rb500_nand_info *data; - int res = 0; - int *b; - - /* Allocate memory for the structure */ - data = kzalloc(sizeof(*data), GFP_KERNEL); - if (!data) { - dev_err(&pdev->dev, "Failed to allocate device structure\n"); - return -ENOMEM; - } - - data->io_base = ioremap(pdev->resource[0].start, pdev->resource[0].end - pdev->resource[0].start + 1); - - if (data->io_base == NULL) { - dev_err(&pdev->dev, "ioremap failed\n"); - kfree(data); - return -EIO; - } - - if (!strcmp(board_type, "500r5")) { - data->flags1 = LO_FOFF | LO_CEX; - data->flags2 = LO_ULED | LO_ALE | LO_CLE | LO_WPX; - } - else { - data->flags1 = LO_WPX | LO_FOFF | LO_CEX; - data->flags2 = LO_ULED | LO_ALE | LO_CLE; - } - - changeLatchU5(data->flags1, data->flags2); - - data->chip.cmd_ctrl = rbmips_hwcontrol500; - - data->chip.dev_ready = rb500_dev_ready; - data->chip.IO_ADDR_W = (unsigned char *)KSEG1ADDR(MEM32(IDT434_REG_BASE + DEV2BASE)); - data->chip.IO_ADDR_R = data->chip.IO_ADDR_W; - - data->chip.ecc.mode = NAND_ECC_SOFT; - data->chip.chip_delay = 25; - data->chip.options |= NAND_NO_AUTOINCR; - - data->chip.priv = &data; - data->mtd.priv = &data->chip; - data->mtd.owner = THIS_MODULE; - - b = (int *) KSEG1ADDR(0x18010020); - printk("dev2base 0x%08x mask 0x%08x c 0x%08x tc 0x%08x\n", b[0], - b[1], b[2], b[3]); - - platform_set_drvdata(pdev, data); - - /* Why do we need to scan 4 times ? */ - if (nand_scan(&data->mtd, 1) && nand_scan(&data->mtd, 1) && nand_scan(&data->mtd, 1) && nand_scan(&data->mtd, 1)) { - printk(KERN_INFO "RB500 nand device not found\n"); - res = -ENXIO; - goto out; - } - - printk(KERN_INFO "RB500 NAND\n"); - add_mtd_partitions(&data->mtd, partition_info, 2); - data->init_ok = 1; - - res = add_mtd_device(&data->mtd); - if (!res) - return res; - - nand_release(&data->mtd); -out: - platform_set_drvdata(pdev, NULL); - iounmap(data->io_base); - kfree(data); - return res; -} - -static int __devexit rbmips_remove(struct platform_device *pdev) -{ - struct rb500_nand_info *data = platform_get_drvdata(pdev); - - nand_release(&data->mtd); - iounmap(data->io_base); - kfree(data); - - return 0; -} - -static struct platform_driver rb500_nand_driver = { - .probe = rbmips_probe, - .remove = rbmips_remove, - .driver = { - .name = "rb500-nand", - .owner = THIS_MODULE, - }, -}; - -static int __init rb500_nand_init(void) -{ - int err; - err = platform_driver_register(&rb500_nand_driver); - return err; -} - -static void __exit rb500_nand_exit(void) -{ - platform_driver_unregister(&rb500_nand_driver); -} - -module_init(rb500_nand_init); -module_exit(rb500_nand_exit); - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("David Goodenough, Felix Fietkau, Florian Fainelli"); -MODULE_DESCRIPTION("RouterBOARD 500 NAND driver"); diff --git a/target/linux/rb532/patches/500-Nand.patch b/target/linux/rb532/patches/500-Nand.patch deleted file mode 100644 index 7e4cb65c77..0000000000 --- a/target/linux/rb532/patches/500-Nand.patch +++ /dev/null @@ -1,29 +0,0 @@ -Index: linux-2.6.21.1/drivers/mtd/nand/Kconfig -=================================================================== ---- linux-2.6.21.1.orig/drivers/mtd/nand/Kconfig 2007-04-27 23:49:26.000000000 +0200 -+++ linux-2.6.21.1/drivers/mtd/nand/Kconfig 2007-06-07 01:31:30.927069952 +0200 -@@ -75,6 +75,12 @@ - help - Support for NAND flash on Technologic Systems TS-7250 platform. - -+config MTD_NAND_RB500 -+ tristate "NAND Flash device on RB500 board" -+ depends on MTD_NAND -+ help -+ Support for NAND flash on RB500 platform. -+ - config MTD_NAND_IDS - tristate - -Index: linux-2.6.21.1/drivers/mtd/nand/Makefile -=================================================================== ---- linux-2.6.21.1.orig/drivers/mtd/nand/Makefile 2007-04-27 23:49:26.000000000 +0200 -+++ linux-2.6.21.1/drivers/mtd/nand/Makefile 2007-06-07 01:31:30.927069952 +0200 -@@ -10,6 +10,7 @@ - obj-$(CONFIG_MTD_NAND_SPIA) += spia.o - obj-$(CONFIG_MTD_NAND_AMS_DELTA) += ams-delta.o - obj-$(CONFIG_MTD_NAND_TOTO) += toto.o -+obj-$(CONFIG_MTD_NAND_RB500) += rbmipsnand.o - obj-$(CONFIG_MTD_NAND_AUTCPU12) += autcpu12.o - obj-$(CONFIG_MTD_NAND_EDB7312) += edb7312.o - obj-$(CONFIG_MTD_NAND_AU1550) += au1550nd.o |