From: Waldemar Brodkorb Date: Sun, 18 Dec 2005 23:28:26 +0000 (+0000) Subject: minor cleanup of flash map driver X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=4933ece49fe4a0cf7710c558913052a000f952a1;p=openwrt%2Fstaging%2Fwigyori.git minor cleanup of flash map driver SVN-Revision: 2728 --- diff --git a/openwrt/target/linux/linux-2.6/patches/brcm/002-flash-map.patch b/openwrt/target/linux/linux-2.6/patches/brcm/002-flash-map.patch index d0917ba6ef..3d85d89712 100644 --- a/openwrt/target/linux/linux-2.6/patches/brcm/002-flash-map.patch +++ b/openwrt/target/linux/linux-2.6/patches/brcm/002-flash-map.patch @@ -1,7 +1,7 @@ -diff -Nur linux-2.6.12.5/drivers/mtd/maps/bcm47xx-flash.c linux-2.6.12.5-flash/drivers/mtd/maps/bcm47xx-flash.c ---- linux-2.6.12.5/drivers/mtd/maps/bcm47xx-flash.c 1970-01-01 01:00:00.000000000 +0100 -+++ linux-2.6.12.5-flash/drivers/mtd/maps/bcm47xx-flash.c 2005-11-29 12:50:51.416656000 +0100 -@@ -0,0 +1,333 @@ +diff -Nur linux-2.6.15-rc5/drivers/mtd/maps/bcm47xx-flash.c linux-2.6.15-rc5-flash/drivers/mtd/maps/bcm47xx-flash.c +--- linux-2.6.15-rc5/drivers/mtd/maps/bcm47xx-flash.c 1970-01-01 01:00:00.000000000 +0100 ++++ linux-2.6.15-rc5-flash/drivers/mtd/maps/bcm47xx-flash.c 2005-12-18 23:40:45.060006250 +0100 +@@ -0,0 +1,321 @@ +/* + * Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org) + * Copyright (C) 2005 Waldemar Brodkorb @@ -36,8 +36,6 @@ diff -Nur linux-2.6.12.5/drivers/mtd/maps/bcm47xx-flash.c linux-2.6.12.5-flash/d + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * -+ * $Id: bcm47xx-flash.c,v 1.1 2004/10/21 07:18:31 jolt Exp $ -+ * + * Flash mapping for BCM947XX boards + */ + @@ -48,17 +46,12 @@ diff -Nur linux-2.6.12.5/drivers/mtd/maps/bcm47xx-flash.c linux-2.6.12.5-flash/d +#include +#include +#include ++#ifdef CONFIG_MTD_PARTITIONS +#include ++#endif +#include -+#include -+#include -+#include -+#include + -+ -+#ifdef CONFIG_MTD_PARTITIONS -+extern struct mtd_partition * init_mtd_partitions(struct mtd_info *mtd, size_t size); -+#endif ++#include + +#define WINDOW_ADDR 0x1c000000 +#define WINDOW_SIZE (0x400000*2) @@ -193,9 +186,8 @@ diff -Nur linux-2.6.12.5/drivers/mtd/maps/bcm47xx-flash.c linux-2.6.12.5-flash/d + + int cfe_size_flag; + -+ cfe_size_flag = find_cfe_size(mtd,size); -+ + /* if cfe_size_flag=0, cfe size is 256 kb, else 384 kb */ ++ cfe_size_flag = find_cfe_size(mtd, size); + + /* boot loader */ + bcm947xx_parts[0].offset = 0; @@ -209,12 +201,11 @@ diff -Nur linux-2.6.12.5/drivers/mtd/maps/bcm47xx-flash.c linux-2.6.12.5-flash/d + /* nvram */ + if (cfe_size_flag == 0) { + bcm947xx_parts[3].offset = size - mtd->erasesize; -+ bcm947xx_parts[3].size = mtd->erasesize; + } else { + /* nvram (old 128kb config partition on netgear wgt634u) */ + bcm947xx_parts[3].offset = bcm947xx_parts[0].size; -+ bcm947xx_parts[3].size = 1024*128; + } ++ bcm947xx_parts[3].size = mtd->erasesize; + + /* linux (kernel and rootfs) */ + if (cfe_size_flag == 0) { @@ -236,8 +227,8 @@ diff -Nur linux-2.6.12.5/drivers/mtd/maps/bcm47xx-flash.c linux-2.6.12.5-flash/d + /* entirely jffs2 */ + bcm947xx_parts[4].name = NULL; + if (cfe_size_flag == 0) { -+ bcm947xx_parts[2].size = bcm947xx_parts[3].offset - -+ bcm947xx_parts[2].offset; ++ bcm947xx_parts[2].size = size - bcm947xx_parts[2].offset - ++ bcm947xx_parts[3].size; + } else { + bcm947xx_parts[2].size = size - bcm947xx_parts[2].offset - + bcm947xx_parts[3].size; @@ -268,8 +259,6 @@ diff -Nur linux-2.6.12.5/drivers/mtd/maps/bcm47xx-flash.c linux-2.6.12.5-flash/d + + return bcm947xx_parts; +} -+ -+EXPORT_SYMBOL(init_mtd_partitions); +#endif + +int __init init_bcm947xx_map(void) @@ -301,7 +290,7 @@ diff -Nur linux-2.6.12.5/drivers/mtd/maps/bcm47xx-flash.c linux-2.6.12.5-flash/d + + size = bcm947xx_mtd->size; + -+ printk(KERN_NOTICE "Flash device: 0x%x at 0x%x\n", bcm947xx_mtd->size, WINDOW_ADDR); ++ printk(KERN_NOTICE "Flash device: 0x%x at 0x%x\n", size, WINDOW_ADDR); + +#ifdef CONFIG_MTD_PARTITIONS + parts = init_mtd_partitions(bcm947xx_mtd, size); @@ -312,15 +301,14 @@ diff -Nur linux-2.6.12.5/drivers/mtd/maps/bcm47xx-flash.c linux-2.6.12.5-flash/d + goto fail; + } +#endif -+ + return 0; + + fail: + if (bcm947xx_mtd) + map_destroy(bcm947xx_mtd); -+ if (bcm947xx_map.map_priv_1) -+ iounmap((void *) bcm947xx_map.map_priv_1); -+ bcm947xx_map.map_priv_1 = 0; ++ if (bcm947xx_map.virt) ++ iounmap((void *)bcm947xx_map.virt); ++ bcm947xx_map.virt = 0; + return ret; +} + @@ -335,10 +323,10 @@ diff -Nur linux-2.6.12.5/drivers/mtd/maps/bcm47xx-flash.c linux-2.6.12.5-flash/d + +module_init(init_bcm947xx_map); +module_exit(cleanup_bcm947xx_map); -diff -Nur linux-2.6.12.5/drivers/mtd/maps/Kconfig linux-2.6.12.5-flash/drivers/mtd/maps/Kconfig ---- linux-2.6.12.5/drivers/mtd/maps/Kconfig 2005-08-15 02:20:18.000000000 +0200 -+++ linux-2.6.12.5-flash/drivers/mtd/maps/Kconfig 2005-09-16 22:27:36.000000000 +0200 -@@ -357,6 +357,12 @@ +diff -Nur linux-2.6.15-rc5/drivers/mtd/maps/Kconfig linux-2.6.15-rc5-flash/drivers/mtd/maps/Kconfig +--- linux-2.6.15-rc5/drivers/mtd/maps/Kconfig 2005-12-04 06:10:42.000000000 +0100 ++++ linux-2.6.15-rc5-flash/drivers/mtd/maps/Kconfig 2005-12-18 19:36:11.555087000 +0100 +@@ -299,6 +299,12 @@ Mapping for the Flaga digital module. If you don't have one, ignore this setting. @@ -350,10 +338,10 @@ diff -Nur linux-2.6.12.5/drivers/mtd/maps/Kconfig linux-2.6.12.5-flash/drivers/m + config MTD_BEECH tristate "CFI Flash device mapped on IBM 405LP Beech" - depends on MTD_CFI && PPC32 && 40x && BEECH -diff -Nur linux-2.6.12.5/drivers/mtd/maps/Makefile linux-2.6.12.5-flash/drivers/mtd/maps/Makefile ---- linux-2.6.12.5/drivers/mtd/maps/Makefile 2005-08-15 02:20:18.000000000 +0200 -+++ linux-2.6.12.5-flash/drivers/mtd/maps/Makefile 2005-09-16 22:27:01.000000000 +0200 + depends on MTD_CFI && BEECH +diff -Nur linux-2.6.15-rc5/drivers/mtd/maps/Makefile linux-2.6.15-rc5-flash/drivers/mtd/maps/Makefile +--- linux-2.6.15-rc5/drivers/mtd/maps/Makefile 2005-12-04 06:10:42.000000000 +0100 ++++ linux-2.6.15-rc5-flash/drivers/mtd/maps/Makefile 2005-12-18 19:36:11.555087000 +0100 @@ -31,6 +31,7 @@ obj-$(CONFIG_MTD_PCMCIA) += pcmciamtd.o obj-$(CONFIG_MTD_RPXLITE) += rpxlite.o