int err;
u16 *buf;
-@@ -707,10 +706,14 @@ static int ssb_pci_sprom_get(struct ssb_
+@@ -707,10 +706,17 @@ static int ssb_pci_sprom_get(struct ssb_
if (err) {
/* All CRC attempts failed.
* Maybe there is no SPROM on the device?
+ " fallback SPROM failed (err %d)\n",
+ err);
+ } else {
++ ssb_dprintk(KERN_DEBUG PFX "Using SPROM"
++ " revision %d provided by"
++ " platform.\n", sprom->revision);
err = 0;
goto out_free;
}
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
-@@ -23,7 +23,7 @@
+@@ -3,6 +3,7 @@
+ *
+ * Copyright (C) 2005 Broadcom Corporation
+ * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2010-2011 Hauke Mehrtens <hauke@hauke-m.de>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+@@ -23,7 +24,7 @@
static char nvram_buf[NVRAM_SPACE];
/* Probe for NVRAM header */
struct nvram_header *header;
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
-@@ -156,6 +156,22 @@ static void bcm47xx_fill_sprom(struct ss
+@@ -3,6 +3,7 @@
+ * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
+ * Copyright (C) 2006 Michael Buesch <mb@bu3sch.de>
+ * Copyright (C) 2010 Waldemar Brodkorb <wbx@openadk.org>
++ * Copyright (C) 2010-2011 Hauke Mehrtens <hauke@hauke-m.de>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+@@ -156,6 +157,22 @@ static void bcm47xx_fill_sprom(struct ss
}
}
+ char prefix[10];
+
+ if (bus->bustype == SSB_BUSTYPE_PCI) {
-+ snprintf(prefix, sizeof(prefix), "pci/%x/%x/",
++ snprintf(prefix, sizeof(prefix), "pci/%u/%u/",
+ bus->host_pci->bus->number + 1,
+ PCI_SLOT(bus->host_pci->devfn));
+ bcm47xx_fill_sprom(out, prefix);
static int bcm47xx_get_invariants(struct ssb_bus *bus,
struct ssb_init_invariants *iv)
{
-@@ -212,6 +228,11 @@ void __init plat_mem_setup(void)
+@@ -212,6 +229,11 @@ void __init plat_mem_setup(void)
char buf[100];
struct ssb_mipscore *mcore;
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
-@@ -62,6 +62,11 @@ static void bcm47xx_machine_halt(void)
+@@ -63,6 +63,11 @@ static void bcm47xx_machine_halt(void)
if (nvram_getprefix(prefix, name, buf, sizeof(buf)) >= 0)\
sprom->_outvar = simple_strtoul(buf, NULL, 0);
static inline int nvram_getprefix(const char *prefix, char *name,
char *buf, int len)
{
-@@ -75,6 +80,27 @@ static inline int nvram_getprefix(const
+@@ -76,6 +81,27 @@ static inline int nvram_getprefix(const
return nvram_getenv(name, buf, len);
}
static void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)
{
char buf[100];
-@@ -84,7 +110,8 @@ static void bcm47xx_fill_sprom(struct ss
+@@ -85,7 +111,8 @@ static void bcm47xx_fill_sprom(struct ss
sprom->revision = 1; /* Fallback: Old hardware does not define this. */
READ_FROM_NVRAM(revision, "sromrev", buf);
nvram_parse_macaddr(buf, sprom->il0mac);
if (nvram_getprefix(prefix, "et0macaddr", buf, sizeof(buf)) >= 0)
nvram_parse_macaddr(buf, sprom->et0mac);
-@@ -110,20 +137,36 @@ static void bcm47xx_fill_sprom(struct ss
+@@ -111,20 +138,36 @@ static void bcm47xx_fill_sprom(struct ss
READ_FROM_NVRAM(pa1hib0, "pa1hib0", buf);
READ_FROM_NVRAM(pa1hib2, "pa1hib1", buf);
READ_FROM_NVRAM(pa1hib1, "pa1hib2", buf);
READ_FROM_NVRAM(rxpo2g, "rxpo2g", buf);
READ_FROM_NVRAM(rxpo5g, "rxpo5g", buf);
READ_FROM_NVRAM(rssisav2g, "rssisav2g", buf);
-@@ -135,10 +178,18 @@ static void bcm47xx_fill_sprom(struct ss
+@@ -136,10 +179,18 @@ static void bcm47xx_fill_sprom(struct ss
READ_FROM_NVRAM(rssismf5g, "rssismf5g", buf);
READ_FROM_NVRAM(bxa5g, "bxa5g", buf);
READ_FROM_NVRAM(cck2gpo, "cck2gpo", buf);
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
-@@ -92,3 +92,30 @@ int nvram_getenv(char *name, char *val,
+@@ -93,3 +93,30 @@ int nvram_getenv(char *name, char *val,
return NVRAM_ERR_ENVNOTFOUND;
}
EXPORT_SYMBOL(nvram_getenv);
+EXPORT_SYMBOL(nvram_get);
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
-@@ -311,3 +311,20 @@ void __init plat_mem_setup(void)
+@@ -312,3 +312,20 @@ void __init plat_mem_setup(void)
_machine_halt = bcm47xx_machine_halt;
pm_power_off = bcm47xx_machine_halt;
}
+
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
-@@ -21,6 +21,8 @@
+@@ -22,6 +22,8 @@
#include <asm/mach-bcm47xx/bcm47xx.h>
static char nvram_buf[NVRAM_SPACE];
/* Probe for NVRAM header */
static void early_nvram_init(void)
-@@ -33,6 +35,25 @@ static void early_nvram_init(void)
+@@ -34,6 +36,25 @@ static void early_nvram_init(void)
base = mcore->flash_window;
lim = mcore->flash_window_size;
off = FLASH_MIN;
while (off <= lim) {
-@@ -74,6 +95,12 @@ int nvram_getenv(char *name, char *val,
+@@ -75,6 +96,12 @@ int nvram_getenv(char *name, char *val,
if (!nvram_buf[0])
early_nvram_init();
/* Look for name=value and return value */
var = &nvram_buf[sizeof(struct nvram_header)];
end = nvram_buf + sizeof(nvram_buf) - 2;
-@@ -103,6 +130,9 @@ char *nvram_get(const char *name)
+@@ -104,6 +131,9 @@ char *nvram_get(const char *name)
if (!nvram_buf[0])
early_nvram_init();
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
-@@ -245,6 +245,10 @@ static int bcm47xx_get_invariants(struct
+@@ -246,6 +246,10 @@ static int bcm47xx_get_invariants(struct
if (nvram_getenv("cardbus", buf, sizeof(buf)) >= 0)
iv->has_cardbus_slot = !!simple_strtoul(buf, NULL, 10);
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
-@@ -20,7 +20,8 @@
+@@ -21,7 +21,8 @@
#include <asm/mach-bcm47xx/nvram.h>
#include <asm/mach-bcm47xx/bcm47xx.h>
int err;
u16 *buf;
-@@ -707,10 +706,14 @@ static int ssb_pci_sprom_get(struct ssb_
+@@ -707,10 +706,17 @@ static int ssb_pci_sprom_get(struct ssb_
if (err) {
/* All CRC attempts failed.
* Maybe there is no SPROM on the device?
+ " fallback SPROM failed (err %d)\n",
+ err);
+ } else {
++ ssb_dprintk(KERN_DEBUG PFX "Using SPROM"
++ " revision %d provided by"
++ " platform.\n", sprom->revision);
err = 0;
goto out_free;
}
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
-@@ -23,7 +23,7 @@
+@@ -3,6 +3,7 @@
+ *
+ * Copyright (C) 2005 Broadcom Corporation
+ * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2010-2011 Hauke Mehrtens <hauke@hauke-m.de>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+@@ -23,7 +24,7 @@
static char nvram_buf[NVRAM_SPACE];
/* Probe for NVRAM header */
struct nvram_header *header;
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
-@@ -156,6 +156,22 @@ static void bcm47xx_fill_sprom(struct ss
+@@ -3,6 +3,7 @@
+ * Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
+ * Copyright (C) 2006 Michael Buesch <mb@bu3sch.de>
+ * Copyright (C) 2010 Waldemar Brodkorb <wbx@openadk.org>
++ * Copyright (C) 2010-2011 Hauke Mehrtens <hauke@hauke-m.de>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+@@ -156,6 +157,22 @@ static void bcm47xx_fill_sprom(struct ss
}
}
+ char prefix[10];
+
+ if (bus->bustype == SSB_BUSTYPE_PCI) {
-+ snprintf(prefix, sizeof(prefix), "pci/%x/%x/",
++ snprintf(prefix, sizeof(prefix), "pci/%u/%u/",
+ bus->host_pci->bus->number + 1,
+ PCI_SLOT(bus->host_pci->devfn));
+ bcm47xx_fill_sprom(out, prefix);
static int bcm47xx_get_invariants(struct ssb_bus *bus,
struct ssb_init_invariants *iv)
{
-@@ -212,6 +228,11 @@ void __init plat_mem_setup(void)
+@@ -212,6 +229,11 @@ void __init plat_mem_setup(void)
char buf[100];
struct ssb_mipscore *mcore;
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
-@@ -62,6 +62,11 @@ static void bcm47xx_machine_halt(void)
+@@ -63,6 +63,11 @@ static void bcm47xx_machine_halt(void)
if (nvram_getprefix(prefix, name, buf, sizeof(buf)) >= 0)\
sprom->_outvar = simple_strtoul(buf, NULL, 0);
static inline int nvram_getprefix(const char *prefix, char *name,
char *buf, int len)
{
-@@ -75,6 +80,27 @@ static inline int nvram_getprefix(const
+@@ -76,6 +81,27 @@ static inline int nvram_getprefix(const
return nvram_getenv(name, buf, len);
}
static void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)
{
char buf[100];
-@@ -84,7 +110,8 @@ static void bcm47xx_fill_sprom(struct ss
+@@ -85,7 +111,8 @@ static void bcm47xx_fill_sprom(struct ss
sprom->revision = 1; /* Fallback: Old hardware does not define this. */
READ_FROM_NVRAM(revision, "sromrev", buf);
nvram_parse_macaddr(buf, sprom->il0mac);
if (nvram_getprefix(prefix, "et0macaddr", buf, sizeof(buf)) >= 0)
nvram_parse_macaddr(buf, sprom->et0mac);
-@@ -110,20 +137,36 @@ static void bcm47xx_fill_sprom(struct ss
+@@ -111,20 +138,36 @@ static void bcm47xx_fill_sprom(struct ss
READ_FROM_NVRAM(pa1hib0, "pa1hib0", buf);
READ_FROM_NVRAM(pa1hib2, "pa1hib1", buf);
READ_FROM_NVRAM(pa1hib1, "pa1hib2", buf);
READ_FROM_NVRAM(rxpo2g, "rxpo2g", buf);
READ_FROM_NVRAM(rxpo5g, "rxpo5g", buf);
READ_FROM_NVRAM(rssisav2g, "rssisav2g", buf);
-@@ -135,10 +178,18 @@ static void bcm47xx_fill_sprom(struct ss
+@@ -136,10 +179,18 @@ static void bcm47xx_fill_sprom(struct ss
READ_FROM_NVRAM(rssismf5g, "rssismf5g", buf);
READ_FROM_NVRAM(bxa5g, "bxa5g", buf);
READ_FROM_NVRAM(cck2gpo, "cck2gpo", buf);
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
-@@ -92,3 +92,30 @@ int nvram_getenv(char *name, char *val,
+@@ -93,3 +93,30 @@ int nvram_getenv(char *name, char *val,
return NVRAM_ERR_ENVNOTFOUND;
}
EXPORT_SYMBOL(nvram_getenv);
+EXPORT_SYMBOL(nvram_get);
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
-@@ -311,3 +311,20 @@ void __init plat_mem_setup(void)
+@@ -312,3 +312,20 @@ void __init plat_mem_setup(void)
_machine_halt = bcm47xx_machine_halt;
pm_power_off = bcm47xx_machine_halt;
}
+
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
-@@ -21,6 +21,8 @@
+@@ -22,6 +22,8 @@
#include <asm/mach-bcm47xx/bcm47xx.h>
static char nvram_buf[NVRAM_SPACE];
/* Probe for NVRAM header */
static void early_nvram_init(void)
-@@ -33,6 +35,25 @@ static void early_nvram_init(void)
+@@ -34,6 +36,25 @@ static void early_nvram_init(void)
base = mcore->flash_window;
lim = mcore->flash_window_size;
off = FLASH_MIN;
while (off <= lim) {
-@@ -74,6 +95,12 @@ int nvram_getenv(char *name, char *val,
+@@ -75,6 +96,12 @@ int nvram_getenv(char *name, char *val,
if (!nvram_buf[0])
early_nvram_init();
/* Look for name=value and return value */
var = &nvram_buf[sizeof(struct nvram_header)];
end = nvram_buf + sizeof(nvram_buf) - 2;
-@@ -103,6 +130,9 @@ char *nvram_get(const char *name)
+@@ -104,6 +131,9 @@ char *nvram_get(const char *name)
if (!nvram_buf[0])
early_nvram_init();
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
-@@ -245,6 +245,10 @@ static int bcm47xx_get_invariants(struct
+@@ -246,6 +246,10 @@ static int bcm47xx_get_invariants(struct
if (nvram_getenv("cardbus", buf, sizeof(buf)) >= 0)
iv->has_cardbus_slot = !!simple_strtoul(buf, NULL, 10);
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
-@@ -20,7 +20,8 @@
+@@ -21,7 +21,8 @@
#include <asm/mach-bcm47xx/nvram.h>
#include <asm/mach-bcm47xx/bcm47xx.h>