1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-07-05 00:08:53 +03:00

Add early support for CFE mapping

git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4719 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
florian 2006-08-30 11:16:06 +00:00
parent 2a9a890be3
commit d6a77366aa

View File

@ -1,7 +1,7 @@
diff -urN linux-2.6.17/drivers/mtd/maps/bcm963xx-flash.c linux-2.6.17-brcm63xx/drivers/mtd/maps/bcm963xx-flash.c diff -urN linux-2.6.17/drivers/mtd/maps/bcm963xx-flash.c linux-2.6.17-brcm63xx/drivers/mtd/maps/bcm963xx-flash.c
--- linux-2.6.17/drivers/mtd/maps/bcm963xx-flash.c 1970-01-01 01:00:00.000000000 +0100 --- linux-2.6.17/drivers/mtd/maps/bcm963xx-flash.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.17-brcm63xx/drivers/mtd/maps/bcm963xx-flash.c 2006-08-03 16:29:52.000000000 +0200 +++ linux-2.6.17-brcm63xx/drivers/mtd/maps/bcm963xx-flash.c 2006-08-30 13:03:16.000000000 +0200
@@ -0,0 +1,116 @@ @@ -0,0 +1,135 @@
+/* +/*
+ * $Id$ + * $Id$
+ * Copyright (C) 2006 Florian Fainelli + * Copyright (C) 2006 Florian Fainelli
@ -38,10 +38,12 @@ diff -urN linux-2.6.17/drivers/mtd/maps/bcm963xx-flash.c linux-2.6.17-brcm63xx/d
+#include <linux/mtd/map.h> +#include <linux/mtd/map.h>
+#include <linux/mtd/mtd.h> +#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h> +#include <linux/mtd/partitions.h>
+#include <board.h>
+ +
+#define WINDOW_ADDR 0x1e400000 /* Real address of the flash */ +#define WINDOW_ADDR 0x1e400000 /* Real address of the flash */
+#define WINDOW_SIZE 0x800000 /* Size of flash */ +#define WINDOW_SIZE 0x800000 /* Size of flash */
+#define BUSWIDTH 2 /* Buswidth */ +#define BUSWIDTH 2 /* Buswidth */
+#define EXTENDED_SIZE 0xBE400000 /* Extended flash addresse */
+ +
+extern int boot_loader_type; /* For RedBoot / CFE detection */ +extern int boot_loader_type; /* For RedBoot / CFE detection */
+extern int parse_redboot_partitions(struct mtd_info *master, struct mtd_partition **pparts, unsigned long fis_origin); +extern int parse_redboot_partitions(struct mtd_info *master, struct mtd_partition **pparts, unsigned long fis_origin);
@ -64,6 +66,8 @@ diff -urN linux-2.6.17/drivers/mtd/maps/bcm963xx-flash.c linux-2.6.17-brcm63xx/d
+ { name: "jffs2", size: 5 * 0x10000, offset: 57*0x10000} + { name: "jffs2", size: 5 * 0x10000, offset: 57*0x10000}
+}; +};
+ +
+static int bcm963xx_parts_size = sizeof(bcm963xx_parts) / sizeof(bcm963xx_parts[0]);
+
+static int __init bcm963xx_mtd_init(void) +static int __init bcm963xx_mtd_init(void)
+{ +{
+ printk("bcm963xx: 0x%08x at 0x%08x\n", WINDOW_SIZE, WINDOW_ADDR); + printk("bcm963xx: 0x%08x at 0x%08x\n", WINDOW_SIZE, WINDOW_ADDR);
@ -80,22 +84,37 @@ diff -urN linux-2.6.17/drivers/mtd/maps/bcm963xx-flash.c linux-2.6.17-brcm63xx/d
+ +
+ if (bcm963xx_mtd_info) { + if (bcm963xx_mtd_info) {
+ bcm963xx_mtd_info->owner = THIS_MODULE; + bcm963xx_mtd_info->owner = THIS_MODULE;
+ int parsed_nr_parts = 0; +
+ char * part_type; + if (boot_loader_type == BOOT_CFE)
+ {
+ add_mtd_device(bcm963xx_mtd_info);
+ add_mtd_partitions(bcm963xx_mtd_info, bcm963xx_parts, bcm963xx_parts_size);
+ return 0;
+ }
+ else
+ {
+ int parsed_nr_parts = 0;
+ char * part_type;
+
+ if (bcm963xx_mtd_info->size > 0x00400000) {
+ printk("Support for extended flash memory size : 0x%08X ; ONLY 64MBIT SUPPORT\n", bcm963xx_mtd_info->size);
+ bcm963xx_map.virt = (unsigned long)(EXTENDED_SIZE);
+ }
+ +
+#ifdef CONFIG_MTD_REDBOOT_PARTS +#ifdef CONFIG_MTD_REDBOOT_PARTS
+ if (parsed_nr_parts == 0) { + if (parsed_nr_parts == 0) {
+ int ret = parse_redboot_partitions(bcm963xx_mtd_info, &parsed_parts, 0); + int ret = parse_redboot_partitions(bcm963xx_mtd_info, &parsed_parts, 0);
+ if (ret > 0) { + if (ret > 0) {
+ part_type = "RedBoot"; + part_type = "RedBoot";
+ parsed_nr_parts = ret; + parsed_nr_parts = ret;
+ }
+ } + }
+ }
+#endif +#endif
+ add_mtd_partitions(bcm963xx_mtd_info, parsed_parts, parsed_nr_parts); + add_mtd_partitions(bcm963xx_mtd_info, parsed_parts, parsed_nr_parts);
+ +
+ return 0; + return 0;
+ } + }
+ }
+ iounmap(bcm963xx_map.virt); + iounmap(bcm963xx_map.virt);
+ return -ENXIO; + return -ENXIO;
+} +}
@ -117,10 +136,10 @@ diff -urN linux-2.6.17/drivers/mtd/maps/bcm963xx-flash.c linux-2.6.17-brcm63xx/d
+module_exit(bcm963xx_mtd_cleanup); +module_exit(bcm963xx_mtd_cleanup);
+ +
+MODULE_LICENSE("GPL"); +MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Florian Fainelli"); +MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
diff -urN linux-2.6.17/drivers/mtd/maps/Kconfig linux-2.6.17-brcm63xx/drivers/mtd/maps/Kconfig diff -urN linux-2.6.17/drivers/mtd/maps/Kconfig linux-2.6.17-brcm63xx/drivers/mtd/maps/Kconfig
--- linux-2.6.17/drivers/mtd/maps/Kconfig 2006-06-18 03:49:35.000000000 +0200 --- linux-2.6.17/drivers/mtd/maps/Kconfig 2006-06-18 03:49:35.000000000 +0200
+++ linux-2.6.17-brcm63xx/drivers/mtd/maps/Kconfig 2006-08-03 16:32:05.000000000 +0200 +++ linux-2.6.17-brcm63xx/drivers/mtd/maps/Kconfig 2006-08-30 13:03:06.000000000 +0200
@@ -224,6 +224,13 @@ @@ -224,6 +224,13 @@
Flash memory access on 4G Systems MTX-1 Board. If you have one of Flash memory access on 4G Systems MTX-1 Board. If you have one of
these boards and would like to use the flash chips on it, say 'Y'. these boards and would like to use the flash chips on it, say 'Y'.
@ -137,7 +156,7 @@ diff -urN linux-2.6.17/drivers/mtd/maps/Kconfig linux-2.6.17-brcm63xx/drivers/mt
depends on X86 && MTD_CONCAT && MTD_PARTITIONS && MTD_CFI_INTELEXT depends on X86 && MTD_CONCAT && MTD_PARTITIONS && MTD_CFI_INTELEXT
diff -urN linux-2.6.17/drivers/mtd/maps/Makefile linux-2.6.17-brcm63xx/drivers/mtd/maps/Makefile diff -urN linux-2.6.17/drivers/mtd/maps/Makefile linux-2.6.17-brcm63xx/drivers/mtd/maps/Makefile
--- linux-2.6.17/drivers/mtd/maps/Makefile 2006-06-18 03:49:35.000000000 +0200 --- linux-2.6.17/drivers/mtd/maps/Makefile 2006-06-18 03:49:35.000000000 +0200
+++ linux-2.6.17-brcm63xx/drivers/mtd/maps/Makefile 2006-08-03 16:32:27.000000000 +0200 +++ linux-2.6.17-brcm63xx/drivers/mtd/maps/Makefile 2006-08-30 13:03:06.000000000 +0200
@@ -71,3 +71,4 @@ @@ -71,3 +71,4 @@
obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o
obj-$(CONFIG_MTD_MTX1) += mtx-1_flash.o obj-$(CONFIG_MTD_MTX1) += mtx-1_flash.o
@ -145,7 +164,7 @@ diff -urN linux-2.6.17/drivers/mtd/maps/Makefile linux-2.6.17-brcm63xx/drivers/m
+obj-$(CONFIG_MTD_BCM963XX) += bcm963xx-flash.o +obj-$(CONFIG_MTD_BCM963XX) += bcm963xx-flash.o
diff -urN linux-2.6.17/drivers/mtd/redboot.c linux-2.6.17-brcm63xx/drivers/mtd/redboot.c diff -urN linux-2.6.17/drivers/mtd/redboot.c linux-2.6.17-brcm63xx/drivers/mtd/redboot.c
--- linux-2.6.17/drivers/mtd/redboot.c 2006-06-18 03:49:35.000000000 +0200 --- linux-2.6.17/drivers/mtd/redboot.c 2006-06-18 03:49:35.000000000 +0200
+++ linux-2.6.17-brcm63xx/drivers/mtd/redboot.c 2006-08-03 16:32:39.000000000 +0200 +++ linux-2.6.17-brcm63xx/drivers/mtd/redboot.c 2006-08-30 13:03:06.000000000 +0200
@@ -39,7 +39,7 @@ @@ -39,7 +39,7 @@
return 1; return 1;
} }