summaryrefslogtreecommitdiffstats
path: root/target/linux/brcm47xx/patches-2.6.37/032-bcm47xx-extend-bcm47xx_fill_sprom-with-prefix.patch
diff options
context:
space:
mode:
authorhauke <hauke@3c298f89-4303-0410-b956-a3cf2f4a3e73>2011-05-01 20:28:35 +0000
committerhauke <hauke@3c298f89-4303-0410-b956-a3cf2f4a3e73>2011-05-01 20:28:35 +0000
commit374bb82f67f49829cb443fe95a11d88c83675be4 (patch)
treea4af4b9a59d3ffae404928bc156a91909a87be21 /target/linux/brcm47xx/patches-2.6.37/032-bcm47xx-extend-bcm47xx_fill_sprom-with-prefix.patch
parent505d82b643b326b3a63484cdce6fc07e7aa28277 (diff)
brcm47xx: add fallback sprom for pci devices without an own sprom.
If there is no sprom on an ssb based pci device on the brcm47xx architecture ssb now asks the architecture code to look into the nvram to get some sprom data for this device. Now we are able to read out pci/1/1/ foo or pci/1/3/ foo config options. This will fix some problems where the wireless devices does not got an mac address and the following message was show: ssb: WARNING: Invalid SPROM CRC (corrupt SPROM) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@26801 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/brcm47xx/patches-2.6.37/032-bcm47xx-extend-bcm47xx_fill_sprom-with-prefix.patch')
-rw-r--r--target/linux/brcm47xx/patches-2.6.37/032-bcm47xx-extend-bcm47xx_fill_sprom-with-prefix.patch69
1 files changed, 69 insertions, 0 deletions
diff --git a/target/linux/brcm47xx/patches-2.6.37/032-bcm47xx-extend-bcm47xx_fill_sprom-with-prefix.patch b/target/linux/brcm47xx/patches-2.6.37/032-bcm47xx-extend-bcm47xx_fill_sprom-with-prefix.patch
new file mode 100644
index 000000000..acf65bd8c
--- /dev/null
+++ b/target/linux/brcm47xx/patches-2.6.37/032-bcm47xx-extend-bcm47xx_fill_sprom-with-prefix.patch
@@ -0,0 +1,69 @@
+--- a/arch/mips/bcm47xx/setup.c
++++ b/arch/mips/bcm47xx/setup.c
+@@ -59,10 +59,23 @@ static void bcm47xx_machine_halt(void)
+ }
+
+ #define READ_FROM_NVRAM(_outvar, name, buf) \
+- if (nvram_getenv(name, buf, sizeof(buf)) >= 0)\
++ if (nvram_getprefix(prefix, name, buf, sizeof(buf)) >= 0)\
+ sprom->_outvar = simple_strtoul(buf, NULL, 0);
+
+-static void bcm47xx_fill_sprom(struct ssb_sprom *sprom)
++static inline int nvram_getprefix(const char *prefix, char *name,
++ char *buf, int len)
++{
++ if (prefix) {
++ char key[100];
++
++ snprintf(key, sizeof(key), "%s%s", prefix, name);
++ return nvram_getenv(key, buf, len);
++ }
++
++ return nvram_getenv(name, buf, len);
++}
++
++static void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)
+ {
+ char buf[100];
+ u32 boardflags;
+@@ -71,11 +84,11 @@ static void bcm47xx_fill_sprom(struct ss
+
+ sprom->revision = 1; /* Fallback: Old hardware does not define this. */
+ READ_FROM_NVRAM(revision, "sromrev", buf);
+- if (nvram_getenv("il0macaddr", buf, sizeof(buf)) >= 0)
++ if (nvram_getprefix(prefix, "il0macaddr", buf, sizeof(buf)) >= 0)
+ nvram_parse_macaddr(buf, sprom->il0mac);
+- if (nvram_getenv("et0macaddr", buf, sizeof(buf)) >= 0)
++ if (nvram_getprefix(prefix, "et0macaddr", buf, sizeof(buf)) >= 0)
+ nvram_parse_macaddr(buf, sprom->et0mac);
+- if (nvram_getenv("et1macaddr", buf, sizeof(buf)) >= 0)
++ if (nvram_getprefix(prefix, "et1macaddr", buf, sizeof(buf)) >= 0)
+ nvram_parse_macaddr(buf, sprom->et1mac);
+ READ_FROM_NVRAM(et0phyaddr, "et0phyaddr", buf);
+ READ_FROM_NVRAM(et1phyaddr, "et1phyaddr", buf);
+@@ -127,14 +140,14 @@ static void bcm47xx_fill_sprom(struct ss
+ READ_FROM_NVRAM(ofdm5gpo, "ofdm5gpo", buf);
+ READ_FROM_NVRAM(ofdm5ghpo, "ofdm5ghpo", buf);
+
+- if (nvram_getenv("boardflags", buf, sizeof(buf)) >= 0) {
++ if (nvram_getprefix(prefix, "boardflags", buf, sizeof(buf)) >= 0) {
+ boardflags = simple_strtoul(buf, NULL, 0);
+ if (boardflags) {
+ sprom->boardflags_lo = (boardflags & 0x0000FFFFU);
+ sprom->boardflags_hi = (boardflags & 0xFFFF0000U) >> 16;
+ }
+ }
+- if (nvram_getenv("boardflags2", buf, sizeof(buf)) >= 0) {
++ if (nvram_getprefix(prefix, "boardflags2", buf, sizeof(buf)) >= 0) {
+ boardflags = simple_strtoul(buf, NULL, 0);
+ if (boardflags) {
+ sprom->boardflags2_lo = (boardflags & 0x0000FFFFU);
+@@ -160,7 +173,7 @@ static int bcm47xx_get_invariants(struct
+ if (nvram_getenv("boardrev", buf, sizeof(buf)) >= 0)
+ iv->boardinfo.rev = (u16)simple_strtoul(buf, NULL, 0);
+
+- bcm47xx_fill_sprom(&iv->sprom);
++ bcm47xx_fill_sprom(&iv->sprom, NULL);
+
+ if (nvram_getenv("cardbus", buf, sizeof(buf)) >= 0)
+ iv->has_cardbus_slot = !!simple_strtoul(buf, NULL, 10);