All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] MIPS: BCM47xx: Enhancements in Parsing the NVRAM data
@ 2011-05-10 21:31 Hauke Mehrtens
  2011-05-10 21:31   ` Hauke Mehrtens
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Hauke Mehrtens @ 2011-05-10 21:31 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips, Hauke Mehrtens

The first 3 patches add the ability to provide an fallback sprom from 
the nvram when a card connected to the pci bus using a ssb bus itself 
has no own sprom. Then the ssb code now asks the architecture code for 
the data. In the bcm47xx architecture the sprom data is stored in the 
nvram for recent devices and they do not have an own sprom.
Patch #4 looks for some more values in the sprom. Boradcom changed the 
names of some attributes with sprom revision 4.
The last patch fixes the parsing of mac addresses on some devices.

There are still some checkpatch warnings about not using kstrto*. 
  WARNING: consider using kstrto* in preference to simple_strtoul
I will fix this in a later patch as there are many usages of simple_strtoul
in arch/mips/bcm47xx/setup.c.
    
v2: * fix some checkpatch errors and warnings
    * fix spelling issues    

Hauke Mehrtens (5):
  ssb: Change fallback sprom to callback mechanism.
  MIPS: BCM47xx: extend bcm47xx_fill_sprom with prefix.
  MIPS: BCM47xx: register ssb fallback sprom callback
  MIPS: BCM47xx: extend the filling of sprom from nvram
  MIPS: BCM47xx: Fix mac address parsing.

 arch/mips/bcm47xx/nvram.c                  |    3 +-
 arch/mips/bcm47xx/setup.c                  |  130 +++++++++++++++++++++++-----
 arch/mips/bcm63xx/boards/board_bcm963xx.c  |   16 +++-
 arch/mips/include/asm/mach-bcm47xx/nvram.h |   12 ++-
 drivers/ssb/pci.c                          |   16 +++-
 drivers/ssb/sprom.c                        |   43 ++++++----
 drivers/ssb/ssb_private.h                  |    3 +-
 include/linux/ssb/ssb.h                    |    4 +-
 8 files changed, 175 insertions(+), 52 deletions(-)

-- 
1.7.4.1

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/5] ssb: Change fallback sprom to callback mechanism.
@ 2011-05-10 21:31   ` Hauke Mehrtens
  0 siblings, 0 replies; 13+ messages in thread
From: Hauke Mehrtens @ 2011-05-10 21:31 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips, Hauke Mehrtens, netdev, linux-wireless, Florian Fainelli

Some embedded devices like the Netgear WNDR3300 have two SSB based
cards without an own sprom on the pci bus. We have to provide two
different fallback sproms for these and this was not possible with the
old solution. In the bcm47xx architecture the sprom data is stored in
the nvram in the main flash storage. The architecture code will be able
to fill the sprom with the stored data based on the bus where the
device was found.

The bcm63xx code should do the same thing as before, just using the new
API.

Acked-by: Michael Buesch <mb@bu3sch.de>
CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---

v2: * fix some checkpatch errors and warnings
    * spelling issues

 arch/mips/bcm63xx/boards/board_bcm963xx.c |   16 +++++++++-
 drivers/ssb/pci.c                         |   16 +++++++---
 drivers/ssb/sprom.c                       |   43 +++++++++++++++++------------
 drivers/ssb/ssb_private.h                 |    3 +-
 include/linux/ssb/ssb.h                   |    4 ++-
 5 files changed, 55 insertions(+), 27 deletions(-)

diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index 8dba8cf..40b223b 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -643,6 +643,17 @@ static struct ssb_sprom bcm63xx_sprom = {
 	.boardflags_lo		= 0x2848,
 	.boardflags_hi		= 0x0000,
 };
+
+int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
+{
+	if (bus->bustype == SSB_BUSTYPE_PCI) {
+		memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom));
+		return 0;
+	} else {
+		printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n");
+		return -EINVAL;
+	}
+}
 #endif
 
 /*
@@ -793,8 +804,9 @@ void __init board_prom_init(void)
 	if (!board_get_mac_address(bcm63xx_sprom.il0mac)) {
 		memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN);
 		memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN);
-		if (ssb_arch_set_fallback_sprom(&bcm63xx_sprom) < 0)
-			printk(KERN_ERR "failed to register fallback SPROM\n");
+		if (ssb_arch_register_fallback_sprom(
+				&bcm63xx_get_fallback_sprom) < 0)
+			printk(KERN_ERR PFX "failed to register fallback SPROM\n");
 	}
 #endif
 }
diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c
index 6f34963..7ad4858 100644
--- a/drivers/ssb/pci.c
+++ b/drivers/ssb/pci.c
@@ -662,7 +662,6 @@ static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out,
 static int ssb_pci_sprom_get(struct ssb_bus *bus,
 			     struct ssb_sprom *sprom)
 {
-	const struct ssb_sprom *fallback;
 	int err;
 	u16 *buf;
 
@@ -707,10 +706,17 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,
 		if (err) {
 			/* All CRC attempts failed.
 			 * Maybe there is no SPROM on the device?
-			 * If we have a fallback, use that. */
-			fallback = ssb_get_fallback_sprom();
-			if (fallback) {
-				memcpy(sprom, fallback, sizeof(*sprom));
+			 * Now we ask the arch code if there is some sprom
+			 * available for this device in some other storage */
+			err = ssb_fill_sprom_with_fallback(bus, sprom);
+			if (err) {
+				ssb_printk(KERN_WARNING PFX "WARNING: Using"
+					   " 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;
 			}
diff --git a/drivers/ssb/sprom.c b/drivers/ssb/sprom.c
index 5f34d7a..45ff0e3 100644
--- a/drivers/ssb/sprom.c
+++ b/drivers/ssb/sprom.c
@@ -17,7 +17,7 @@
 #include <linux/slab.h>
 
 
-static const struct ssb_sprom *fallback_sprom;
+static int(*get_fallback_sprom)(struct ssb_bus *dev, struct ssb_sprom *out);
 
 
 static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len,
@@ -145,36 +145,43 @@ out:
 }
 
 /**
- * ssb_arch_set_fallback_sprom - Set a fallback SPROM for use if no SPROM is found.
+ * ssb_arch_register_fallback_sprom - Registers a method providing a
+ * fallback SPROM if no SPROM is found.
  *
- * @sprom: The SPROM data structure to register.
+ * @sprom_callback: The callback function.
  *
- * With this function the architecture implementation may register a fallback
- * SPROM data structure. The fallback is only used for PCI based SSB devices,
- * where no valid SPROM can be found in the shadow registers.
+ * With this function the architecture implementation may register a
+ * callback handler which fills the SPROM data structure. The fallback is
+ * only used for PCI based SSB devices, where no valid SPROM can be found
+ * in the shadow registers.
  *
- * This function is useful for weird architectures that have a half-assed SSB device
- * hardwired to their PCI bus.
+ * This function is useful for weird architectures that have a half-assed
+ * SSB device hardwired to their PCI bus.
  *
- * Note that it does only work with PCI attached SSB devices. PCMCIA devices currently
- * don't use this fallback.
- * Architectures must provide the SPROM for native SSB devices anyway,
- * so the fallback also isn't used for native devices.
+ * Note that it does only work with PCI attached SSB devices. PCMCIA
+ * devices currently don't use this fallback.
+ * Architectures must provide the SPROM for native SSB devices anyway, so
+ * the fallback also isn't used for native devices.
  *
- * This function is available for architecture code, only. So it is not exported.
+ * This function is available for architecture code, only. So it is not
+ * exported.
  */
-int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom)
+int ssb_arch_register_fallback_sprom(int (*sprom_callback)(struct ssb_bus *bus,
+				     struct ssb_sprom *out))
 {
-	if (fallback_sprom)
+	if (get_fallback_sprom)
 		return -EEXIST;
-	fallback_sprom = sprom;
+	get_fallback_sprom = sprom_callback;
 
 	return 0;
 }
 
-const struct ssb_sprom *ssb_get_fallback_sprom(void)
+int ssb_fill_sprom_with_fallback(struct ssb_bus *bus, struct ssb_sprom *out)
 {
-	return fallback_sprom;
+	if (!get_fallback_sprom)
+		return -ENOENT;
+
+	return get_fallback_sprom(bus, out);
 }
 
 /* http://bcm-v4.sipsolutions.net/802.11/IsSpromAvailable */
diff --git a/drivers/ssb/ssb_private.h b/drivers/ssb/ssb_private.h
index 0331139..7765301 100644
--- a/drivers/ssb/ssb_private.h
+++ b/drivers/ssb/ssb_private.h
@@ -171,7 +171,8 @@ ssize_t ssb_attr_sprom_store(struct ssb_bus *bus,
 			     const char *buf, size_t count,
 			     int (*sprom_check_crc)(const u16 *sprom, size_t size),
 			     int (*sprom_write)(struct ssb_bus *bus, const u16 *sprom));
-extern const struct ssb_sprom *ssb_get_fallback_sprom(void);
+extern int ssb_fill_sprom_with_fallback(struct ssb_bus *bus,
+					struct ssb_sprom *out);
 
 
 /* core.c */
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 9659eff..045f72a 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -404,7 +404,9 @@ extern bool ssb_is_sprom_available(struct ssb_bus *bus);
 
 /* Set a fallback SPROM.
  * See kdoc at the function definition for complete documentation. */
-extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom);
+extern int ssb_arch_register_fallback_sprom(
+		int (*sprom_callback)(struct ssb_bus *bus,
+		struct ssb_sprom *out));
 
 /* Suspend a SSB bus.
  * Call this from the parent bus suspend routine. */
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 1/5] ssb: Change fallback sprom to callback mechanism.
@ 2011-05-10 21:31   ` Hauke Mehrtens
  0 siblings, 0 replies; 13+ messages in thread
From: Hauke Mehrtens @ 2011-05-10 21:31 UTC (permalink / raw)
  To: ralf-6z/3iImG2C8G8FEW9MqTrA
  Cc: linux-mips-6z/3iImG2C8G8FEW9MqTrA, Hauke Mehrtens,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA, Florian Fainelli

Some embedded devices like the Netgear WNDR3300 have two SSB based
cards without an own sprom on the pci bus. We have to provide two
different fallback sproms for these and this was not possible with the
old solution. In the bcm47xx architecture the sprom data is stored in
the nvram in the main flash storage. The architecture code will be able
to fill the sprom with the stored data based on the bus where the
device was found.

The bcm63xx code should do the same thing as before, just using the new
API.

Acked-by: Michael Buesch <mb-fseUSCV1ubazQB+pC5nmwQ@public.gmane.org>
CC: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
CC: linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
CC: Florian Fainelli <florian-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
Signed-off-by: Hauke Mehrtens <hauke-5/S+JYg5SzeELgA04lAiVw@public.gmane.org>
---

v2: * fix some checkpatch errors and warnings
    * spelling issues

 arch/mips/bcm63xx/boards/board_bcm963xx.c |   16 +++++++++-
 drivers/ssb/pci.c                         |   16 +++++++---
 drivers/ssb/sprom.c                       |   43 +++++++++++++++++------------
 drivers/ssb/ssb_private.h                 |    3 +-
 include/linux/ssb/ssb.h                   |    4 ++-
 5 files changed, 55 insertions(+), 27 deletions(-)

diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
index 8dba8cf..40b223b 100644
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -643,6 +643,17 @@ static struct ssb_sprom bcm63xx_sprom = {
 	.boardflags_lo		= 0x2848,
 	.boardflags_hi		= 0x0000,
 };
+
+int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
+{
+	if (bus->bustype == SSB_BUSTYPE_PCI) {
+		memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom));
+		return 0;
+	} else {
+		printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n");
+		return -EINVAL;
+	}
+}
 #endif
 
 /*
@@ -793,8 +804,9 @@ void __init board_prom_init(void)
 	if (!board_get_mac_address(bcm63xx_sprom.il0mac)) {
 		memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN);
 		memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN);
-		if (ssb_arch_set_fallback_sprom(&bcm63xx_sprom) < 0)
-			printk(KERN_ERR "failed to register fallback SPROM\n");
+		if (ssb_arch_register_fallback_sprom(
+				&bcm63xx_get_fallback_sprom) < 0)
+			printk(KERN_ERR PFX "failed to register fallback SPROM\n");
 	}
 #endif
 }
diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c
index 6f34963..7ad4858 100644
--- a/drivers/ssb/pci.c
+++ b/drivers/ssb/pci.c
@@ -662,7 +662,6 @@ static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out,
 static int ssb_pci_sprom_get(struct ssb_bus *bus,
 			     struct ssb_sprom *sprom)
 {
-	const struct ssb_sprom *fallback;
 	int err;
 	u16 *buf;
 
@@ -707,10 +706,17 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,
 		if (err) {
 			/* All CRC attempts failed.
 			 * Maybe there is no SPROM on the device?
-			 * If we have a fallback, use that. */
-			fallback = ssb_get_fallback_sprom();
-			if (fallback) {
-				memcpy(sprom, fallback, sizeof(*sprom));
+			 * Now we ask the arch code if there is some sprom
+			 * available for this device in some other storage */
+			err = ssb_fill_sprom_with_fallback(bus, sprom);
+			if (err) {
+				ssb_printk(KERN_WARNING PFX "WARNING: Using"
+					   " 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;
 			}
diff --git a/drivers/ssb/sprom.c b/drivers/ssb/sprom.c
index 5f34d7a..45ff0e3 100644
--- a/drivers/ssb/sprom.c
+++ b/drivers/ssb/sprom.c
@@ -17,7 +17,7 @@
 #include <linux/slab.h>
 
 
-static const struct ssb_sprom *fallback_sprom;
+static int(*get_fallback_sprom)(struct ssb_bus *dev, struct ssb_sprom *out);
 
 
 static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len,
@@ -145,36 +145,43 @@ out:
 }
 
 /**
- * ssb_arch_set_fallback_sprom - Set a fallback SPROM for use if no SPROM is found.
+ * ssb_arch_register_fallback_sprom - Registers a method providing a
+ * fallback SPROM if no SPROM is found.
  *
- * @sprom: The SPROM data structure to register.
+ * @sprom_callback: The callback function.
  *
- * With this function the architecture implementation may register a fallback
- * SPROM data structure. The fallback is only used for PCI based SSB devices,
- * where no valid SPROM can be found in the shadow registers.
+ * With this function the architecture implementation may register a
+ * callback handler which fills the SPROM data structure. The fallback is
+ * only used for PCI based SSB devices, where no valid SPROM can be found
+ * in the shadow registers.
  *
- * This function is useful for weird architectures that have a half-assed SSB device
- * hardwired to their PCI bus.
+ * This function is useful for weird architectures that have a half-assed
+ * SSB device hardwired to their PCI bus.
  *
- * Note that it does only work with PCI attached SSB devices. PCMCIA devices currently
- * don't use this fallback.
- * Architectures must provide the SPROM for native SSB devices anyway,
- * so the fallback also isn't used for native devices.
+ * Note that it does only work with PCI attached SSB devices. PCMCIA
+ * devices currently don't use this fallback.
+ * Architectures must provide the SPROM for native SSB devices anyway, so
+ * the fallback also isn't used for native devices.
  *
- * This function is available for architecture code, only. So it is not exported.
+ * This function is available for architecture code, only. So it is not
+ * exported.
  */
-int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom)
+int ssb_arch_register_fallback_sprom(int (*sprom_callback)(struct ssb_bus *bus,
+				     struct ssb_sprom *out))
 {
-	if (fallback_sprom)
+	if (get_fallback_sprom)
 		return -EEXIST;
-	fallback_sprom = sprom;
+	get_fallback_sprom = sprom_callback;
 
 	return 0;
 }
 
-const struct ssb_sprom *ssb_get_fallback_sprom(void)
+int ssb_fill_sprom_with_fallback(struct ssb_bus *bus, struct ssb_sprom *out)
 {
-	return fallback_sprom;
+	if (!get_fallback_sprom)
+		return -ENOENT;
+
+	return get_fallback_sprom(bus, out);
 }
 
 /* http://bcm-v4.sipsolutions.net/802.11/IsSpromAvailable */
diff --git a/drivers/ssb/ssb_private.h b/drivers/ssb/ssb_private.h
index 0331139..7765301 100644
--- a/drivers/ssb/ssb_private.h
+++ b/drivers/ssb/ssb_private.h
@@ -171,7 +171,8 @@ ssize_t ssb_attr_sprom_store(struct ssb_bus *bus,
 			     const char *buf, size_t count,
 			     int (*sprom_check_crc)(const u16 *sprom, size_t size),
 			     int (*sprom_write)(struct ssb_bus *bus, const u16 *sprom));
-extern const struct ssb_sprom *ssb_get_fallback_sprom(void);
+extern int ssb_fill_sprom_with_fallback(struct ssb_bus *bus,
+					struct ssb_sprom *out);
 
 
 /* core.c */
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 9659eff..045f72a 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -404,7 +404,9 @@ extern bool ssb_is_sprom_available(struct ssb_bus *bus);
 
 /* Set a fallback SPROM.
  * See kdoc at the function definition for complete documentation. */
-extern int ssb_arch_set_fallback_sprom(const struct ssb_sprom *sprom);
+extern int ssb_arch_register_fallback_sprom(
+		int (*sprom_callback)(struct ssb_bus *bus,
+		struct ssb_sprom *out));
 
 /* Suspend a SSB bus.
  * Call this from the parent bus suspend routine. */
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/5] MIPS: BCM47xx: extend bcm47xx_fill_sprom with prefix.
  2011-05-10 21:31 [PATCH v2 0/5] MIPS: BCM47xx: Enhancements in Parsing the NVRAM data Hauke Mehrtens
  2011-05-10 21:31   ` Hauke Mehrtens
@ 2011-05-10 21:31 ` Hauke Mehrtens
  2011-05-11 11:54   ` Ralf Baechle
  2011-05-10 21:31 ` [PATCH 3/5] MIPS: BCM47xx: register ssb fallback sprom callback Hauke Mehrtens
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Hauke Mehrtens @ 2011-05-10 21:31 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips, Hauke Mehrtens

When an other ssb based device without an own sprom is attached, using
the PCI bus to the main ssb based device, the data normally found in
the sprom will be stored in the nvram on modern devices. The keys, to
load the data from the nvram, are all using some sort of prefix like
pci/1/1/, pci/1/3/ or sb/1/ before the actual key. This patch extends
bcm47xx_fill_sprom() to make it possible to read out these values when
some prefix was used.
The keys for the sprom data used on the main chip does not have a
prefix.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 arch/mips/bcm47xx/setup.c |   29 +++++++++++++++++++++--------
 1 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
index c95f90b..bbfcf9b 100644
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -57,10 +57,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;
@@ -69,11 +82,11 @@ static void bcm47xx_fill_sprom(struct ssb_sprom *sprom)
 
 	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);
@@ -125,14 +138,14 @@ static void bcm47xx_fill_sprom(struct ssb_sprom *sprom)
 	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);
@@ -158,7 +171,7 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus,
 	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);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/5] MIPS: BCM47xx: register ssb fallback sprom callback
  2011-05-10 21:31 [PATCH v2 0/5] MIPS: BCM47xx: Enhancements in Parsing the NVRAM data Hauke Mehrtens
  2011-05-10 21:31   ` Hauke Mehrtens
  2011-05-10 21:31 ` [PATCH 2/5] MIPS: BCM47xx: extend bcm47xx_fill_sprom with prefix Hauke Mehrtens
@ 2011-05-10 21:31 ` Hauke Mehrtens
  2011-05-11 11:54   ` Ralf Baechle
  2011-05-10 21:31 ` [PATCH 4/5] MIPS: BCM47xx: extend the filling of sprom from nvram Hauke Mehrtens
  2011-05-10 21:31 ` [PATCH v2 5/5] MIPS: BCM47xx: Fix mac address parsing Hauke Mehrtens
  4 siblings, 1 reply; 13+ messages in thread
From: Hauke Mehrtens @ 2011-05-10 21:31 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips, Hauke Mehrtens

We are generating the prefix based on the PCI bus address the device is
on. This is done like Broadcom does it in their code expect that the
the bus number is increased by one. In the SB bus implementation used by
Broadcom the SB bus emulates a PCI bus so the kernel sees one PCI bus
more then in our implementation. We do not handle prefixes like sb/1/
yet as they are only used on the new bus which is not implemented yet.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 arch/mips/bcm47xx/nvram.c |    3 ++-
 arch/mips/bcm47xx/setup.c |   22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
index e5b6615..54db815 100644
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
@@ -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 */
-static void __init early_nvram_init(void)
+static void early_nvram_init(void)
 {
 	struct ssb_mipscore *mcore = &ssb_bcm47xx.mipscore;
 	struct nvram_header *header;
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
index bbfcf9b..258ffcf 100644
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -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
@@ -154,6 +155,22 @@ static void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)
 	}
 }
 
+int bcm47xx_get_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
+{
+	char prefix[10];
+
+	if (bus->bustype == SSB_BUSTYPE_PCI) {
+		snprintf(prefix, sizeof(prefix), "pci/%u/%u/",
+			 bus->host_pci->bus->number + 1,
+			 PCI_SLOT(bus->host_pci->devfn));
+		bcm47xx_fill_sprom(out, prefix);
+		return 0;
+	} else {
+		printk(KERN_WARNING "bcm47xx: unable to fill SPROM for given bustype.\n");
+		return -EINVAL;
+	}
+}
+
 static int bcm47xx_get_invariants(struct ssb_bus *bus,
 				   struct ssb_init_invariants *iv)
 {
@@ -185,6 +202,11 @@ void __init plat_mem_setup(void)
 	char buf[100];
 	struct ssb_mipscore *mcore;
 
+	err = ssb_arch_register_fallback_sprom(&bcm47xx_get_sprom);
+	if (err)
+		printk(KERN_WARNING "bcm47xx: someone else already registered"
+			" a ssb SPROM callback handler (err %d)\n", err);
+
 	err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE,
 				      bcm47xx_get_invariants);
 	if (err)
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/5] MIPS: BCM47xx: extend the filling of sprom from nvram
  2011-05-10 21:31 [PATCH v2 0/5] MIPS: BCM47xx: Enhancements in Parsing the NVRAM data Hauke Mehrtens
                   ` (2 preceding siblings ...)
  2011-05-10 21:31 ` [PATCH 3/5] MIPS: BCM47xx: register ssb fallback sprom callback Hauke Mehrtens
@ 2011-05-10 21:31 ` Hauke Mehrtens
  2011-05-11 11:55   ` Ralf Baechle
  2011-05-10 21:31 ` [PATCH v2 5/5] MIPS: BCM47xx: Fix mac address parsing Hauke Mehrtens
  4 siblings, 1 reply; 13+ messages in thread
From: Hauke Mehrtens @ 2011-05-10 21:31 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips, Hauke Mehrtens

Some members of the struct ssb_sprom where not filled with data
available in the nvram. Some attribute names in the nvram changed from
sprom version 3 to version 4. This patch was done by analyzing the the
pci sprom parser in the ssb code and some open source parts of the
braodcom wireless driver used on embedded devices.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 arch/mips/bcm47xx/setup.c |   81 ++++++++++++++++++++++++++++++++++++--------
 1 files changed, 66 insertions(+), 15 deletions(-)

diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
index 258ffcf..73b529b 100644
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -61,6 +61,11 @@ static void bcm47xx_machine_halt(void)
 	if (nvram_getprefix(prefix, name, buf, sizeof(buf)) >= 0)\
 		sprom->_outvar = simple_strtoul(buf, NULL, 0);
 
+#define READ_FROM_NVRAM2(_outvar, name1, name2, buf) \
+	if (nvram_getprefix(prefix, name1, buf, sizeof(buf)) >= 0 || \
+	    nvram_getprefix(prefix, name2, 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)
 {
@@ -74,6 +79,27 @@ static inline int nvram_getprefix(const char *prefix, char *name,
 	return nvram_getenv(name, buf, len);
 }
 
+static u32 nvram_getu32(const char *name, char *buf, int len)
+{
+	int rv;
+	char key[100];
+	u16 var0, var1;
+
+	snprintf(key, sizeof(key), "%s0", name);
+	rv = nvram_getenv(key, buf, len);
+	/* return 0 here so this looks like unset */
+	if (rv < 0)
+		return 0;
+	var0 = simple_strtoul(buf, NULL, 0);
+
+	snprintf(key, sizeof(key), "%s1", name);
+	rv = nvram_getenv(key, buf, len);
+	if (rv < 0)
+		return 0;
+	var1 = simple_strtoul(buf, NULL, 0);
+	return var1 << 16 | var0;
+}
+
 static void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)
 {
 	char buf[100];
@@ -83,7 +109,8 @@ static void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)
 
 	sprom->revision = 1; /* Fallback: Old hardware does not define this. */
 	READ_FROM_NVRAM(revision, "sromrev", buf);
-	if (nvram_getprefix(prefix, "il0macaddr", buf, sizeof(buf)) >= 0)
+	if (nvram_getprefix(prefix, "il0macaddr", buf, sizeof(buf)) >= 0 ||
+	    nvram_getprefix(prefix, "macaddr", buf, sizeof(buf)) >= 0)
 		nvram_parse_macaddr(buf, sprom->il0mac);
 	if (nvram_getprefix(prefix, "et0macaddr", buf, sizeof(buf)) >= 0)
 		nvram_parse_macaddr(buf, sprom->et0mac);
@@ -109,20 +136,36 @@ static void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)
 	READ_FROM_NVRAM(pa1hib0, "pa1hib0", buf);
 	READ_FROM_NVRAM(pa1hib2, "pa1hib1", buf);
 	READ_FROM_NVRAM(pa1hib1, "pa1hib2", buf);
-	READ_FROM_NVRAM(gpio0, "wl0gpio0", buf);
-	READ_FROM_NVRAM(gpio1, "wl0gpio1", buf);
-	READ_FROM_NVRAM(gpio2, "wl0gpio2", buf);
-	READ_FROM_NVRAM(gpio3, "wl0gpio3", buf);
-	READ_FROM_NVRAM(maxpwr_bg, "pa0maxpwr", buf);
-	READ_FROM_NVRAM(maxpwr_al, "pa1lomaxpwr", buf);
-	READ_FROM_NVRAM(maxpwr_a, "pa1maxpwr", buf);
-	READ_FROM_NVRAM(maxpwr_ah, "pa1himaxpwr", buf);
-	READ_FROM_NVRAM(itssi_a, "pa1itssit", buf);
-	READ_FROM_NVRAM(itssi_bg, "pa0itssit", buf);
+	READ_FROM_NVRAM2(gpio0, "ledbh0", "wl0gpio0", buf);
+	READ_FROM_NVRAM2(gpio1, "ledbh1", "wl0gpio1", buf);
+	READ_FROM_NVRAM2(gpio2, "ledbh2", "wl0gpio2", buf);
+	READ_FROM_NVRAM2(gpio3, "ledbh3", "wl0gpio3", buf);
+	READ_FROM_NVRAM2(maxpwr_bg, "maxp2ga0", "pa0maxpwr", buf);
+	READ_FROM_NVRAM2(maxpwr_al, "maxp5gla0", "pa1lomaxpwr", buf);
+	READ_FROM_NVRAM2(maxpwr_a, "maxp5ga0", "pa1maxpwr", buf);
+	READ_FROM_NVRAM2(maxpwr_ah, "maxp5gha0", "pa1himaxpwr", buf);
+	READ_FROM_NVRAM2(itssi_bg, "itt5ga0", "pa0itssit", buf);
+	READ_FROM_NVRAM2(itssi_a, "itt2ga0", "pa1itssit", buf);
 	READ_FROM_NVRAM(tri2g, "tri2g", buf);
 	READ_FROM_NVRAM(tri5gl, "tri5gl", buf);
 	READ_FROM_NVRAM(tri5g, "tri5g", buf);
 	READ_FROM_NVRAM(tri5gh, "tri5gh", buf);
+	READ_FROM_NVRAM(txpid2g[0], "txpid2ga0", buf);
+	READ_FROM_NVRAM(txpid2g[1], "txpid2ga1", buf);
+	READ_FROM_NVRAM(txpid2g[2], "txpid2ga2", buf);
+	READ_FROM_NVRAM(txpid2g[3], "txpid2ga3", buf);
+	READ_FROM_NVRAM(txpid5g[0], "txpid5ga0", buf);
+	READ_FROM_NVRAM(txpid5g[1], "txpid5ga1", buf);
+	READ_FROM_NVRAM(txpid5g[2], "txpid5ga2", buf);
+	READ_FROM_NVRAM(txpid5g[3], "txpid5ga3", buf);
+	READ_FROM_NVRAM(txpid5gl[0], "txpid5gla0", buf);
+	READ_FROM_NVRAM(txpid5gl[1], "txpid5gla1", buf);
+	READ_FROM_NVRAM(txpid5gl[2], "txpid5gla2", buf);
+	READ_FROM_NVRAM(txpid5gl[3], "txpid5gla3", buf);
+	READ_FROM_NVRAM(txpid5gh[0], "txpid5gha0", buf);
+	READ_FROM_NVRAM(txpid5gh[1], "txpid5gha1", buf);
+	READ_FROM_NVRAM(txpid5gh[2], "txpid5gha2", buf);
+	READ_FROM_NVRAM(txpid5gh[3], "txpid5gha3", buf);
 	READ_FROM_NVRAM(rxpo2g, "rxpo2g", buf);
 	READ_FROM_NVRAM(rxpo5g, "rxpo5g", buf);
 	READ_FROM_NVRAM(rssisav2g, "rssisav2g", buf);
@@ -134,10 +177,18 @@ static void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)
 	READ_FROM_NVRAM(rssismf5g, "rssismf5g", buf);
 	READ_FROM_NVRAM(bxa5g, "bxa5g", buf);
 	READ_FROM_NVRAM(cck2gpo, "cck2gpo", buf);
-	READ_FROM_NVRAM(ofdm2gpo, "ofdm2gpo", buf);
-	READ_FROM_NVRAM(ofdm5glpo, "ofdm5glpo", buf);
-	READ_FROM_NVRAM(ofdm5gpo, "ofdm5gpo", buf);
-	READ_FROM_NVRAM(ofdm5ghpo, "ofdm5ghpo", buf);
+
+	sprom->ofdm2gpo = nvram_getu32("ofdm2gpo", buf, sizeof(buf));
+	sprom->ofdm5glpo = nvram_getu32("ofdm5glpo", buf, sizeof(buf));
+	sprom->ofdm5gpo = nvram_getu32("ofdm5gpo", buf, sizeof(buf));
+	sprom->ofdm5ghpo = nvram_getu32("ofdm5ghpo", buf, sizeof(buf));
+
+	READ_FROM_NVRAM(antenna_gain.ghz24.a0, "ag0", buf);
+	READ_FROM_NVRAM(antenna_gain.ghz24.a1, "ag1", buf);
+	READ_FROM_NVRAM(antenna_gain.ghz24.a2, "ag2", buf);
+	READ_FROM_NVRAM(antenna_gain.ghz24.a3, "ag3", buf);
+	memcpy(&sprom->antenna_gain.ghz5, &sprom->antenna_gain.ghz24,
+	       sizeof(sprom->antenna_gain.ghz5));
 
 	if (nvram_getprefix(prefix, "boardflags", buf, sizeof(buf)) >= 0) {
 		boardflags = simple_strtoul(buf, NULL, 0);
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 5/5] MIPS: BCM47xx: Fix mac address parsing.
  2011-05-10 21:31 [PATCH v2 0/5] MIPS: BCM47xx: Enhancements in Parsing the NVRAM data Hauke Mehrtens
                   ` (3 preceding siblings ...)
  2011-05-10 21:31 ` [PATCH 4/5] MIPS: BCM47xx: extend the filling of sprom from nvram Hauke Mehrtens
@ 2011-05-10 21:31 ` Hauke Mehrtens
  2011-05-11 11:55   ` Ralf Baechle
  4 siblings, 1 reply; 13+ messages in thread
From: Hauke Mehrtens @ 2011-05-10 21:31 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips, Hauke Mehrtens

Some devices like the Netgear WGT634u are using minuses between the
blocks of the mac address and other devices are using colons to
separate them.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
v2: * fix some checkpatch errors and warnings

 arch/mips/include/asm/mach-bcm47xx/nvram.h |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/mips/include/asm/mach-bcm47xx/nvram.h b/arch/mips/include/asm/mach-bcm47xx/nvram.h
index 9759588..184d5ec 100644
--- a/arch/mips/include/asm/mach-bcm47xx/nvram.h
+++ b/arch/mips/include/asm/mach-bcm47xx/nvram.h
@@ -39,8 +39,16 @@ extern int nvram_getenv(char *name, char *val, size_t val_len);
 
 static inline void nvram_parse_macaddr(char *buf, u8 *macaddr)
 {
-	sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &macaddr[0], &macaddr[1],
-	       &macaddr[2], &macaddr[3], &macaddr[4], &macaddr[5]);
+	if (strchr(buf, ':'))
+		sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &macaddr[0],
+			&macaddr[1], &macaddr[2], &macaddr[3], &macaddr[4],
+			&macaddr[5]);
+	else if (strchr(buf, '-'))
+		sscanf(buf, "%hhx-%hhx-%hhx-%hhx-%hhx-%hhx", &macaddr[0],
+			&macaddr[1], &macaddr[2], &macaddr[3], &macaddr[4],
+			&macaddr[5]);
+	else
+		printk(KERN_WARNING "Can not parse mac address: %s\n", buf);
 }
 
 #endif
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/5] ssb: Change fallback sprom to callback mechanism.
  2011-05-10 21:31   ` Hauke Mehrtens
  (?)
@ 2011-05-10 23:12   ` Rafał Miłecki
  -1 siblings, 0 replies; 13+ messages in thread
From: Rafał Miłecki @ 2011-05-10 23:12 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: ralf, linux-mips, netdev, linux-wireless, Florian Fainelli

2011/5/10 Hauke Mehrtens <hauke@hauke-m.de>:
> Some embedded devices like the Netgear WNDR3300 have two SSB based
> cards without an own sprom on the pci bus. We have to provide two
> different fallback sproms for these and this was not possible with the
> old solution. In the bcm47xx architecture the sprom data is stored in
> the nvram in the main flash storage. The architecture code will be able
> to fill the sprom with the stored data based on the bus where the
> device was found.
>
> The bcm63xx code should do the same thing as before, just using the new
> API.
>
> Acked-by: Michael Buesch <mb@bu3sch.de>
> CC: netdev@vger.kernel.org
> CC: linux-wireless@vger.kernel.org
> CC: Florian Fainelli <florian@openwrt.org>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>
> v2: * fix some checkpatch errors and warnings
>    * spelling issues
>
>  arch/mips/bcm63xx/boards/board_bcm963xx.c |   16 +++++++++-
>  drivers/ssb/pci.c                         |   16 +++++++---
>  drivers/ssb/sprom.c                       |   43 +++++++++++++++++------------
>  drivers/ssb/ssb_private.h                 |    3 +-
>  include/linux/ssb/ssb.h                   |    4 ++-
>  5 files changed, 55 insertions(+), 27 deletions(-)
>
> diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c
> index 8dba8cf..40b223b 100644
> --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
> +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
> @@ -643,6 +643,17 @@ static struct ssb_sprom bcm63xx_sprom = {
>        .boardflags_lo          = 0x2848,
>        .boardflags_hi          = 0x0000,
>  };
> +
> +int bcm63xx_get_fallback_sprom(struct ssb_bus *bus, struct ssb_sprom *out)
> +{
> +       if (bus->bustype == SSB_BUSTYPE_PCI) {
> +               memcpy(out, &bcm63xx_sprom, sizeof(struct ssb_sprom));
> +               return 0;
> +       } else {
> +               printk(KERN_ERR PFX "unable to fill SPROM for given bustype.\n");
> +               return -EINVAL;
> +       }
> +}
>  #endif
>
>  /*
> @@ -793,8 +804,9 @@ void __init board_prom_init(void)
>        if (!board_get_mac_address(bcm63xx_sprom.il0mac)) {
>                memcpy(bcm63xx_sprom.et0mac, bcm63xx_sprom.il0mac, ETH_ALEN);
>                memcpy(bcm63xx_sprom.et1mac, bcm63xx_sprom.il0mac, ETH_ALEN);
> -               if (ssb_arch_set_fallback_sprom(&bcm63xx_sprom) < 0)
> -                       printk(KERN_ERR "failed to register fallback SPROM\n");
> +               if (ssb_arch_register_fallback_sprom(
> +                               &bcm63xx_get_fallback_sprom) < 0)
> +                       printk(KERN_ERR PFX "failed to register fallback SPROM\n");
>        }
>  #endif
>  }
> diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c
> index 6f34963..7ad4858 100644
> --- a/drivers/ssb/pci.c
> +++ b/drivers/ssb/pci.c
> @@ -662,7 +662,6 @@ static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out,
>  static int ssb_pci_sprom_get(struct ssb_bus *bus,
>                             struct ssb_sprom *sprom)
>  {
> -       const struct ssb_sprom *fallback;
>        int err;
>        u16 *buf;
>
> @@ -707,10 +706,17 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,
>                if (err) {
>                        /* All CRC attempts failed.
>                         * Maybe there is no SPROM on the device?
> -                        * If we have a fallback, use that. */
> -                       fallback = ssb_get_fallback_sprom();
> -                       if (fallback) {
> -                               memcpy(sprom, fallback, sizeof(*sprom));
> +                        * Now we ask the arch code if there is some sprom
> +                        * available for this device in some other storage */
> +                       err = ssb_fill_sprom_with_fallback(bus, sprom);
> +                       if (err) {
> +                               ssb_printk(KERN_WARNING PFX "WARNING: Using"
> +                                          " fallback SPROM failed (err %d)\n",
> +                                          err);

I was recently told we should not duplicate message levels info with
own prefixes ("WARNING: ").

-- 
Rafał

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/5] ssb: Change fallback sprom to callback mechanism.
  2011-05-10 21:31   ` Hauke Mehrtens
  (?)
  (?)
@ 2011-05-11 11:53   ` Ralf Baechle
  -1 siblings, 0 replies; 13+ messages in thread
From: Ralf Baechle @ 2011-05-11 11:53 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linux-mips, netdev, linux-wireless, Florian Fainelli

Thanks, queued for 2.6.40.

  Ralf

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/5] MIPS: BCM47xx: extend bcm47xx_fill_sprom with prefix.
  2011-05-10 21:31 ` [PATCH 2/5] MIPS: BCM47xx: extend bcm47xx_fill_sprom with prefix Hauke Mehrtens
@ 2011-05-11 11:54   ` Ralf Baechle
  0 siblings, 0 replies; 13+ messages in thread
From: Ralf Baechle @ 2011-05-11 11:54 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linux-mips

Thanks, queued for 2.6.40.

  Ral

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 3/5] MIPS: BCM47xx: register ssb fallback sprom callback
  2011-05-10 21:31 ` [PATCH 3/5] MIPS: BCM47xx: register ssb fallback sprom callback Hauke Mehrtens
@ 2011-05-11 11:54   ` Ralf Baechle
  0 siblings, 0 replies; 13+ messages in thread
From: Ralf Baechle @ 2011-05-11 11:54 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linux-mips

Thanks, queued for 2.6.40.

  Ralf

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 4/5] MIPS: BCM47xx: extend the filling of sprom from nvram
  2011-05-10 21:31 ` [PATCH 4/5] MIPS: BCM47xx: extend the filling of sprom from nvram Hauke Mehrtens
@ 2011-05-11 11:55   ` Ralf Baechle
  0 siblings, 0 replies; 13+ messages in thread
From: Ralf Baechle @ 2011-05-11 11:55 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linux-mips

Thanks, queued for 2.6.40.

  Ralf

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 5/5] MIPS: BCM47xx: Fix mac address parsing.
  2011-05-10 21:31 ` [PATCH v2 5/5] MIPS: BCM47xx: Fix mac address parsing Hauke Mehrtens
@ 2011-05-11 11:55   ` Ralf Baechle
  0 siblings, 0 replies; 13+ messages in thread
From: Ralf Baechle @ 2011-05-11 11:55 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linux-mips

Thanks, queued for 2.6.40.

  Ralf

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-05-11 17:03 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-10 21:31 [PATCH v2 0/5] MIPS: BCM47xx: Enhancements in Parsing the NVRAM data Hauke Mehrtens
2011-05-10 21:31 ` [PATCH v2 1/5] ssb: Change fallback sprom to callback mechanism Hauke Mehrtens
2011-05-10 21:31   ` Hauke Mehrtens
2011-05-10 23:12   ` Rafał Miłecki
2011-05-11 11:53   ` Ralf Baechle
2011-05-10 21:31 ` [PATCH 2/5] MIPS: BCM47xx: extend bcm47xx_fill_sprom with prefix Hauke Mehrtens
2011-05-11 11:54   ` Ralf Baechle
2011-05-10 21:31 ` [PATCH 3/5] MIPS: BCM47xx: register ssb fallback sprom callback Hauke Mehrtens
2011-05-11 11:54   ` Ralf Baechle
2011-05-10 21:31 ` [PATCH 4/5] MIPS: BCM47xx: extend the filling of sprom from nvram Hauke Mehrtens
2011-05-11 11:55   ` Ralf Baechle
2011-05-10 21:31 ` [PATCH v2 5/5] MIPS: BCM47xx: Fix mac address parsing Hauke Mehrtens
2011-05-11 11:55   ` Ralf Baechle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.