aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/bcm47xx/setup.c39
-rw-r--r--drivers/ssb/Kconfig2
-rw-r--r--drivers/ssb/host_soc.c37
-rw-r--r--drivers/ssb/main.c5
-rw-r--r--drivers/ssb/ssb_private.h3
-rw-r--r--include/linux/ssb/ssb.h10
6 files changed, 47 insertions, 49 deletions
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
index 6d38948f0f1e..c807e32d6d81 100644
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -101,50 +101,13 @@ static void bcm47xx_machine_halt(void)
101} 101}
102 102
103#ifdef CONFIG_BCM47XX_SSB 103#ifdef CONFIG_BCM47XX_SSB
104static int bcm47xx_get_invariants(struct ssb_bus *bus,
105 struct ssb_init_invariants *iv)
106{
107 char buf[20];
108 int len, err;
109
110 /* Fill boardinfo structure */
111 memset(&iv->boardinfo, 0 , sizeof(struct ssb_boardinfo));
112
113 len = bcm47xx_nvram_getenv("boardvendor", buf, sizeof(buf));
114 if (len > 0) {
115 err = kstrtou16(strim(buf), 0, &iv->boardinfo.vendor);
116 if (err)
117 pr_warn("Couldn't parse nvram board vendor entry with value \"%s\"\n",
118 buf);
119 }
120 if (!iv->boardinfo.vendor)
121 iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM;
122
123 len = bcm47xx_nvram_getenv("boardtype", buf, sizeof(buf));
124 if (len > 0) {
125 err = kstrtou16(strim(buf), 0, &iv->boardinfo.type);
126 if (err)
127 pr_warn("Couldn't parse nvram board type entry with value \"%s\"\n",
128 buf);
129 }
130
131 memset(&iv->sprom, 0, sizeof(struct ssb_sprom));
132 bcm47xx_fill_sprom(&iv->sprom, NULL, false);
133
134 if (bcm47xx_nvram_getenv("cardbus", buf, sizeof(buf)) >= 0)
135 iv->has_cardbus_slot = !!simple_strtoul(buf, NULL, 10);
136
137 return 0;
138}
139
140static void __init bcm47xx_register_ssb(void) 104static void __init bcm47xx_register_ssb(void)
141{ 105{
142 int err; 106 int err;
143 char buf[100]; 107 char buf[100];
144 struct ssb_mipscore *mcore; 108 struct ssb_mipscore *mcore;
145 109
146 err = ssb_bus_ssbbus_register(&bcm47xx_bus.ssb, SSB_ENUM_BASE, 110 err = ssb_bus_host_soc_register(&bcm47xx_bus.ssb, SSB_ENUM_BASE);
147 bcm47xx_get_invariants);
148 if (err) 111 if (err)
149 panic("Failed to initialize SSB bus (err %d)", err); 112 panic("Failed to initialize SSB bus (err %d)", err);
150 113
diff --git a/drivers/ssb/Kconfig b/drivers/ssb/Kconfig
index 149214beeda9..0c675861623f 100644
--- a/drivers/ssb/Kconfig
+++ b/drivers/ssb/Kconfig
@@ -82,7 +82,7 @@ config SSB_SDIOHOST
82 82
83config SSB_HOST_SOC 83config SSB_HOST_SOC
84 bool "Support for SSB bus on SoC" 84 bool "Support for SSB bus on SoC"
85 depends on SSB 85 depends on SSB && BCM47XX_NVRAM
86 help 86 help
87 Host interface for a SSB directly mapped into memory. This is 87 Host interface for a SSB directly mapped into memory. This is
88 for some Broadcom SoCs from the BCM47xx and BCM53xx lines. 88 for some Broadcom SoCs from the BCM47xx and BCM53xx lines.
diff --git a/drivers/ssb/host_soc.c b/drivers/ssb/host_soc.c
index c809f255af34..d62992dc08b2 100644
--- a/drivers/ssb/host_soc.c
+++ b/drivers/ssb/host_soc.c
@@ -8,6 +8,7 @@
8 * Licensed under the GNU/GPL. See COPYING for details. 8 * Licensed under the GNU/GPL. See COPYING for details.
9 */ 9 */
10 10
11#include <linux/bcm47xx_nvram.h>
11#include <linux/ssb/ssb.h> 12#include <linux/ssb/ssb.h>
12 13
13#include "ssb_private.h" 14#include "ssb_private.h"
@@ -171,3 +172,39 @@ const struct ssb_bus_ops ssb_host_soc_ops = {
171 .block_write = ssb_host_soc_block_write, 172 .block_write = ssb_host_soc_block_write,
172#endif 173#endif
173}; 174};
175
176int ssb_host_soc_get_invariants(struct ssb_bus *bus,
177 struct ssb_init_invariants *iv)
178{
179 char buf[20];
180 int len, err;
181
182 /* Fill boardinfo structure */
183 memset(&iv->boardinfo, 0, sizeof(struct ssb_boardinfo));
184
185 len = bcm47xx_nvram_getenv("boardvendor", buf, sizeof(buf));
186 if (len > 0) {
187 err = kstrtou16(strim(buf), 0, &iv->boardinfo.vendor);
188 if (err)
189 pr_warn("Couldn't parse nvram board vendor entry with value \"%s\"\n",
190 buf);
191 }
192 if (!iv->boardinfo.vendor)
193 iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM;
194
195 len = bcm47xx_nvram_getenv("boardtype", buf, sizeof(buf));
196 if (len > 0) {
197 err = kstrtou16(strim(buf), 0, &iv->boardinfo.type);
198 if (err)
199 pr_warn("Couldn't parse nvram board type entry with value \"%s\"\n",
200 buf);
201 }
202
203 memset(&iv->sprom, 0, sizeof(struct ssb_sprom));
204 ssb_fill_sprom_with_fallback(bus, &iv->sprom);
205
206 if (bcm47xx_nvram_getenv("cardbus", buf, sizeof(buf)) >= 0)
207 iv->has_cardbus_slot = !!simple_strtoul(buf, NULL, 10);
208
209 return 0;
210}
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index 5d1e9a0fc389..cde5ff7529eb 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -762,15 +762,14 @@ EXPORT_SYMBOL(ssb_bus_sdiobus_register);
762#endif /* CONFIG_SSB_PCMCIAHOST */ 762#endif /* CONFIG_SSB_PCMCIAHOST */
763 763
764#ifdef CONFIG_SSB_HOST_SOC 764#ifdef CONFIG_SSB_HOST_SOC
765int ssb_bus_ssbbus_register(struct ssb_bus *bus, unsigned long baseaddr, 765int ssb_bus_host_soc_register(struct ssb_bus *bus, unsigned long baseaddr)
766 ssb_invariants_func_t get_invariants)
767{ 766{
768 int err; 767 int err;
769 768
770 bus->bustype = SSB_BUSTYPE_SSB; 769 bus->bustype = SSB_BUSTYPE_SSB;
771 bus->ops = &ssb_host_soc_ops; 770 bus->ops = &ssb_host_soc_ops;
772 771
773 err = ssb_bus_register(bus, get_invariants, baseaddr); 772 err = ssb_bus_register(bus, ssb_host_soc_get_invariants, baseaddr);
774 if (!err) { 773 if (!err) {
775 ssb_info("Sonics Silicon Backplane found at address 0x%08lX\n", 774 ssb_info("Sonics Silicon Backplane found at address 0x%08lX\n",
776 baseaddr); 775 baseaddr);
diff --git a/drivers/ssb/ssb_private.h b/drivers/ssb/ssb_private.h
index 15bfd5c7d2d7..c2f5d3969c8b 100644
--- a/drivers/ssb/ssb_private.h
+++ b/drivers/ssb/ssb_private.h
@@ -163,6 +163,9 @@ static inline int ssb_sdio_init(struct ssb_bus *bus)
163 163
164#ifdef CONFIG_SSB_HOST_SOC 164#ifdef CONFIG_SSB_HOST_SOC
165extern const struct ssb_bus_ops ssb_host_soc_ops; 165extern const struct ssb_bus_ops ssb_host_soc_ops;
166
167extern int ssb_host_soc_get_invariants(struct ssb_bus *bus,
168 struct ssb_init_invariants *iv);
166#endif 169#endif
167 170
168/* scan.c */ 171/* scan.c */
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index c3d1a525bacc..26a0b3c3ce5f 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -524,13 +524,9 @@ struct ssb_init_invariants {
524typedef int (*ssb_invariants_func_t)(struct ssb_bus *bus, 524typedef int (*ssb_invariants_func_t)(struct ssb_bus *bus,
525 struct ssb_init_invariants *iv); 525 struct ssb_init_invariants *iv);
526 526
527/* Register a SSB system bus. get_invariants() is called after the 527/* Register SoC bus. */
528 * basic system devices are initialized. 528extern int ssb_bus_host_soc_register(struct ssb_bus *bus,
529 * The invariants are usually fetched from some NVRAM. 529 unsigned long baseaddr);
530 * Put the invariants into the struct pointed to by iv. */
531extern int ssb_bus_ssbbus_register(struct ssb_bus *bus,
532 unsigned long baseaddr,
533 ssb_invariants_func_t get_invariants);
534#ifdef CONFIG_SSB_PCIHOST 530#ifdef CONFIG_SSB_PCIHOST
535extern int ssb_bus_pcibus_register(struct ssb_bus *bus, 531extern int ssb_bus_pcibus_register(struct ssb_bus *bus,
536 struct pci_dev *host_pci); 532 struct pci_dev *host_pci);