linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ssb: sprom: add dev_id field for value overriding standard ID
@ 2014-05-17 22:22 Rafał Miłecki
  2014-05-18  9:43 ` Hauke Mehrtens
  0 siblings, 1 reply; 3+ messages in thread
From: Rafał Miłecki @ 2014-05-17 22:22 UTC (permalink / raw)
  To: linux-wireless, John W. Linville
  Cc: Hauke Mehrtens, b43-dev, Rafał Miłecki

Some devices may have different features despite sharing the same ID
(e.g. PCI ID). For example 14e4:4331 is usually a dual band, but this
can be "limited". Device with "pci/x/y/devid=0x4332" supports 2.4 GHz
only. Similarly 0x4333 will mean support for 5 GHz only.
Add entry in SPROM so info described above can be extracted and stored.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
I managed to find "devid" on every common SPROM rev:
pci/1/1/sromrev=2
pci/1/1/devid=0x4318

pci/1/1/sromrev=4
pci/1/1/devid=0x4329

pci/1/1/sromrev=8
pci/1/1/devid=0x432d

pci/1/1/sromrev=9
pci/1/1/devid=0x4332

pci/1/1/sromrev=11
pci/1/1/devid=0x43a1

So it makes the most sense to always try to extract it.
---
 arch/mips/bcm47xx/sprom.c | 1 +
 include/linux/ssb/ssb.h   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
index a8b5408..da4cdb1 100644
--- a/arch/mips/bcm47xx/sprom.c
+++ b/arch/mips/bcm47xx/sprom.c
@@ -168,6 +168,7 @@ static void nvram_read_alpha2(const char *prefix, const char *name,
 static void bcm47xx_fill_sprom_r1234589(struct ssb_sprom *sprom,
 					const char *prefix, bool fallback)
 {
+	nvram_read_u16(prefix, NULL, "devid", &sprom->dev_id, 0, fallback);
 	nvram_read_u8(prefix, NULL, "ledbh0", &sprom->gpio0, 0xff, fallback);
 	nvram_read_u8(prefix, NULL, "ledbh1", &sprom->gpio1, 0xff, fallback);
 	nvram_read_u8(prefix, NULL, "ledbh2", &sprom->gpio2, 0xff, fallback);
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 07ef9b8..4568a5c 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -33,6 +33,7 @@ struct ssb_sprom {
 	u8 et1phyaddr;		/* MII address for enet1 */
 	u8 et0mdcport;		/* MDIO for enet0 */
 	u8 et1mdcport;		/* MDIO for enet1 */
+	u16 dev_id;		/* Device ID overriding e.g. PCI ID */
 	u16 board_rev;		/* Board revision number from SPROM. */
 	u16 board_num;		/* Board number from SPROM. */
 	u16 board_type;		/* Board type from SPROM. */
-- 
1.8.4.5


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

* Re: [PATCH] ssb: sprom: add dev_id field for value overriding standard ID
  2014-05-17 22:22 [PATCH] ssb: sprom: add dev_id field for value overriding standard ID Rafał Miłecki
@ 2014-05-18  9:43 ` Hauke Mehrtens
  2014-05-18 10:18   ` Rafał Miłecki
  0 siblings, 1 reply; 3+ messages in thread
From: Hauke Mehrtens @ 2014-05-18  9:43 UTC (permalink / raw)
  To: Rafał Miłecki, linux-wireless, John W. Linville; +Cc: b43-dev

On 05/18/2014 12:22 AM, Rafał Miłecki wrote:
> Some devices may have different features despite sharing the same ID
> (e.g. PCI ID). For example 14e4:4331 is usually a dual band, but this
> can be "limited". Device with "pci/x/y/devid=0x4332" supports 2.4 GHz
> only. Similarly 0x4333 will mean support for 5 GHz only.
> Add entry in SPROM so info described above can be extracted and stored.
> 
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Acked-by: Hauke Mehrtens <hauke@hauke-m.de>

This patch is ok, I missed that when adding BCM4716 support to brcmsmac.
There is also a vendid var which should be used. See this code from
brcmsmac:
http://lxr.free-electrons.com/source/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c?v=3.0#L660

Hauke

> ---
> I managed to find "devid" on every common SPROM rev:
> pci/1/1/sromrev=2
> pci/1/1/devid=0x4318
> 
> pci/1/1/sromrev=4
> pci/1/1/devid=0x4329
> 
> pci/1/1/sromrev=8
> pci/1/1/devid=0x432d
> 
> pci/1/1/sromrev=9
> pci/1/1/devid=0x4332
> 
> pci/1/1/sromrev=11
> pci/1/1/devid=0x43a1
> 
> So it makes the most sense to always try to extract it.
> ---
>  arch/mips/bcm47xx/sprom.c | 1 +
>  include/linux/ssb/ssb.h   | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
> index a8b5408..da4cdb1 100644
> --- a/arch/mips/bcm47xx/sprom.c
> +++ b/arch/mips/bcm47xx/sprom.c
> @@ -168,6 +168,7 @@ static void nvram_read_alpha2(const char *prefix, const char *name,
>  static void bcm47xx_fill_sprom_r1234589(struct ssb_sprom *sprom,
>  					const char *prefix, bool fallback)
>  {
> +	nvram_read_u16(prefix, NULL, "devid", &sprom->dev_id, 0, fallback);
>  	nvram_read_u8(prefix, NULL, "ledbh0", &sprom->gpio0, 0xff, fallback);
>  	nvram_read_u8(prefix, NULL, "ledbh1", &sprom->gpio1, 0xff, fallback);
>  	nvram_read_u8(prefix, NULL, "ledbh2", &sprom->gpio2, 0xff, fallback);
> diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
> index 07ef9b8..4568a5c 100644
> --- a/include/linux/ssb/ssb.h
> +++ b/include/linux/ssb/ssb.h
> @@ -33,6 +33,7 @@ struct ssb_sprom {
>  	u8 et1phyaddr;		/* MII address for enet1 */
>  	u8 et0mdcport;		/* MDIO for enet0 */
>  	u8 et1mdcport;		/* MDIO for enet1 */
> +	u16 dev_id;		/* Device ID overriding e.g. PCI ID */
>  	u16 board_rev;		/* Board revision number from SPROM. */
>  	u16 board_num;		/* Board number from SPROM. */
>  	u16 board_type;		/* Board type from SPROM. */
> 


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

* Re: [PATCH] ssb: sprom: add dev_id field for value overriding standard ID
  2014-05-18  9:43 ` Hauke Mehrtens
@ 2014-05-18 10:18   ` Rafał Miłecki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafał Miłecki @ 2014-05-18 10:18 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linux-wireless, John W. Linville, b43-dev

On 18 May 2014 11:43, Hauke Mehrtens <hauke@hauke-m.de> wrote:
> There is also a vendid var which should be used. See this code from
> brcmsmac:
> http://lxr.free-electrons.com/source/drivers/staging/brcm80211/brcmsmac/wlc_bmac.c?v=3.0#L660

You're right, but is this used anywhere?

I can't reliably follow brcmsmac code, it copies the same data over
and over. Simple grepping for "vendorid" shows copying from "vendorid"
to "vendorid" of various structs, no real usage.
The one exception is "sha_params.vid = wlc_hw->vendorid;. However grepping with:
grep -R "\.vid" ./*
grep -R "\->vid" ./*
doesn't reveal any usage neither.

Seems like a dead code.

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

end of thread, other threads:[~2014-05-18 10:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-17 22:22 [PATCH] ssb: sprom: add dev_id field for value overriding standard ID Rafał Miłecki
2014-05-18  9:43 ` Hauke Mehrtens
2014-05-18 10:18   ` Rafał Miłecki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).