Add early support for CFE mapping
authorFlorian Fainelli <florian@openwrt.org>
Wed, 30 Aug 2006 11:16:06 +0000 (11:16 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Wed, 30 Aug 2006 11:16:06 +0000 (11:16 +0000)
SVN-Revision: 4719

openwrt/target/linux/brcm63xx-2.6/patches/040-bcm963xx_flashmap.patch

index c160e23dce8bffc33f39fd48fbefedf3be216d69..997cc980f914758083bd30e35c83586759f99d6e 100644 (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
 --- 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
-@@ -0,0 +1,116 @@
++++ linux-2.6.17-brcm63xx/drivers/mtd/maps/bcm963xx-flash.c    2006-08-30 13:03:16.000000000 +0200
+@@ -0,0 +1,135 @@
 +/*
 + * $Id$
 + * 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/mtd.h>
 +#include <linux/mtd/partitions.h>
++#include <board.h>
 +
 +#define WINDOW_ADDR 0x1e400000                /* Real address of the flash */
 +#define WINDOW_SIZE 0x800000          /* Size of flash */
 +#define BUSWIDTH 2                    /* Buswidth */
++#define EXTENDED_SIZE 0xBE400000      /* Extended flash addresse */
 +
 +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);
@@ -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}
 +};
 +
++static int bcm963xx_parts_size = sizeof(bcm963xx_parts) / sizeof(bcm963xx_parts[0]);
++
 +static int __init bcm963xx_mtd_init(void)
 +{
 +      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) {
 +              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       
-+              if (parsed_nr_parts == 0) {
-+                      int ret = parse_redboot_partitions(bcm963xx_mtd_info, &parsed_parts, 0);
-+                      if (ret > 0) {
-+                              part_type = "RedBoot";
-+                              parsed_nr_parts = ret;
++                      if (parsed_nr_parts == 0) {
++                              int ret = parse_redboot_partitions(bcm963xx_mtd_info, &parsed_parts, 0);
++                              if (ret > 0) {
++                                      part_type = "RedBoot";
++                                      parsed_nr_parts = ret;
++                              }
 +                      }
-+              }
 +#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);
 +      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_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
 --- 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 @@
          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'.
@@ -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
 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-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 @@
  obj-$(CONFIG_MTD_OMAP_NOR)    += omap_nor.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
 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-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 @@
        return 1;
  }