aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm47xx/patches-3.2/029-bcm47xx-read-nvram-from-sflash.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/brcm47xx/patches-3.2/029-bcm47xx-read-nvram-from-sflash.patch')
-rw-r--r--target/linux/brcm47xx/patches-3.2/029-bcm47xx-read-nvram-from-sflash.patch82
1 files changed, 49 insertions, 33 deletions
diff --git a/target/linux/brcm47xx/patches-3.2/029-bcm47xx-read-nvram-from-sflash.patch b/target/linux/brcm47xx/patches-3.2/029-bcm47xx-read-nvram-from-sflash.patch
index d3781b8fe5..2fc43dc3b4 100644
--- a/target/linux/brcm47xx/patches-3.2/029-bcm47xx-read-nvram-from-sflash.patch
+++ b/target/linux/brcm47xx/patches-3.2/029-bcm47xx-read-nvram-from-sflash.patch
@@ -1,15 +1,3 @@
-From 1d693b2c9d5943cbe938f879041b837cd004737f Mon Sep 17 00:00:00 2001
-From: Hauke Mehrtens <hauke@hauke-m.de>
-Date: Sat, 23 Jul 2011 18:29:38 +0200
-Subject: [PATCH 25/26] bcm47xx: read nvram from sflash
-
-bcm47xx: add sflash support to nvram
-
-Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
----
- arch/mips/bcm47xx/nvram.c | 86 +++++++++++++++++++++++++++++++++++++++++++-
- 1 files changed, 84 insertions(+), 2 deletions(-)
-
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
@@ -20,11 +20,12 @@
@@ -26,7 +14,17 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
{
#ifdef CONFIG_BCM47XX_SSB
struct ssb_chipcommon *ssb_cc;
-@@ -86,7 +87,88 @@ found:
+@@ -50,9 +51,6 @@ static void early_nvram_init(void)
+ #ifdef CONFIG_BCM47XX_BCMA
+ case BCM47XX_BUS_TYPE_BCMA:
+ bcma_cc = &bcm47xx_bus.bcma.bus.drv_cc;
+- if (bcma_cc->flash_type != BCMA_PFLASH)
+- return;
+-
+ base = bcma_cc->pflash.window;
+ lim = bcma_cc->pflash.window_size;
+ break;
+@@ -86,7 +84,106 @@ found:
for (i = 0; i < sizeof(struct nvram_header); i += 4)
*dst++ = *src++;
for (; i < header->len && i < NVRAM_SPACE; i += 4)
@@ -81,35 +79,53 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+ return 0;
+}
+
-+static void early_nvram_init(void)
++#ifdef CONFIG_BCM47XX_SSB
++static void early_nvram_init_ssb(void)
+{
-+ int err = 0;
++ int err;
++
++ switch (bcm47xx_bus.ssb.chipco.flash_type) {
++ case SSB_PFLASH:
++ early_nvram_init_pflash();
++ case SSB_SFLASH:
++ err = early_nvram_init_sflash();
++ if (err < 0)
++ printk(KERN_WARNING "can not read from flash: %i\n", err);
++ default:
++ printk(KERN_WARNING "unknow flash type\n");
++ }
++}
++#endif
+
++#ifdef CONFIG_BCM47XX_BCMA
++static void early_nvram_init_bcma(void)
++{
++ int err;
++
++ switch (bcm47xx_bus.bcma.bus.drv_cc.flash_type) {
++ case BCMA_PFLASH:
++ early_nvram_init_pflash();
++ case BCMA_SFLASH:
++ err = early_nvram_init_sflash();
++ if (err < 0)
++ printk(KERN_WARNING "can not read from flash: %i\n", err);
++ default:
++ printk(KERN_WARNING "unknow flash type\n");
++ }
++}
++#endif
++
++static void early_nvram_init(void)
++{
+ switch (bcm47xx_bus_type) {
+#ifdef CONFIG_BCM47XX_SSB
+ case BCM47XX_BUS_TYPE_SSB:
-+ if (bcm47xx_bus.ssb.chipco.flash_type == SSB_PFLASH) {
-+ early_nvram_init_pflash();
-+ } else if (bcm47xx_bus.ssb.chipco.flash_type == SSB_SFLASH) {
-+ err = early_nvram_init_sflash();
-+ if (err < 0)
-+ printk(KERN_WARNING "can not read from flash: %i\n", err);
-+ } else {
-+ printk(KERN_WARNING "unknow flash type\n");
-+ }
++ early_nvram_init_ssb();
+ break;
+#endif
+#ifdef CONFIG_BCM47XX_BCMA
+ case BCM47XX_BUS_TYPE_BCMA:
-+ if (bcm47xx_bus.bcma.bus.drv_cc.flash_type == BCMA_PFLASH) {
-+ early_nvram_init_pflash();
-+ } else if (bcm47xx_bus.bcma.bus.drv_cc.flash_type == BCMA_SFLASH) {
-+ err = early_nvram_init_sflash();
-+ if (err < 0)
-+ printk(KERN_WARNING "can not read from flash: %i\n", err);
-+ } else {
-+ printk(KERN_WARNING "unknow flash type\n");
-+ }
++ early_nvram_init_bcma();
+ break;
+#endif
+ }