ssb/bcma/bcm47xx: extend boardinfo and sprom
Subsystems (5)
Hauke Mehrtens
maintainercover ssb/bcma/bcm47xx: extend boardinfo and sprom
This patch series fixes the boardinfo for ssb based devices by removing board_rev from the struct, this should be fetched from sprom. In addition a boardinfo struct was added to bcma.
The pci sprom parsing code was extended for bcma to provide all attributes needed by brcmsmac and that code was also copied to ssb.
This is based on wireless-testing/master.
Hauke Mehrtens (8):
ssb: remove rev from boardinfo
MIPS: bcm47xx: refactor fetching board data
bcma: add boardinfo struct
MIPS: bcm47xx: read baordrev without prefix from sprom ssb/bcma: fill attribute alpha2 from sprom
ssb: fill board_rev attribute from sprom
bcma: read out some additional sprom attributes bcma/ssb: parse new attributes from sprom
arch/mips/bcm47xx/setup.c | 11 +- arch/mips/bcm47xx/sprom.c | 26 +++++ arch/mips/include/asm/mach-bcm47xx/bcm47xx.h | 9 ++ drivers/bcma/host_pci.c | 3 + drivers/bcma/sprom.c | 149 +++++++++++++++++++++++++- drivers/net/wireless/b43/bus.c | 6 +- drivers/net/wireless/b43/main.c | 4 +- drivers/net/wireless/b43legacy/main.c | 2 +- drivers/net/wireless/b43legacy/phy.c | 4 +- drivers/net/wireless/b43legacy/radio.c | 10 +- drivers/ssb/pci.c | 88 +++++++++++++-- include/linux/bcma/bcma.h | 7 ++ include/linux/ssb/ssb.h | 1 - include/linux/ssb/ssb_regs.h | 61 ++++++++++- 14 files changed, 347 insertions(+), 34 deletions(-)
Signature · 1 line
1.7.9.5
Hauke Mehrtens
maintainerPATCH 1/8 ssb: remove rev from boardinfo
Previously the rev contained the revision read from the pci config space and was used as board_rev in the wireless drivers. This is wrong the board_rev is only fetched from the sprom accordingly to the open source part of the Broadcom SDK and brcmsmac. This patch removes the rev from the boardinfo structure and uses the board_rev attribute from sprom instead. This attribute is filled by PCI, PCMCIA, SDIO and SoC code.
--- arch/mips/bcm47xx/setup.c | 2 -- drivers/net/wireless/b43/bus.c | 2 +- drivers/net/wireless/b43/main.c | 4 ++-- drivers/net/wireless/b43legacy/main.c | 2 +- drivers/net/wireless/b43legacy/phy.c | 4 ++-- drivers/net/wireless/b43legacy/radio.c | 10 +++++----- drivers/ssb/pci.c | 1 - include/linux/ssb/ssb.h | 1 - 8 files changed, 11 insertions(+), 15 deletions(-)
arch/mips/bcm47xx/setup.c +0 -2
@@ -115,8 +115,6 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus, iv->boardinfo.vendor =SSB_BOARDVENDOR_BCM ;if (nvram_getenv ("boardtype" , buf,sizeof (buf)) >=0 ) iv->boardinfo.type = (u16 )simple_strtoul (buf,NULL ,0 ); -if (nvram_getenv ("boardrev" , buf,sizeof (buf)) >=0 ) - iv->boardinfo.rev = (u16 )simple_strtoul (buf,NULL ,0 );bcm47xx_fill_sprom (&iv->sprom,NULL );
drivers/net/wireless/b43/bus.c +1 -1
@@ -210,7 +210,7 @@ struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev) dev->board_vendor = sdev->bus->boardinfo.vendor; dev->board_type = sdev->bus->boardinfo.type; - dev->board_rev = sdev->bus->boardinfo.rev; + dev->board_rev = sdev->bus->sprom.board_rev; dev->chip_id = sdev->bus->chip_id; dev->chip_rev = sdev->bus->chip_rev;
drivers/net/wireless/b43/main.c +2 -2
@@ -5243,10 +5243,10 @@ static void b43_sprom_fixup(struct ssb_bus *bus)/* boardflags workarounds */ if (bus->boardinfo.vendor ==SSB_BOARDVENDOR_DELL && - bus->chip_id ==0x4301 && bus->boardinfo.rev ==0x74 ) + bus->chip_id ==0x4301 && bus->sprom.board_rev ==0x74 ) bus->sprom.boardflags_lo |=B43_BFL_BTCOEXIST ;if (bus->boardinfo.vendor ==PCI_VENDOR_ID_APPLE && - bus->boardinfo.type ==0x4E && bus->boardinfo.rev >0x40 ) + bus->boardinfo.type ==0x4E && bus->sprom.board_rev >0x40 ) bus->sprom.boardflags_lo |=B43_BFL_PACTRL ;if (bus->bustype ==SSB_BUSTYPE_PCI ) { pdev = bus->host_pci;
drivers/net/wireless/b43legacy/main.c +1 -1
@@ -3781,7 +3781,7 @@ static void b43legacy_sprom_fixup(struct ssb_bus *bus)/* boardflags workarounds */ if (bus->boardinfo.vendor ==PCI_VENDOR_ID_APPLE && bus->boardinfo.type ==0x4E && - bus->boardinfo.rev >0x40 ) + bus->sprom.board_rev >0x40 ) bus->sprom.boardflags_lo |= B43legacy_BFL_PACTRL; }
drivers/net/wireless/b43legacy/phy.c +2 -2
@@ -408,7 +408,7 @@ static void b43legacy_phy_setupg(struct b43legacy_wldev *dev)if (is_bcm_board_vendor (dev) && (dev->dev->bus->boardinfo.type ==0x0416 ) && - (dev->dev->bus->boardinfo.rev ==0x0017 )) + (dev->dev->bus->sprom.board_rev ==0x0017 ))return ;b43legacy_ilt_write (dev,0x5001 ,0x0002 );
@@ -424,7 +424,7 @@ static void b43legacy_phy_setupg(struct b43legacy_wldev *dev)if (is_bcm_board_vendor (dev) && (dev->dev->bus->boardinfo.type ==0x0416 ) && - (dev->dev->bus->boardinfo.rev ==0x0017 )) + (dev->dev->bus->sprom.board_rev ==0x0017 ))return ;b43legacy_ilt_write (dev,0x0401 ,0x0002 );
drivers/net/wireless/b43legacy/radio.c +5 -5
@@ -1998,7 +1998,7 @@ u16 b43legacy_default_radio_attenuation(struct b43legacy_wldev *dev)if (phy->type == B43legacy_PHYTYPE_G) {if (is_bcm_board_vendor (dev) && dev->dev->bus->boardinfo.type ==0x421 && - dev->dev->bus->boardinfo.rev >=30 ) + dev->dev->bus->sprom.board_rev >=30 ) att =3 ;else if (is_bcm_board_vendor (dev) && dev->dev->bus->boardinfo.type ==0x416 )
@@ -2008,7 +2008,7 @@ u16 b43legacy_default_radio_attenuation(struct b43legacy_wldev *dev) }else {if (is_bcm_board_vendor (dev) && dev->dev->bus->boardinfo.type ==0x421 && - dev->dev->bus->boardinfo.rev >=30 ) + dev->dev->bus->sprom.board_rev >=30 ) att =7 ;else att =6 ;
@@ -2018,7 +2018,7 @@ u16 b43legacy_default_radio_attenuation(struct b43legacy_wldev *dev) if (phy->type == B43legacy_PHYTYPE_G) { if (is_bcm_board_vendor(dev) && dev->dev->bus->boardinfo.type == 0x421 && - dev->dev->bus->boardinfo.rev >= 30) + dev->dev->bus->sprom.board_rev >= 30) att = 3; else if (is_bcm_board_vendor(dev) && dev->dev->bus->boardinfo.type ==
@@ -2052,9 +2052,9 @@ u16 b43legacy_default_radio_attenuation(struct b43legacy_wldev *dev) }if (is_bcm_board_vendor (dev) && dev->dev->bus->boardinfo.type ==0x421 ) { -if (dev->dev->bus->boardinfo.rev <0x43 ) +if (dev->dev->bus->sprom.board_rev <0x43 ) att =2 ; -else if (dev->dev->bus->boardinfo.rev <0x51 ) +else if (dev->dev->bus->sprom.board_rev <0x51 ) att =3 ; }if (att ==0xFFFF )
drivers/ssb/pci.c +0 -1
@@ -784,7 +784,6 @@ static void ssb_pci_get_boardinfo(struct ssb_bus *bus, { bi->vendor = bus->host_pci->subsystem_vendor; bi->type = bus->host_pci->subsystem_device; - bi->rev = bus->host_pci->revision; } int ssb_pci_get_invariants(struct ssb_bus *bus,
include/linux/ssb/ssb.h +0 -1
@@ -188,7 +188,6 @@ struct ssb_sprom {struct ssb_boardinfo {u16 vendor;u16 type; -u8 rev; };
Signature · 1 line
1.7.9.5
Hauke Mehrtens
maintainerPATCH 2/8 MIPS: bcm47xx: refactor fetching board data
In reply to Hauke MehrtensNow the fetching of board data also uses nvram_read_u16 and not simple_strtoul any more.
--- arch/mips/bcm47xx/setup.c | 7 +------ arch/mips/bcm47xx/sprom.c | 12 ++++++++++++ arch/mips/include/asm/mach-bcm47xx/bcm47xx.h | 5 +++++ 3 files changed, 18 insertions(+), 6 deletions(-)
arch/mips/bcm47xx/setup.c +1 -6
@@ -109,12 +109,7 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus,/* Fill boardinfo structure */ memset (&(iv->boardinfo),0 ,sizeof (struct ssb_boardinfo )); -if (nvram_getenv ("boardvendor" , buf,sizeof (buf)) >=0 ) - iv->boardinfo.vendor = (u16 )simple_strtoul (buf,NULL ,0 ); -else - iv->boardinfo.vendor =SSB_BOARDVENDOR_BCM ; -if (nvram_getenv ("boardtype" , buf,sizeof (buf)) >=0 ) - iv->boardinfo.type = (u16 )simple_strtoul (buf,NULL ,0 ); +bcm47xx_fill_ssb_boardinfo (&iv->boardinfo,NULL );bcm47xx_fill_sprom (&iv->sprom,NULL );
arch/mips/bcm47xx/sprom.c +12 -0
@@ -618,3 +618,15 @@ void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)bcm47xx_fill_sprom_r1 (sprom, prefix); } } + +#ifdef CONFIG_BCM47XX_SSB +void bcm47xx_fill_ssb_boardinfo (struct ssb_boardinfo *boardinfo, +const char *prefix) +{ +nvram_read_u16 (prefix,NULL ,"boardvendor" , &boardinfo->vendor,0 ); +if (!boardinfo->vendor) + boardinfo->vendor =SSB_BOARDVENDOR_BCM ; + +nvram_read_u16 (prefix,NULL ,"boardtype" , &boardinfo->type,0 ); +} +#endif
arch/mips/include/asm/mach-bcm47xx/bcm47xx.h +5 -0
@@ -47,4 +47,9 @@ extern enum bcm47xx_bus_type bcm47xx_bus_type;void bcm47xx_fill_sprom (struct ssb_sprom *sprom,const char *prefix);void bcm47xx_fill_sprom_ethernet (struct ssb_sprom *sprom,const char *prefix); +#ifdef CONFIG_BCM47XX_SSB +void bcm47xx_fill_ssb_boardinfo (struct ssb_boardinfo *boardinfo, +const char *prefix); +#endif +#endif /* __ASM_BCM47XX_H */
Signature · 1 line
1.7.9.5
Hauke Mehrtens
maintainerPATCH 3/8 bcma: add boardinfo struct
In reply to Hauke MehrtensThis struct contains information about the board, the chip is running on. The struct is filled for PCIe devices and SoCs. This information is used by b43 and will be used by brcmsmac soon.
--- arch/mips/bcm47xx/setup.c | 2 ++ arch/mips/bcm47xx/sprom.c | 12 ++++++++++++ arch/mips/include/asm/mach-bcm47xx/bcm47xx.h | 4 ++++ drivers/bcma/host_pci.c | 3 +++ drivers/net/wireless/b43/bus.c | 4 +--- include/linux/bcma/bcma.h | 7 +++++++ 6 files changed, 29 insertions(+), 3 deletions(-)
arch/mips/bcm47xx/setup.c +2 -0
@@ -190,6 +190,8 @@ static void __init bcm47xx_register_bcma(void) err =bcma_host_soc_register (&bcm47xx_bus.bcma);if (err)panic ("Failed to initialize BCMA bus (err %d)" , err); + + bcm47xx_fill_bcma_boardinfo(&bcm47xx_bus.bcma.bus.boardinfo, NULL); }#endif
arch/mips/bcm47xx/sprom.c +12 -0
@@ -630,3 +630,15 @@ void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo, nvram_read_u16(prefix, NULL, "boardtype", &boardinfo->type, 0); }#endif + +#ifdef CONFIG_BCM47XX_BCMA +void bcm47xx_fill_bcma_boardinfo (struct bcma_boardinfo *boardinfo, +const char *prefix) +{ +nvram_read_u16 (prefix,NULL ,"boardvendor" , &boardinfo->vendor,0 ); +if (!boardinfo->vendor) + boardinfo->vendor =SSB_BOARDVENDOR_BCM ; + +nvram_read_u16 (prefix,NULL ,"boardtype" , &boardinfo->type,0 ); +} +#endif
arch/mips/include/asm/mach-bcm47xx/bcm47xx.h +4 -0
@@ -51,5 +51,9 @@ void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, const char *prefix);void bcm47xx_fill_ssb_boardinfo (struct ssb_boardinfo *boardinfo,const char *prefix);#endif +#ifdef CONFIG_BCM47XX_BCMA +void bcm47xx_fill_bcma_boardinfo (struct bcma_boardinfo *boardinfo, +const char *prefix); +#endif #endif /* __ASM_BCM47XX_H */
drivers/bcma/host_pci.c +3 -0
@@ -201,6 +201,9 @@ static int __devinit bcma_host_pci_probe(struct pci_dev *dev, bus->hosttype =BCMA_HOSTTYPE_PCI ; bus->ops = &bcma_host_pci_ops; + bus->boardinfo.vendor = bus->host_pci->subsystem_vendor; + bus->boardinfo.type = bus->host_pci->subsystem_device; +/* Register */ err =bcma_bus_register (bus);if (err)
drivers/net/wireless/b43/bus.c +1 -3
@@ -107,11 +107,9 @@ struct b43_bus_dev *b43_bus_dev_bcma_init(struct bcma_device *core) dev->dma_dev = core->dma_dev; dev->irq = core->irq; -/* dev->board_vendor = core->bus->boardinfo.vendor; dev->board_type = core->bus->boardinfo.type; -dev->board_rev = core->bus->boardinfo.rev; -*/ + dev->board_rev = core->bus->sprom.board_rev; dev->chip_id = core->bus->chipinfo.id; dev->chip_rev = core->bus->chipinfo.rev;
include/linux/bcma/bcma.h +7 -0
@@ -26,6 +26,11 @@ struct bcma_chipinfo {u8 pkg; }; +struct bcma_boardinfo { +u16 vendor; +u16 type; +}; +enum bcma_clkmode {BCMA_CLKMODE_FAST ,BCMA_CLKMODE_DYNAMIC ,
@@ -198,6 +203,8 @@ struct bcma_bus {struct bcma_chipinfo chipinfo; +struct bcma_boardinfo boardinfo; +struct bcma_device *mapped_core;struct list_head cores;u8 nr_cores;
Signature · 1 line
1.7.9.5
Hauke Mehrtens
maintainerPATCH 4/8 MIPS: bcm47xx: read baordrev without prefix from sprom
In reply to Hauke MehrtensWhen the boardrev with a prefix is not available, try to read it without a prefix. This is based on code from the Broadcom SDK.
--- arch/mips/bcm47xx/sprom.c | 2 ++ 1 file changed, 2 insertions(+)
arch/mips/bcm47xx/sprom.c +2 -0
@@ -165,6 +165,8 @@ static void bcm47xx_fill_sprom_r1234589(struct ssb_sprom *sprom, const char *prefix) {nvram_read_u16 (prefix,NULL ,"boardrev" , &sprom->board_rev,0 ); +if (!sprom->board_rev) +nvram_read_u16 (NULL ,NULL ,"boardrev" , &sprom->board_rev,0 );nvram_read_u16 (prefix,NULL ,"boardnum" , &sprom->board_num,0 );nvram_read_u8 (prefix,NULL ,"ledbh0" , &sprom->gpio0,0xff );nvram_read_u8 (prefix,NULL ,"ledbh1" , &sprom->gpio1,0xff );
Signature · 1 line
1.7.9.5
Hauke Mehrtens
maintainerPATCH 5/8 ssb/bcma: fill attribute alpha2 from sprom
In reply to Hauke MehrtensThe attribute country_code and alpha2 are two different attributes in the sprom. country_code contains some code in an 8 bit coding and alpha2 contains two chars with the country code. The attributes where read out wrongly in the past and country_code is only available on sprom version 1.
--- drivers/bcma/sprom.c | 3 ++- drivers/ssb/pci.c | 16 +++++++++++----- include/linux/ssb/ssb_regs.h | 1 + 3 files changed, 14 insertions(+), 6 deletions(-)
drivers/bcma/sprom.c +2 -1
@@ -243,7 +243,8 @@ static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom)SPEX (boardflags2_lo,SSB_SPROM8_BFL2LO , ~0 ,0 );SPEX (boardflags2_hi,SSB_SPROM8_BFL2HI , ~0 ,0 ); -SPEX (country_code,SSB_SPROM8_CCODE , ~0 ,0 ); +SPEX (alpha2[0 ],SSB_SPROM8_CCODE ,0xff00 ,8 ); +SPEX (alpha2[1 ],SSB_SPROM8_CCODE ,0x00ff ,0 );/* Extract cores power info info */ for (i =0 ; i <ARRAY_SIZE (pwr_info_offset); i++) {
drivers/ssb/pci.c +11 -5
@@ -360,8 +360,9 @@ static void sprom_extract_r123(struct ssb_sprom *out, const u16 *in)SPEX (et0mdcport,SSB_SPROM1_ETHPHY ,SSB_SPROM1_ETHPHY_ET0M ,14 );SPEX (et1mdcport,SSB_SPROM1_ETHPHY ,SSB_SPROM1_ETHPHY_ET1M ,15 );SPEX (board_rev,SSB_SPROM1_BINF ,SSB_SPROM1_BINF_BREV ,0 ); -SPEX (country_code,SSB_SPROM1_BINF ,SSB_SPROM1_BINF_CCODE , -SSB_SPROM1_BINF_CCODE_SHIFT ); +if (out->revision ==1 ) +SPEX (country_code,SSB_SPROM1_BINF ,SSB_SPROM1_BINF_CCODE , +SSB_SPROM1_BINF_CCODE_SHIFT );SPEX (ant_available_a,SSB_SPROM1_BINF ,SSB_SPROM1_BINF_ANTA ,SSB_SPROM1_BINF_ANTA_SHIFT ); SPEX(ant_available_bg, SSB_SPROM1_BINF, SSB_SPROM1_BINF_ANTBG,
@@ -387,6 +388,8 @@ static void sprom_extract_r123(struct ssb_sprom *out, const u16 *in)SPEX (boardflags_lo,SSB_SPROM1_BFLLO ,0xFFFF ,0 );if (out->revision >=2 )SPEX (boardflags_hi,SSB_SPROM2_BFLHI ,0xFFFF ,0 ); +SPEX (alpha2[0 ],SSB_SPROM1_CCODE ,0xff00 ,8 ); +SPEX (alpha2[1 ],SSB_SPROM1_CCODE ,0x00ff ,0 );/* Extract the antenna gain values. */ out->antenna_gain.a0 = r123_extract_antgain(out->revision, in,
@@ -456,13 +459,15 @@ static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in)SPEX (et1phyaddr,SSB_SPROM4_ETHPHY ,SSB_SPROM4_ETHPHY_ET1A ,SSB_SPROM4_ETHPHY_ET1A_SHIFT );if (out->revision ==4 ) { -SPEX (country_code,SSB_SPROM4_CCODE ,0xFFFF ,0 ); +SPEX (alpha2[0 ],SSB_SPROM4_CCODE ,0xff00 ,8 ); +SPEX (alpha2[1 ],SSB_SPROM4_CCODE ,0x00ff ,0 );SPEX (boardflags_lo,SSB_SPROM4_BFLLO ,0xFFFF ,0 );SPEX (boardflags_hi,SSB_SPROM4_BFLHI ,0xFFFF ,0 );SPEX (boardflags2_lo,SSB_SPROM4_BFL2LO ,0xFFFF ,0 );SPEX (boardflags2_hi,SSB_SPROM4_BFL2HI ,0xFFFF ,0 ); }else { -SPEX (country_code,SSB_SPROM5_CCODE ,0xFFFF ,0 ); +SPEX (alpha2[0 ],SSB_SPROM5_CCODE ,0xff00 ,8 ); +SPEX (alpha2[1 ],SSB_SPROM5_CCODE ,0x00ff ,0 );SPEX (boardflags_lo,SSB_SPROM5_BFLLO ,0xFFFF ,0 );SPEX (boardflags_hi,SSB_SPROM5_BFLHI ,0xFFFF ,0 );SPEX (boardflags2_lo,SSB_SPROM5_BFL2LO ,0xFFFF ,0 );
@@ -525,7 +530,8 @@ static void sprom_extract_r8(struct ssb_sprom *out, const u16 *in) v = in[SPOFF (SSB_SPROM8_IL0MAC ) + i]; *(((__be16 *)out->il0mac) + i) =cpu_to_be16 (v); } -SPEX (country_code,SSB_SPROM8_CCODE ,0xFFFF ,0 ); +SPEX (alpha2[0 ],SSB_SPROM8_CCODE ,0xff00 ,8 ); +SPEX (alpha2[1 ],SSB_SPROM8_CCODE ,0x00ff ,0 );SPEX (boardflags_lo,SSB_SPROM8_BFLLO ,0xFFFF ,0 );SPEX (boardflags_hi,SSB_SPROM8_BFLHI ,0xFFFF ,0 );SPEX (boardflags2_lo,SSB_SPROM8_BFL2LO ,0xFFFF ,0 );
include/linux/ssb/ssb_regs.h +1 -0
@@ -228,6 +228,7 @@#define SSB_SPROM1_AGAIN_BG_SHIFT 0#define SSB_SPROM1_AGAIN_A 0xFF00/* A-PHY */ #define SSB_SPROM1_AGAIN_A_SHIFT 8 +#define SSB_SPROM1_CCODE 0x0076/* SPROM Revision 2 (inherits from rev 1) */ #define SSB_SPROM2_BFLHI 0x0038/* Boardflags (high 16 bits) */
Signature · 1 line
1.7.9.5
Hauke Mehrtens
maintainerPATCH 6/8 ssb: fill board_rev attribute from sprom
In reply to Hauke MehrtensThis attribute is now used in b43 driver and should be filled for all sprom versions.
--- drivers/ssb/pci.c | 2 ++ include/linux/ssb/ssb_regs.h | 1 + 2 files changed, 3 insertions(+)
drivers/ssb/pci.c +2 -0
@@ -458,6 +458,7 @@ static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in)SPEX (et0phyaddr,SSB_SPROM4_ETHPHY ,SSB_SPROM4_ETHPHY_ET0A ,0 );SPEX (et1phyaddr,SSB_SPROM4_ETHPHY ,SSB_SPROM4_ETHPHY_ET1A ,SSB_SPROM4_ETHPHY_ET1A_SHIFT ); +SPEX (board_rev,SSB_SPROM4_BOARDREV ,0xFFFF ,0 );if (out->revision ==4 ) {SPEX (alpha2[0 ],SSB_SPROM4_CCODE ,0xff00 ,8 );SPEX (alpha2[1 ],SSB_SPROM4_CCODE ,0x00ff ,0 );
@@ -530,6 +531,7 @@ static void sprom_extract_r8(struct ssb_sprom *out, const u16 *in) v = in[SPOFF (SSB_SPROM8_IL0MAC ) + i]; *(((__be16 *)out->il0mac) + i) =cpu_to_be16 (v); } +SPEX (board_rev,SSB_SPROM8_BOARDREV ,0xFFFF ,0 );SPEX (alpha2[0 ],SSB_SPROM8_CCODE ,0xff00 ,8 );SPEX (alpha2[1 ],SSB_SPROM8_CCODE ,0x00ff ,0 );SPEX (boardflags_lo,SSB_SPROM8_BFLLO ,0xFFFF ,0 );
include/linux/ssb/ssb_regs.h +1 -0
@@ -268,6 +268,7 @@#define SSB_SPROM3_OFDMGPO 0x107A/* G-PHY OFDM Power Offset (4 bytes, BigEndian) */ /* SPROM Revision 4 */ +#define SSB_SPROM4_BOARDREV 0x0042/* Board revision */ #define SSB_SPROM4_BFLLO 0x0044/* Boardflags (low 16 bits) */ #define SSB_SPROM4_BFLHI 0x0046/* Board Flags Hi */ #define SSB_SPROM4_BFL2LO 0x0048/* Board flags 2 (low 16 bits) */
Signature · 1 line
1.7.9.5
Hauke Mehrtens
maintainerPATCH 7/8 bcma: read out some additional sprom attributes
In reply to Hauke MehrtensThis code is copied from the ssb sprom read code. These attributes are partly used by b43 and brcmsmac and should also be read out on bcma based devices.
--- drivers/bcma/sprom.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+)
drivers/bcma/sprom.c +76 -0
@@ -181,6 +181,10 @@ static int bcma_sprom_valid(const u16 *sprom)#define SPEX (_field, _offset, _mask, _shift) \ bus->sprom._field = ((sprom[SPOFF(_offset)] & (_mask)) >> (_shift)) +#define SPEX32 (_field, _offset, _mask, _shift) \ + bus->sprom._field = ((((u32)sprom[SPOFF((_offset)+2)] << 16 | \ + sprom[SPOFF(_offset)]) & (_mask)) >> (_shift)) +static void bcma_sprom_extract_r8 (struct bcma_bus *bus,const u16 *sprom) {u16 v, o;
@@ -299,6 +303,78 @@ static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom) SSB_SROM8_FEM_TR_ISO_SHIFT);SPEX (fem.ghz5.antswlut,SSB_SPROM8_FEM5G ,SSB_SROM8_FEM_ANTSWLUT ,SSB_SROM8_FEM_ANTSWLUT_SHIFT ); + +SPEX (ant_available_a,SSB_SPROM8_ANTAVAIL ,SSB_SPROM8_ANTAVAIL_A , +SSB_SPROM8_ANTAVAIL_A_SHIFT ); +SPEX (ant_available_bg,SSB_SPROM8_ANTAVAIL ,SSB_SPROM8_ANTAVAIL_BG , +SSB_SPROM8_ANTAVAIL_BG_SHIFT ); +SPEX (maxpwr_bg,SSB_SPROM8_MAXP_BG ,SSB_SPROM8_MAXP_BG_MASK ,0 ); +SPEX (itssi_bg,SSB_SPROM8_MAXP_BG ,SSB_SPROM8_ITSSI_BG , +SSB_SPROM8_ITSSI_BG_SHIFT ); +SPEX (maxpwr_a,SSB_SPROM8_MAXP_A ,SSB_SPROM8_MAXP_A_MASK ,0 ); +SPEX (itssi_a,SSB_SPROM8_MAXP_A ,SSB_SPROM8_ITSSI_A , +SSB_SPROM8_ITSSI_A_SHIFT ); +SPEX (maxpwr_ah,SSB_SPROM8_MAXP_AHL ,SSB_SPROM8_MAXP_AH_MASK ,0 ); +SPEX (maxpwr_al,SSB_SPROM8_MAXP_AHL ,SSB_SPROM8_MAXP_AL_MASK , +SSB_SPROM8_MAXP_AL_SHIFT ); +SPEX (gpio0,SSB_SPROM8_GPIOA ,SSB_SPROM8_GPIOA_P0 ,0 ); +SPEX (gpio1,SSB_SPROM8_GPIOA ,SSB_SPROM8_GPIOA_P1 , +SSB_SPROM8_GPIOA_P1_SHIFT ); +SPEX (gpio2,SSB_SPROM8_GPIOB ,SSB_SPROM8_GPIOB_P2 ,0 ); +SPEX (gpio3,SSB_SPROM8_GPIOB ,SSB_SPROM8_GPIOB_P3 , +SSB_SPROM8_GPIOB_P3_SHIFT ); +SPEX (tri2g,SSB_SPROM8_TRI25G ,SSB_SPROM8_TRI2G ,0 ); +SPEX (tri5g,SSB_SPROM8_TRI25G ,SSB_SPROM8_TRI5G , +SSB_SPROM8_TRI5G_SHIFT ); +SPEX (tri5gl,SSB_SPROM8_TRI5GHL ,SSB_SPROM8_TRI5GL ,0 ); +SPEX (tri5gh,SSB_SPROM8_TRI5GHL ,SSB_SPROM8_TRI5GH , +SSB_SPROM8_TRI5GH_SHIFT ); +SPEX (rxpo2g,SSB_SPROM8_RXPO ,SSB_SPROM8_RXPO2G , +SSB_SPROM8_RXPO2G_SHIFT ); +SPEX (rxpo5g,SSB_SPROM8_RXPO ,SSB_SPROM8_RXPO5G , +SSB_SPROM8_RXPO5G_SHIFT ); +SPEX (rssismf2g,SSB_SPROM8_RSSIPARM2G ,SSB_SPROM8_RSSISMF2G ,0 ); +SPEX (rssismc2g,SSB_SPROM8_RSSIPARM2G ,SSB_SPROM8_RSSISMC2G , +SSB_SPROM8_RSSISMC2G_SHIFT ); +SPEX (rssisav2g,SSB_SPROM8_RSSIPARM2G ,SSB_SPROM8_RSSISAV2G , +SSB_SPROM8_RSSISAV2G_SHIFT ); +SPEX (bxa2g,SSB_SPROM8_RSSIPARM2G ,SSB_SPROM8_BXA2G , +SSB_SPROM8_BXA2G_SHIFT ); +SPEX (rssismf5g,SSB_SPROM8_RSSIPARM5G ,SSB_SPROM8_RSSISMF5G ,0 ); +SPEX (rssismc5g,SSB_SPROM8_RSSIPARM5G ,SSB_SPROM8_RSSISMC5G , +SSB_SPROM8_RSSISMC5G_SHIFT ); +SPEX (rssisav5g,SSB_SPROM8_RSSIPARM5G ,SSB_SPROM8_RSSISAV5G , +SSB_SPROM8_RSSISAV5G_SHIFT ); +SPEX (bxa5g,SSB_SPROM8_RSSIPARM5G ,SSB_SPROM8_BXA5G , +SSB_SPROM8_BXA5G_SHIFT ); + +SPEX (pa0b0,SSB_SPROM8_PA0B0 , ~0 ,0 ); +SPEX (pa0b1,SSB_SPROM8_PA0B1 , ~0 ,0 ); +SPEX (pa0b2,SSB_SPROM8_PA0B2 , ~0 ,0 ); +SPEX (pa1b0,SSB_SPROM8_PA1B0 , ~0 ,0 ); +SPEX (pa1b1,SSB_SPROM8_PA1B1 , ~0 ,0 ); +SPEX (pa1b2,SSB_SPROM8_PA1B2 , ~0 ,0 ); +SPEX (pa1lob0,SSB_SPROM8_PA1LOB0 , ~0 ,0 ); +SPEX (pa1lob1,SSB_SPROM8_PA1LOB1 , ~0 ,0 ); +SPEX (pa1lob2,SSB_SPROM8_PA1LOB2 , ~0 ,0 ); +SPEX (pa1hib0,SSB_SPROM8_PA1HIB0 , ~0 ,0 ); +SPEX (pa1hib1,SSB_SPROM8_PA1HIB1 , ~0 ,0 ); +SPEX (pa1hib2,SSB_SPROM8_PA1HIB2 , ~0 ,0 ); +SPEX (cck2gpo,SSB_SPROM8_CCK2GPO , ~0 ,0 ); +SPEX32 (ofdm2gpo,SSB_SPROM8_OFDM2GPO , ~0 ,0 ); +SPEX32 (ofdm5glpo,SSB_SPROM8_OFDM5GLPO , ~0 ,0 ); +SPEX32 (ofdm5gpo,SSB_SPROM8_OFDM5GPO , ~0 ,0 ); +SPEX32 (ofdm5ghpo,SSB_SPROM8_OFDM5GHPO , ~0 ,0 ); + +/* Extract the antenna gain values. */ +SPEX (antenna_gain.a0,SSB_SPROM8_AGAIN01 , +SSB_SPROM8_AGAIN0 ,SSB_SPROM8_AGAIN0_SHIFT ); +SPEX (antenna_gain.a1,SSB_SPROM8_AGAIN01 , +SSB_SPROM8_AGAIN1 ,SSB_SPROM8_AGAIN1_SHIFT ); +SPEX (antenna_gain.a2,SSB_SPROM8_AGAIN23 , +SSB_SPROM8_AGAIN2 ,SSB_SPROM8_AGAIN2_SHIFT ); +SPEX (antenna_gain.a3,SSB_SPROM8_AGAIN23 , +SSB_SPROM8_AGAIN3 ,SSB_SPROM8_AGAIN3_SHIFT ); }/*
Signature · 1 line
1.7.9.5
Hauke Mehrtens
maintainerPATCH 8/8 bcma/ssb: parse new attributes from sprom
In reply to Hauke MehrtensThese newly added attributes are used by brcmsmac. Now bcma should parse all attributes used by brcmsmac out of the sprom.
--- drivers/bcma/sprom.c | 70 ++++++++++++++++++++++++++++++++++++++++++ drivers/ssb/pci.c | 69 +++++++++++++++++++++++++++++++++++++++++ include/linux/ssb/ssb_regs.h | 59 ++++++++++++++++++++++++++++++++--- 3 files changed, 194 insertions(+), 4 deletions(-)
drivers/bcma/sprom.c +70 -0
@@ -185,6 +185,18 @@ static int bcma_sprom_valid(const u16 *sprom) bus->sprom._field = ((((u32 )sprom[SPOFF ((_offset)+2 )] <<16 | \ sprom[SPOFF(_offset)]) & (_mask)) >> (_shift)) +#define SPEX_ARRAY8 (_field, _offset, _mask, _shift) \ + do { \ + SPEX(_field[0], _offset + 0, _mask, _shift); \ + SPEX(_field[1], _offset + 2, _mask, _shift); \ + SPEX(_field[2], _offset + 4, _mask, _shift); \ + SPEX(_field[3], _offset + 6, _mask, _shift); \ + SPEX(_field[4], _offset + 8, _mask, _shift); \ + SPEX(_field[5], _offset + 10, _mask, _shift); \ + SPEX(_field[6], _offset + 12, _mask, _shift); \ + SPEX(_field[7], _offset + 14, _mask, _shift); \ + } while (0) +static void bcma_sprom_extract_r8 (struct bcma_bus *bus,const u16 *sprom) {u16 v, o;
@@ -375,6 +387,64 @@ static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom) SSB_SPROM8_AGAIN2, SSB_SPROM8_AGAIN2_SHIFT);SPEX (antenna_gain.a3,SSB_SPROM8_AGAIN23 ,SSB_SPROM8_AGAIN3 ,SSB_SPROM8_AGAIN3_SHIFT ); + +SPEX (leddc_on_time,SSB_SPROM8_LEDDC ,SSB_SPROM8_LEDDC_ON , +SSB_SPROM8_LEDDC_ON_SHIFT ); +SPEX (leddc_off_time,SSB_SPROM8_LEDDC ,SSB_SPROM8_LEDDC_OFF , +SSB_SPROM8_LEDDC_OFF_SHIFT ); + +SPEX (txchain,SSB_SPROM8_TXRXC ,SSB_SPROM8_TXRXC_TXCHAIN , +SSB_SPROM8_TXRXC_TXCHAIN_SHIFT ); +SPEX (rxchain,SSB_SPROM8_TXRXC ,SSB_SPROM8_TXRXC_RXCHAIN , +SSB_SPROM8_TXRXC_RXCHAIN_SHIFT ); +SPEX (antswitch,SSB_SPROM8_TXRXC ,SSB_SPROM8_TXRXC_SWITCH , +SSB_SPROM8_TXRXC_SWITCH_SHIFT ); + +SPEX (opo,SSB_SPROM8_OFDM2GPO ,0x00ff ,0 ); + +SPEX_ARRAY8 (mcs2gpo,SSB_SPROM8_2G_MCSPO , ~0 ,0 ); +SPEX_ARRAY8 (mcs5gpo,SSB_SPROM8_5G_MCSPO , ~0 ,0 ); +SPEX_ARRAY8 (mcs5glpo,SSB_SPROM8_5GL_MCSPO , ~0 ,0 ); +SPEX_ARRAY8 (mcs5ghpo,SSB_SPROM8_5GH_MCSPO , ~0 ,0 ); + +SPEX (rawtempsense,SSB_SPROM8_RAWTS ,SSB_SPROM8_RAWTS_RAWTEMP , +SSB_SPROM8_RAWTS_RAWTEMP_SHIFT ); +SPEX (measpower,SSB_SPROM8_RAWTS ,SSB_SPROM8_RAWTS_MEASPOWER , +SSB_SPROM8_RAWTS_MEASPOWER_SHIFT ); +SPEX (tempsense_slope,SSB_SPROM8_OPT_CORRX , +SSB_SPROM8_OPT_CORRX_TEMP_SLOPE , +SSB_SPROM8_OPT_CORRX_TEMP_SLOPE_SHIFT ); +SPEX (tempcorrx,SSB_SPROM8_OPT_CORRX ,SSB_SPROM8_OPT_CORRX_TEMPCORRX , +SSB_SPROM8_OPT_CORRX_TEMPCORRX_SHIFT ); +SPEX (tempsense_option,SSB_SPROM8_OPT_CORRX , +SSB_SPROM8_OPT_CORRX_TEMP_OPTION , +SSB_SPROM8_OPT_CORRX_TEMP_OPTION_SHIFT ); +SPEX (freqoffset_corr,SSB_SPROM8_HWIQ_IQSWP , +SSB_SPROM8_HWIQ_IQSWP_FREQ_CORR , +SSB_SPROM8_HWIQ_IQSWP_FREQ_CORR_SHIFT ); +SPEX (iqcal_swp_dis,SSB_SPROM8_HWIQ_IQSWP , +SSB_SPROM8_HWIQ_IQSWP_IQCAL_SWP , +SSB_SPROM8_HWIQ_IQSWP_IQCAL_SWP_SHIFT ); +SPEX (hw_iqcal_en,SSB_SPROM8_HWIQ_IQSWP ,SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL , +SSB_SPROM8_HWIQ_IQSWP_HW_IQCAL_SHIFT ); + +SPEX (bw40po,SSB_SPROM8_BW40PO , ~0 ,0 ); +SPEX (cddpo,SSB_SPROM8_CDDPO , ~0 ,0 ); +SPEX (stbcpo,SSB_SPROM8_STBCPO , ~0 ,0 ); +SPEX (bwduppo,SSB_SPROM8_BWDUPPO , ~0 ,0 ); + +SPEX (tempthresh,SSB_SPROM8_THERMAL ,SSB_SPROM8_THERMAL_TRESH , +SSB_SPROM8_THERMAL_TRESH_SHIFT ); +SPEX (tempoffset,SSB_SPROM8_THERMAL ,SSB_SPROM8_THERMAL_OFFSET , +SSB_SPROM8_THERMAL_OFFSET_SHIFT ); +SPEX (phycal_tempdelta,SSB_SPROM8_TEMPDELTA , +SSB_SPROM8_TEMPDELTA_PHYCAL , +SSB_SPROM8_TEMPDELTA_PHYCAL_SHIFT ); +SPEX (temps_period,SSB_SPROM8_TEMPDELTA ,SSB_SPROM8_TEMPDELTA_PERIOD , +SSB_SPROM8_TEMPDELTA_PERIOD_SHIFT ); +SPEX (temps_hysteresis,SSB_SPROM8_TEMPDELTA , +SSB_SPROM8_TEMPDELTA_HYSTERESIS , +SSB_SPROM8_TEMPDELTA_HYSTERESIS_SHIFT ); }/*
drivers/ssb/pci.c +69 -0
81 lines not on this page · raw message
include/linux/ssb/ssb_regs.h +55 -4
89 lines not on this page · raw message
Signature · 1 line
1.7.9.5
cover ssb/bcma/bcm47xx: extend boardinfo and sprom
In reply to Hauke MehrtensQuoted 8 lines · Hauke Mehrtens
This patch series fixes the boardinfo for ssb based devices by removing
board_revfrom the struct, this should be fetched from sprom. In addition a boardinfo struct was added to bcma.
The pci sprom parsing code was extended for bcma to provide all attributes needed by brcmsmac and that code was also copied to ssb.This is based on wireless-testing/master.
Quoted 9 lines
Hauke Mehrtens (8):
ssb: remove rev from boardinfo
MIPS: bcm47xx: refactor fetching board data
bcma: add boardinfo struct
MIPS: bcm47xx: read baordrev without prefix from sprom ssb/bcma: fill attribute alpha2 from sprom
ssb: fillboard_revattribute from sprom
bcma: read out some additional sprom attributes bcma/ssb: parse new attributes from sprom
I'd still like to see an ACK from Ralf on the mips stuff?
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you linville at tuxdriver.com might be all we have. Be ready.
cover ssb/bcma/bcm47xx: extend boardinfo and sprom
Quoted 19 lines · John W. Linville
Quoted 8 lines · Hauke Mehrtens
This patch series fixes the boardinfo for ssb based devices by removing
board_revfrom the struct, this should be fetched from sprom. In addition a boardinfo struct was added to bcma.
The pci sprom parsing code was extended for bcma to provide all attributes needed by brcmsmac and that code was also copied to ssb.This is based on wireless-testing/master.
Quoted 9 lines
Hauke Mehrtens (8):
ssb: remove rev from boardinfo
MIPS: bcm47xx: refactor fetching board data
bcma: add boardinfo struct
MIPS: bcm47xx: read baordrev without prefix from sprom ssb/bcma: fill attribute alpha2 from sprom
ssb: fillboard_revattribute from sprom
bcma: read out some additional sprom attributes bcma/ssb: parse new attributes from sprom
Quoted 1 line
I'd still like to see an ACK from Ralf on the mips stuff?
Sorry, I'm awfully backloged.
Ralf