1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2025-04-21 12:27:27 +03:00

brcm47xx: update flash drivers

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@31126 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
hauke
2012-03-28 17:03:18 +00:00
parent 1ff90943e2
commit d2f6c11460
19 changed files with 373 additions and 693 deletions

View File

@@ -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;
+}
+
+#ifdef CONFIG_BCM47XX_SSB
+static void early_nvram_init_ssb(void)
+{
+ 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)
+{
+ int err = 0;
+
+ 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
+ }