minor cleanup of flash map driver

SVN-Revision: 2728
owl
Waldemar Brodkorb 2005-12-18 23:28:26 +00:00
parent e30ffb5391
commit 4933ece49f
1 changed files with 24 additions and 36 deletions

View File

@ -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 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.12.5/drivers/mtd/maps/bcm47xx-flash.c 1970-01-01 01:00:00.000000000 +0100 --- linux-2.6.15-rc5/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 +++ linux-2.6.15-rc5-flash/drivers/mtd/maps/bcm47xx-flash.c 2005-12-18 23:40:45.060006250 +0100
@@ -0,0 +1,333 @@ @@ -0,0 +1,321 @@
+/* +/*
+ * Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org) + * Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org)
+ * Copyright (C) 2005 Waldemar Brodkorb <wbx@openwrt.org> + * Copyright (C) 2005 Waldemar Brodkorb <wbx@openwrt.org>
@ -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 + * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. + * 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 + * 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 <asm/io.h> +#include <asm/io.h>
+#include <linux/mtd/mtd.h> +#include <linux/mtd/mtd.h>
+#include <linux/mtd/map.h> +#include <linux/mtd/map.h>
+#include <linux/mtd/partitions.h>
+#include <linux/config.h>
+#include <typedefs.h>
+#include <bcmutils.h>
+#include <bcmnvram.h>
+#include <trxhdr.h>
+
+
+#ifdef CONFIG_MTD_PARTITIONS +#ifdef CONFIG_MTD_PARTITIONS
+extern struct mtd_partition * init_mtd_partitions(struct mtd_info *mtd, size_t size); +#include <linux/mtd/partitions.h>
+#endif +#endif
+#include <linux/config.h>
+
+#include <trxhdr.h>
+ +
+#define WINDOW_ADDR 0x1c000000 +#define WINDOW_ADDR 0x1c000000
+#define WINDOW_SIZE (0x400000*2) +#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; + 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 */ + /* if cfe_size_flag=0, cfe size is 256 kb, else 384 kb */
+ cfe_size_flag = find_cfe_size(mtd, size);
+ +
+ /* boot loader */ + /* boot loader */
+ bcm947xx_parts[0].offset = 0; + 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 */ + /* nvram */
+ if (cfe_size_flag == 0) { + if (cfe_size_flag == 0) {
+ bcm947xx_parts[3].offset = size - mtd->erasesize; + bcm947xx_parts[3].offset = size - mtd->erasesize;
+ bcm947xx_parts[3].size = mtd->erasesize;
+ } else { + } else {
+ /* nvram (old 128kb config partition on netgear wgt634u) */ + /* nvram (old 128kb config partition on netgear wgt634u) */
+ bcm947xx_parts[3].offset = bcm947xx_parts[0].size; + bcm947xx_parts[3].offset = bcm947xx_parts[0].size;
+ bcm947xx_parts[3].size = 1024*128;
+ } + }
+ bcm947xx_parts[3].size = mtd->erasesize;
+ +
+ /* linux (kernel and rootfs) */ + /* linux (kernel and rootfs) */
+ if (cfe_size_flag == 0) { + 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 */ + /* entirely jffs2 */
+ bcm947xx_parts[4].name = NULL; + bcm947xx_parts[4].name = NULL;
+ if (cfe_size_flag == 0) { + if (cfe_size_flag == 0) {
+ bcm947xx_parts[2].size = bcm947xx_parts[3].offset - + bcm947xx_parts[2].size = size - bcm947xx_parts[2].offset -
+ bcm947xx_parts[2].offset; + bcm947xx_parts[3].size;
+ } else { + } else {
+ bcm947xx_parts[2].size = size - bcm947xx_parts[2].offset - + bcm947xx_parts[2].size = size - bcm947xx_parts[2].offset -
+ bcm947xx_parts[3].size; + 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; + return bcm947xx_parts;
+} +}
+
+EXPORT_SYMBOL(init_mtd_partitions);
+#endif +#endif
+ +
+int __init init_bcm947xx_map(void) +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; + 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 +#ifdef CONFIG_MTD_PARTITIONS
+ parts = init_mtd_partitions(bcm947xx_mtd, size); + 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; + goto fail;
+ } + }
+#endif +#endif
+
+ return 0; + return 0;
+ +
+ fail: + fail:
+ if (bcm947xx_mtd) + if (bcm947xx_mtd)
+ map_destroy(bcm947xx_mtd); + map_destroy(bcm947xx_mtd);
+ if (bcm947xx_map.map_priv_1) + if (bcm947xx_map.virt)
+ iounmap((void *) bcm947xx_map.map_priv_1); + iounmap((void *)bcm947xx_map.virt);
+ bcm947xx_map.map_priv_1 = 0; + bcm947xx_map.virt = 0;
+ return ret; + 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_init(init_bcm947xx_map);
+module_exit(cleanup_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 diff -Nur linux-2.6.15-rc5/drivers/mtd/maps/Kconfig linux-2.6.15-rc5-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.15-rc5/drivers/mtd/maps/Kconfig 2005-12-04 06:10:42.000000000 +0100
+++ linux-2.6.12.5-flash/drivers/mtd/maps/Kconfig 2005-09-16 22:27:36.000000000 +0200 +++ linux-2.6.15-rc5-flash/drivers/mtd/maps/Kconfig 2005-12-18 19:36:11.555087000 +0100
@@ -357,6 +357,12 @@ @@ -299,6 +299,12 @@
Mapping for the Flaga digital module. If you don't have one, ignore Mapping for the Flaga digital module. If you don't have one, ignore
this setting. 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 config MTD_BEECH
tristate "CFI Flash device mapped on IBM 405LP Beech" tristate "CFI Flash device mapped on IBM 405LP Beech"
depends on MTD_CFI && PPC32 && 40x && BEECH depends on MTD_CFI && BEECH
diff -Nur linux-2.6.12.5/drivers/mtd/maps/Makefile linux-2.6.12.5-flash/drivers/mtd/maps/Makefile diff -Nur linux-2.6.15-rc5/drivers/mtd/maps/Makefile linux-2.6.15-rc5-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.15-rc5/drivers/mtd/maps/Makefile 2005-12-04 06:10:42.000000000 +0100
+++ linux-2.6.12.5-flash/drivers/mtd/maps/Makefile 2005-09-16 22:27:01.000000000 +0200 +++ linux-2.6.15-rc5-flash/drivers/mtd/maps/Makefile 2005-12-18 19:36:11.555087000 +0100
@@ -31,6 +31,7 @@ @@ -31,6 +31,7 @@
obj-$(CONFIG_MTD_PCMCIA) += pcmciamtd.o obj-$(CONFIG_MTD_PCMCIA) += pcmciamtd.o
obj-$(CONFIG_MTD_RPXLITE) += rpxlite.o obj-$(CONFIG_MTD_RPXLITE) += rpxlite.o