aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2012-05-22 15:18:06 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-05-22 15:18:06 -0400
commita0d0d1685f9763ab26a394df3ab84026b39a06a7 (patch)
tree4165dc6fd3266977ab4b3fa3b379c47597f97d88 /arch/mips
parent31a67102f4762df5544bc2dfb34a931233d2a5b2 (diff)
parent05f8f25276ea8c7d41b3649890d6eaf179e67a81 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/bcm47xx/setup.c15
-rw-r--r--arch/mips/bcm47xx/sprom.c28
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/bcm47xx.h9
3 files changed, 42 insertions, 10 deletions
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
index 19780aa91708..95bf4d7bac21 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)
90 char prefix[10]; 90 char prefix[10];
91 91
92 if (bus->bustype == SSB_BUSTYPE_PCI) { 92 if (bus->bustype == SSB_BUSTYPE_PCI) {
93 memset(out, 0, sizeof(struct ssb_sprom));
93 snprintf(prefix, sizeof(prefix), "pci/%u/%u/", 94 snprintf(prefix, sizeof(prefix), "pci/%u/%u/",
94 bus->host_pci->bus->number + 1, 95 bus->host_pci->bus->number + 1,
95 PCI_SLOT(bus->host_pci->devfn)); 96 PCI_SLOT(bus->host_pci->devfn));
@@ -109,15 +110,9 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus,
109 /* Fill boardinfo structure */ 110 /* Fill boardinfo structure */
110 memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo)); 111 memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo));
111 112
112 if (nvram_getenv("boardvendor", buf, sizeof(buf)) >= 0) 113 bcm47xx_fill_ssb_boardinfo(&iv->boardinfo, NULL);
113 iv->boardinfo.vendor = (u16)simple_strtoul(buf, NULL, 0);
114 else
115 iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM;
116 if (nvram_getenv("boardtype", buf, sizeof(buf)) >= 0)
117 iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0);
118 if (nvram_getenv("boardrev", buf, sizeof(buf)) >= 0)
119 iv->boardinfo.rev = (u16)simple_strtoul(buf, NULL, 0);
120 114
115 memset(&iv->sprom, 0, sizeof(struct ssb_sprom));
121 bcm47xx_fill_sprom(&iv->sprom, NULL); 116 bcm47xx_fill_sprom(&iv->sprom, NULL);
122 117
123 if (nvram_getenv("cardbus", buf, sizeof(buf)) >= 0) 118 if (nvram_getenv("cardbus", buf, sizeof(buf)) >= 0)
@@ -166,12 +161,14 @@ static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out)
166 161
167 switch (bus->hosttype) { 162 switch (bus->hosttype) {
168 case BCMA_HOSTTYPE_PCI: 163 case BCMA_HOSTTYPE_PCI:
164 memset(out, 0, sizeof(struct ssb_sprom));
169 snprintf(prefix, sizeof(prefix), "pci/%u/%u/", 165 snprintf(prefix, sizeof(prefix), "pci/%u/%u/",
170 bus->host_pci->bus->number + 1, 166 bus->host_pci->bus->number + 1,
171 PCI_SLOT(bus->host_pci->devfn)); 167 PCI_SLOT(bus->host_pci->devfn));
172 bcm47xx_fill_sprom(out, prefix); 168 bcm47xx_fill_sprom(out, prefix);
173 return 0; 169 return 0;
174 case BCMA_HOSTTYPE_SOC: 170 case BCMA_HOSTTYPE_SOC:
171 memset(out, 0, sizeof(struct ssb_sprom));
175 bcm47xx_fill_sprom_ethernet(out, NULL); 172 bcm47xx_fill_sprom_ethernet(out, NULL);
176 core = bcma_find_core(bus, BCMA_CORE_80211); 173 core = bcma_find_core(bus, BCMA_CORE_80211);
177 if (core) { 174 if (core) {
@@ -197,6 +194,8 @@ static void __init bcm47xx_register_bcma(void)
197 err = bcma_host_soc_register(&bcm47xx_bus.bcma); 194 err = bcma_host_soc_register(&bcm47xx_bus.bcma);
198 if (err) 195 if (err)
199 panic("Failed to initialize BCMA bus (err %d)", err); 196 panic("Failed to initialize BCMA bus (err %d)", err);
197
198 bcm47xx_fill_bcma_boardinfo(&bcm47xx_bus.bcma.bus.boardinfo, NULL);
200} 199}
201#endif 200#endif
202 201
diff --git a/arch/mips/bcm47xx/sprom.c b/arch/mips/bcm47xx/sprom.c
index 5c8dcd2a8a93..d3a889745e20 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,
165 const char *prefix) 165 const char *prefix)
166{ 166{
167 nvram_read_u16(prefix, NULL, "boardrev", &sprom->board_rev, 0); 167 nvram_read_u16(prefix, NULL, "boardrev", &sprom->board_rev, 0);
168 if (!sprom->board_rev)
169 nvram_read_u16(NULL, NULL, "boardrev", &sprom->board_rev, 0);
168 nvram_read_u16(prefix, NULL, "boardnum", &sprom->board_num, 0); 170 nvram_read_u16(prefix, NULL, "boardnum", &sprom->board_num, 0);
169 nvram_read_u8(prefix, NULL, "ledbh0", &sprom->gpio0, 0xff); 171 nvram_read_u8(prefix, NULL, "ledbh0", &sprom->gpio0, 0xff);
170 nvram_read_u8(prefix, NULL, "ledbh1", &sprom->gpio1, 0xff); 172 nvram_read_u8(prefix, NULL, "ledbh1", &sprom->gpio1, 0xff);
@@ -555,8 +557,6 @@ void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, const char *prefix)
555 557
556void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix) 558void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)
557{ 559{
558 memset(sprom, 0, sizeof(struct ssb_sprom));
559
560 bcm47xx_fill_sprom_ethernet(sprom, prefix); 560 bcm47xx_fill_sprom_ethernet(sprom, prefix);
561 561
562 nvram_read_u8(prefix, NULL, "sromrev", &sprom->revision, 0); 562 nvram_read_u8(prefix, NULL, "sromrev", &sprom->revision, 0);
@@ -618,3 +618,27 @@ void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)
618 bcm47xx_fill_sprom_r1(sprom, prefix); 618 bcm47xx_fill_sprom_r1(sprom, prefix);
619 } 619 }
620} 620}
621
622#ifdef CONFIG_BCM47XX_SSB
623void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
624 const char *prefix)
625{
626 nvram_read_u16(prefix, NULL, "boardvendor", &boardinfo->vendor, 0);
627 if (!boardinfo->vendor)
628 boardinfo->vendor = SSB_BOARDVENDOR_BCM;
629
630 nvram_read_u16(prefix, NULL, "boardtype", &boardinfo->type, 0);
631}
632#endif
633
634#ifdef CONFIG_BCM47XX_BCMA
635void bcm47xx_fill_bcma_boardinfo(struct bcma_boardinfo *boardinfo,
636 const char *prefix)
637{
638 nvram_read_u16(prefix, NULL, "boardvendor", &boardinfo->vendor, 0);
639 if (!boardinfo->vendor)
640 boardinfo->vendor = SSB_BOARDVENDOR_BCM;
641
642 nvram_read_u16(prefix, NULL, "boardtype", &boardinfo->type, 0);
643}
644#endif
diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
index 5ecaf47b34d2..26fdaf40b930 100644
--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
@@ -47,4 +47,13 @@ extern enum bcm47xx_bus_type bcm47xx_bus_type;
47void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix); 47void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix);
48void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, const char *prefix); 48void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, const char *prefix);
49 49
50#ifdef CONFIG_BCM47XX_SSB
51void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
52 const char *prefix);
53#endif
54#ifdef CONFIG_BCM47XX_BCMA
55void bcm47xx_fill_bcma_boardinfo(struct bcma_boardinfo *boardinfo,
56 const char *prefix);
57#endif
58
50#endif /* __ASM_BCM47XX_H */ 59#endif /* __ASM_BCM47XX_H */