From 5a20ef3db28faa42dd5dc86ad75d2736bcd3da4c Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 29 Apr 2012 02:04:06 +0200 Subject: 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. Signed-off-by: Hauke Mehrtens Tested-by: Arend van Spriel Signed-off-by: John W. Linville --- arch/mips/bcm47xx/setup.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'arch/mips') diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c index 19780aa9170..d9278a82e00 100644 --- a/arch/mips/bcm47xx/setup.c +++ b/arch/mips/bcm47xx/setup.c @@ -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); -- cgit v1.2.3 From a9bba182a1f3f33ba11abde8226ab2a4c39ce4e7 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 29 Apr 2012 02:04:07 +0200 Subject: MIPS: bcm47xx: refactor fetching board data Now the fetching of board data also uses nvram_read_u16 and not simple_strtoul any more. Signed-off-by: Hauke Mehrtens Acked-by: Ralf Baechle Signed-off-by: John W. Linville --- 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(-) (limited to 'arch/mips') diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c index d9278a82e00..53cdb724424 100644 --- a/arch/mips/bcm47xx/setup.c +++ b/arch/mips/bcm47xx/setup.c @@ -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); diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c index 5c8dcd2a8a9..279991a3583 100644 --- a/arch/mips/bcm47xx/sprom.c +++ b/arch/mips/bcm47xx/sprom.c @@ -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 diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h index 5ecaf47b34d..42887c66ade 100644 --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h @@ -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 */ -- cgit v1.2.3 From 0a2fcaa70ce96be6e663234072984fd2b0ffa36e Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 29 Apr 2012 02:04:08 +0200 Subject: bcma: add boardinfo struct This 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. Signed-off-by: Hauke Mehrtens Tested-by: Arend van Spriel Signed-off-by: John W. Linville --- arch/mips/bcm47xx/setup.c | 2 ++ arch/mips/bcm47xx/sprom.c | 12 ++++++++++++ arch/mips/include/asm/mach-bcm47xx/bcm47xx.h | 4 ++++ 3 files changed, 18 insertions(+) (limited to 'arch/mips') diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c index 53cdb724424..9ef46d2a511 100644 --- a/arch/mips/bcm47xx/setup.c +++ b/arch/mips/bcm47xx/setup.c @@ -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 diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c index 279991a3583..a29d2074303 100644 --- a/arch/mips/bcm47xx/sprom.c +++ b/arch/mips/bcm47xx/sprom.c @@ -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 diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h index 42887c66ade..26fdaf40b93 100644 --- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h +++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h @@ -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 */ -- cgit v1.2.3 From a25595562291baea4ccc2ed570dd15c638b67b21 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 29 Apr 2012 02:04:09 +0200 Subject: MIPS: bcm47xx: read baordrev without prefix from sprom When the boardrev with a prefix is not available, try to read it without a prefix. This is based on code from the Broadcom SDK. Signed-off-by: Hauke Mehrtens Acked-by: Ralf Baechle Signed-off-by: John W. Linville --- arch/mips/bcm47xx/sprom.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/mips') diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c index a29d2074303..17282e0d783 100644 --- a/arch/mips/bcm47xx/sprom.c +++ b/arch/mips/bcm47xx/sprom.c @@ -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); -- cgit v1.2.3 From 5fe2e0711dd9286e46f60f21c8cd580242cf8f89 Mon Sep 17 00:00:00 2001 From: Nathan Hintz Date: Fri, 4 May 2012 21:56:32 -0700 Subject: bcma: Move initialization of SPROM to prevent overwrite The first thing bcm47xx_fill_sprom does is initialize (zero fill) the SPROM. For BCMA SOC, this wipes out any values previously read by bcm47xx_fill_sprom_ethernet (see arch/mips/bcm47xx/setup.c - bcm47xx_get_sprom_bcma). Move the initialization of SPROM so it is called prior to filling in any values. Signed-off-by: Nathan Hintz Signed-off-by: John W. Linville --- arch/mips/bcm47xx/setup.c | 4 ++++ arch/mips/bcm47xx/sprom.c | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'arch/mips') diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c index 9ef46d2a511..95bf4d7bac2 100644 --- a/arch/mips/bcm47xx/setup.c +++ b/arch/mips/bcm47xx/setup.c @@ -90,6 +90,7 @@ static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out) char prefix[10]; if (bus->bustype == SSB_BUSTYPE_PCI) { + memset(out, 0, sizeof(struct ssb_sprom)); snprintf(prefix, sizeof(prefix), "pci/%u/%u/", bus->host_pci->bus->number + 1, PCI_SLOT(bus->host_pci->devfn)); @@ -111,6 +112,7 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus, bcm47xx_fill_ssb_boardinfo(&iv->boardinfo, NULL); + memset(&iv->sprom, 0, sizeof(struct ssb_sprom)); bcm47xx_fill_sprom(&iv->sprom, NULL); if (nvram_getenv("cardbus", buf, sizeof(buf)) >= 0) @@ -159,12 +161,14 @@ static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out) switch (bus->hosttype) { case BCMA_HOSTTYPE_PCI: + memset(out, 0, sizeof(struct ssb_sprom)); 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; case BCMA_HOSTTYPE_SOC: + memset(out, 0, sizeof(struct ssb_sprom)); bcm47xx_fill_sprom_ethernet(out, NULL); core = bcma_find_core(bus, BCMA_CORE_80211); if (core) { diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c index 17282e0d783..d3a889745e2 100644 --- a/arch/mips/bcm47xx/sprom.c +++ b/arch/mips/bcm47xx/sprom.c @@ -557,8 +557,6 @@ void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, const char *prefix) void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix) { - memset(sprom, 0, sizeof(struct ssb_sprom)); - bcm47xx_fill_sprom_ethernet(sprom, prefix); nvram_read_u8(prefix, NULL, "sromrev", &sprom->revision, 0); -- cgit v1.2.3