All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] MIPS: BCM47xx: Enhancements in Parsing the NVRAM data
@ 2011-05-07 12:27 Hauke Mehrtens
  2011-05-07 12:27 ` [PATCH 1/5] ssb: Change fallback sprom to callback mechanism Hauke Mehrtens
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Hauke Mehrtens @ 2011-05-07 12:27 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.

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 |   11 ++-
 drivers/ssb/pci.c                          |   16 +++-
 drivers/ssb/sprom.c                        |   26 +++---
 drivers/ssb/ssb_private.h                  |    2 +-
 include/linux/ssb/ssb.h                    |    4 +-
 8 files changed, 163 insertions(+), 45 deletions(-)

-- 
1.7.4.1

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

* [PATCH 1/5] ssb: Change fallback sprom to callback mechanism.
  2011-05-07 12:27 [PATCH 0/5] MIPS: BCM47xx: Enhancements in Parsing the NVRAM data Hauke Mehrtens
@ 2011-05-07 12:27 ` Hauke Mehrtens
  2011-05-07 17:24   ` Jonas Gorski
  2011-05-07 12:27 ` [PATCH 2/5] MIPS: BCM47xx: extend bcm47xx_fill_sprom with prefix Hauke Mehrtens
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Hauke Mehrtens @ 2011-05-07 12:27 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips, Hauke Mehrtens, Michael Buesch, netdev, 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 to the same thing as before, just using the new
API.

CC: Michael Buesch <mb@bu3sch.de>
CC: netdev@vger.kernel.org
CC: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 arch/mips/bcm63xx/boards/board_bcm963xx.c |   16 ++++++++++++++--
 drivers/ssb/pci.c                         |   16 +++++++++++-----
 drivers/ssb/sprom.c                       |   26 +++++++++++++++-----------
 drivers/ssb/ssb_private.h                 |    2 +-
 include/linux/ssb/ssb.h                   |    4 +++-
 5 files changed, 44 insertions(+), 20 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..34955d1 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
+			 * avaliable 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..20cd139 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,13 +145,14 @@ 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 callbcak 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 wills 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.
@@ -163,18 +164,21 @@ out:
  *
  * 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..1a32f58 100644
--- a/drivers/ssb/ssb_private.h
+++ b/drivers/ssb/ssb_private.h
@@ -171,7 +171,7 @@ 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 2/5] MIPS: BCM47xx: extend bcm47xx_fill_sprom with prefix.
  2011-05-07 12:27 [PATCH 0/5] MIPS: BCM47xx: Enhancements in Parsing the NVRAM data Hauke Mehrtens
  2011-05-07 12:27 ` [PATCH 1/5] ssb: Change fallback sprom to callback mechanism Hauke Mehrtens
@ 2011-05-07 12:27 ` Hauke Mehrtens
  2011-05-07 12:27 ` [PATCH 3/5] MIPS: BCM47xx: register ssb fallback sprom callback Hauke Mehrtens
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Hauke Mehrtens @ 2011-05-07 12:27 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-07 12:27 [PATCH 0/5] MIPS: BCM47xx: Enhancements in Parsing the NVRAM data Hauke Mehrtens
  2011-05-07 12:27 ` [PATCH 1/5] ssb: Change fallback sprom to callback mechanism Hauke Mehrtens
  2011-05-07 12:27 ` [PATCH 2/5] MIPS: BCM47xx: extend bcm47xx_fill_sprom with prefix Hauke Mehrtens
@ 2011-05-07 12:27 ` Hauke Mehrtens
  2011-05-07 12:27 ` [PATCH 4/5] MIPS: BCM47xx: extend the filling of sprom from nvram Hauke Mehrtens
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Hauke Mehrtens @ 2011-05-07 12:27 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-07 12:27 [PATCH 0/5] MIPS: BCM47xx: Enhancements in Parsing the NVRAM data Hauke Mehrtens
                   ` (2 preceding siblings ...)
  2011-05-07 12:27 ` [PATCH 3/5] MIPS: BCM47xx: register ssb fallback sprom callback Hauke Mehrtens
@ 2011-05-07 12:27 ` Hauke Mehrtens
  2011-05-07 12:27 ` [PATCH 5/5] MIPS: BCM47xx: Fix mac address parsing Hauke Mehrtens
  2011-05-10 15:27 ` [PATCH 0/5] MIPS: BCM47xx: Enhancements in Parsing the NVRAM data Ralf Baechle
  5 siblings, 0 replies; 13+ messages in thread
From: Hauke Mehrtens @ 2011-05-07 12:27 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 5/5] MIPS: BCM47xx: Fix mac address parsing.
  2011-05-07 12:27 [PATCH 0/5] MIPS: BCM47xx: Enhancements in Parsing the NVRAM data Hauke Mehrtens
                   ` (3 preceding siblings ...)
  2011-05-07 12:27 ` [PATCH 4/5] MIPS: BCM47xx: extend the filling of sprom from nvram Hauke Mehrtens
@ 2011-05-07 12:27 ` Hauke Mehrtens
  2011-05-07 15:04   ` Sergei Shtylyov
  2011-05-10 15:27 ` [PATCH 0/5] MIPS: BCM47xx: Enhancements in Parsing the NVRAM data Ralf Baechle
  5 siblings, 1 reply; 13+ messages in thread
From: Hauke Mehrtens @ 2011-05-07 12:27 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>
---
 arch/mips/include/asm/mach-bcm47xx/nvram.h |   11 +++++++++--
 1 files changed, 9 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..fcdeca7 100644
--- a/arch/mips/include/asm/mach-bcm47xx/nvram.h
+++ b/arch/mips/include/asm/mach-bcm47xx/nvram.h
@@ -39,8 +39,15 @@ 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 5/5] MIPS: BCM47xx: Fix mac address parsing.
  2011-05-07 12:27 ` [PATCH 5/5] MIPS: BCM47xx: Fix mac address parsing Hauke Mehrtens
@ 2011-05-07 15:04   ` Sergei Shtylyov
  2011-05-07 16:15     ` Hauke Mehrtens
  0 siblings, 1 reply; 13+ messages in thread
From: Sergei Shtylyov @ 2011-05-07 15:04 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: ralf, linux-mips

Hello.

Hauke Mehrtens wrote:

> 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>
> ---
>  arch/mips/include/asm/mach-bcm47xx/nvram.h |   11 +++++++++--
>  1 files changed, 9 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..fcdeca7 100644
> --- a/arch/mips/include/asm/mach-bcm47xx/nvram.h
> +++ b/arch/mips/include/asm/mach-bcm47xx/nvram.h
> @@ -39,8 +39,15 @@ 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

    checkcptach.pl says:

WARNING: line over 80 characters
#21: FILE: arch/mips/include/asm/mach-bcm47xx/nvram.h:43:
+		sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &macaddr[0], &macaddr[1],

WARNING: line over 80 characters
#24: FILE: arch/mips/include/asm/mach-bcm47xx/nvram.h:46:
+		sscanf(buf, "%hhx-%hhx-%hhx-%hhx-%hhx-%hhx", &macaddr[0], &macaddr[1],

total: 0 errors, 2 warnings, 17 lines checked

patches/MIPS-BCM47xx-Fix-mac-address-parsing.patch has style problems, please 
review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

    Additionally, though the script doesn't warn about this, {} are not 
necessary -- every branch is really a single statement.

WBR, Sergei

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

* Re: [PATCH 5/5] MIPS: BCM47xx: Fix mac address parsing.
  2011-05-07 15:04   ` Sergei Shtylyov
@ 2011-05-07 16:15     ` Hauke Mehrtens
  0 siblings, 0 replies; 13+ messages in thread
From: Hauke Mehrtens @ 2011-05-07 16:15 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: ralf, linux-mips

On 05/07/2011 05:04 PM, Sergei Shtylyov wrote:
> Hello.
> 
> Hauke Mehrtens wrote:
> 
>> 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>
>> ---
>>  arch/mips/include/asm/mach-bcm47xx/nvram.h |   11 +++++++++--
>>  1 files changed, 9 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..fcdeca7 100644
>> --- a/arch/mips/include/asm/mach-bcm47xx/nvram.h
>> +++ b/arch/mips/include/asm/mach-bcm47xx/nvram.h
>> @@ -39,8 +39,15 @@ 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
> 
>    checkcptach.pl says:
> 
> WARNING: line over 80 characters
> #21: FILE: arch/mips/include/asm/mach-bcm47xx/nvram.h:43:
> +        sscanf(buf, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &macaddr[0],
> &macaddr[1],
> 
> WARNING: line over 80 characters
> #24: FILE: arch/mips/include/asm/mach-bcm47xx/nvram.h:46:
> +        sscanf(buf, "%hhx-%hhx-%hhx-%hhx-%hhx-%hhx", &macaddr[0],
> &macaddr[1],
> 
> total: 0 errors, 2 warnings, 17 lines checked
> 
> patches/MIPS-BCM47xx-Fix-mac-address-parsing.patch has style problems,
> please review.  If any of these errors
> are false positives report them to the maintainer, see
> CHECKPATCH in MAINTAINERS.
> 
>    Additionally, though the script doesn't warn about this, {} are not
> necessary -- every branch is really a single statement.
> 
> WBR, Sergei
Hi Sergei,

I will fix this and send a new version. I checked it with checkpatch,
but changed some parts after that. ;-)

Hauke

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

* Re: [PATCH 1/5] ssb: Change fallback sprom to callback mechanism.
  2011-05-07 12:27 ` [PATCH 1/5] ssb: Change fallback sprom to callback mechanism Hauke Mehrtens
@ 2011-05-07 17:24   ` Jonas Gorski
  2011-05-10 15:27     ` Ralf Baechle
  0 siblings, 1 reply; 13+ messages in thread
From: Jonas Gorski @ 2011-05-07 17:24 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: ralf, linux-mips, Michael Buesch, netdev, Florian Fainelli

Hi,

just some small small spelling nit-picks:

On 7 May 2011 14:27, Hauke Mehrtens <hauke@hauke-m.de> wrote:
> 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 to the same thing as before, just using the new

to -> do

> API.
>
> CC: Michael Buesch <mb@bu3sch.de>
> CC: netdev@vger.kernel.org
> CC: Florian Fainelli <florian@openwrt.org>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  arch/mips/bcm63xx/boards/board_bcm963xx.c |   16 ++++++++++++++--
>  drivers/ssb/pci.c                         |   16 +++++++++++-----
>  drivers/ssb/sprom.c                       |   26 +++++++++++++++-----------
>  drivers/ssb/ssb_private.h                 |    2 +-
>  include/linux/ssb/ssb.h                   |    4 +++-
>  5 files changed, 44 insertions(+), 20 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..34955d1 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
> +                        * avaliable for this device in some other storage */

avaliable -> available

> +                       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..20cd139 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,13 +145,14 @@ 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 callbcak function.

callbcak -> callback

>  *
> - * 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 wills the SPROM data structure. The fallback is only used for

wills -> fills

> + * 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.
> @@ -163,18 +164,21 @@ out:
>  *
>  * 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..1a32f58 100644
> --- a/drivers/ssb/ssb_private.h
> +++ b/drivers/ssb/ssb_private.h
> @@ -171,7 +171,7 @@ 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	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/5] ssb: Change fallback sprom to callback mechanism.
  2011-05-07 17:24   ` Jonas Gorski
@ 2011-05-10 15:27     ` Ralf Baechle
  2011-05-10 15:28       ` Michael Büsch
  0 siblings, 1 reply; 13+ messages in thread
From: Ralf Baechle @ 2011-05-10 15:27 UTC (permalink / raw)
  To: Jonas Gorski
  Cc: Hauke Mehrtens, linux-mips, Michael Buesch, netdev, Florian Fainelli

On Sat, May 07, 2011 at 07:24:18PM +0200, Jonas Gorski wrote:

> just some small small spelling nit-picks:

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

Michael,

can I have an Ack for this patch assuming the raised spelling issues will
get fixed?  Thanks,

  Ralf

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

* Re: [PATCH 0/5] MIPS: BCM47xx: Enhancements in Parsing the NVRAM data
  2011-05-07 12:27 [PATCH 0/5] MIPS: BCM47xx: Enhancements in Parsing the NVRAM data Hauke Mehrtens
                   ` (4 preceding siblings ...)
  2011-05-07 12:27 ` [PATCH 5/5] MIPS: BCM47xx: Fix mac address parsing Hauke Mehrtens
@ 2011-05-10 15:27 ` Ralf Baechle
  2011-05-10 15:29   ` Hauke Mehrtens
  5 siblings, 1 reply; 13+ messages in thread
From: Ralf Baechle @ 2011-05-10 15:27 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linux-mips

I assume you're going to resend the series with the raised issues fixed
so I'll drop the entire series for now.

Thanks!

  Ralf

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

* Re: [PATCH 1/5] ssb: Change fallback sprom to callback mechanism.
  2011-05-10 15:27     ` Ralf Baechle
@ 2011-05-10 15:28       ` Michael Büsch
  0 siblings, 0 replies; 13+ messages in thread
From: Michael Büsch @ 2011-05-10 15:28 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: Jonas Gorski, Hauke Mehrtens, linux-mips, Michael Buesch, netdev,
	Florian Fainelli

On Tue, 2011-05-10 at 16:27 +0100, Ralf Baechle wrote: 
> On Sat, May 07, 2011 at 07:24:18PM +0200, Jonas Gorski wrote:
> 
> > just some small small spelling nit-picks:
> 
> > > CC: Michael Buesch <mb@bu3sch.de>
> > > CC: netdev@vger.kernel.org
> > > CC: Florian Fainelli <florian@openwrt.org>
> > > Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> 
> Michael,
> 
> can I have an Ack for this patch assuming the raised spelling issues will
> get fixed?  Thanks,

I'd still prefer a platform-data based mechanism, but this would
be much more intrusive.
So yeah. ACK, for the time being.

-- 
Greetings Michael.


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

* Re: [PATCH 0/5] MIPS: BCM47xx: Enhancements in Parsing the NVRAM data
  2011-05-10 15:27 ` [PATCH 0/5] MIPS: BCM47xx: Enhancements in Parsing the NVRAM data Ralf Baechle
@ 2011-05-10 15:29   ` Hauke Mehrtens
  0 siblings, 0 replies; 13+ messages in thread
From: Hauke Mehrtens @ 2011-05-10 15:29 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips

On 05/10/2011 05:27 PM, Ralf Baechle wrote:
> I assume you're going to resend the series with the raised issues fixed
> so I'll drop the entire series for now.
> 
> Thanks!
> 
>   Ralf
Hi Ralf,

yes I will fix the raised spelling issues and the checkpatch warnings
and resend it today.

Hauke

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

end of thread, other threads:[~2011-05-10 15:29 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-07 12:27 [PATCH 0/5] MIPS: BCM47xx: Enhancements in Parsing the NVRAM data Hauke Mehrtens
2011-05-07 12:27 ` [PATCH 1/5] ssb: Change fallback sprom to callback mechanism Hauke Mehrtens
2011-05-07 17:24   ` Jonas Gorski
2011-05-10 15:27     ` Ralf Baechle
2011-05-10 15:28       ` Michael Büsch
2011-05-07 12:27 ` [PATCH 2/5] MIPS: BCM47xx: extend bcm47xx_fill_sprom with prefix Hauke Mehrtens
2011-05-07 12:27 ` [PATCH 3/5] MIPS: BCM47xx: register ssb fallback sprom callback Hauke Mehrtens
2011-05-07 12:27 ` [PATCH 4/5] MIPS: BCM47xx: extend the filling of sprom from nvram Hauke Mehrtens
2011-05-07 12:27 ` [PATCH 5/5] MIPS: BCM47xx: Fix mac address parsing Hauke Mehrtens
2011-05-07 15:04   ` Sergei Shtylyov
2011-05-07 16:15     ` Hauke Mehrtens
2011-05-10 15:27 ` [PATCH 0/5] MIPS: BCM47xx: Enhancements in Parsing the NVRAM data Ralf Baechle
2011-05-10 15:29   ` Hauke Mehrtens

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.