diff options
Diffstat (limited to 'arch/mips/bcm47xx/setup.c')
-rw-r--r-- | arch/mips/bcm47xx/setup.c | 91 |
1 files changed, 29 insertions, 62 deletions
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c index c00585d915bc..e43b5046cb30 100644 --- a/arch/mips/bcm47xx/setup.c +++ b/arch/mips/bcm47xx/setup.c | |||
@@ -102,23 +102,6 @@ static void bcm47xx_machine_halt(void) | |||
102 | } | 102 | } |
103 | 103 | ||
104 | #ifdef CONFIG_BCM47XX_SSB | 104 | #ifdef CONFIG_BCM47XX_SSB |
105 | static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out) | ||
106 | { | ||
107 | char prefix[10]; | ||
108 | |||
109 | if (bus->bustype == SSB_BUSTYPE_PCI) { | ||
110 | memset(out, 0, sizeof(struct ssb_sprom)); | ||
111 | snprintf(prefix, sizeof(prefix), "pci/%u/%u/", | ||
112 | bus->host_pci->bus->number + 1, | ||
113 | PCI_SLOT(bus->host_pci->devfn)); | ||
114 | bcm47xx_fill_sprom(out, prefix, false); | ||
115 | return 0; | ||
116 | } else { | ||
117 | printk(KERN_WARNING "bcm47xx: unable to fill SPROM for given bustype.\n"); | ||
118 | return -EINVAL; | ||
119 | } | ||
120 | } | ||
121 | |||
122 | static int bcm47xx_get_invariants(struct ssb_bus *bus, | 105 | static int bcm47xx_get_invariants(struct ssb_bus *bus, |
123 | struct ssb_init_invariants *iv) | 106 | struct ssb_init_invariants *iv) |
124 | { | 107 | { |
@@ -144,11 +127,6 @@ static void __init bcm47xx_register_ssb(void) | |||
144 | char buf[100]; | 127 | char buf[100]; |
145 | struct ssb_mipscore *mcore; | 128 | struct ssb_mipscore *mcore; |
146 | 129 | ||
147 | err = ssb_arch_register_fallback_sprom(&bcm47xx_get_sprom_ssb); | ||
148 | if (err) | ||
149 | printk(KERN_WARNING "bcm47xx: someone else already registered" | ||
150 | " a ssb SPROM callback handler (err %d)\n", err); | ||
151 | |||
152 | err = ssb_bus_ssbbus_register(&(bcm47xx_bus.ssb), SSB_ENUM_BASE, | 130 | err = ssb_bus_ssbbus_register(&(bcm47xx_bus.ssb), SSB_ENUM_BASE, |
153 | bcm47xx_get_invariants); | 131 | bcm47xx_get_invariants); |
154 | if (err) | 132 | if (err) |
@@ -171,56 +149,21 @@ static void __init bcm47xx_register_ssb(void) | |||
171 | #endif | 149 | #endif |
172 | 150 | ||
173 | #ifdef CONFIG_BCM47XX_BCMA | 151 | #ifdef CONFIG_BCM47XX_BCMA |
174 | static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out) | ||
175 | { | ||
176 | char prefix[10]; | ||
177 | struct bcma_device *core; | ||
178 | |||
179 | switch (bus->hosttype) { | ||
180 | case BCMA_HOSTTYPE_PCI: | ||
181 | memset(out, 0, sizeof(struct ssb_sprom)); | ||
182 | snprintf(prefix, sizeof(prefix), "pci/%u/%u/", | ||
183 | bus->host_pci->bus->number + 1, | ||
184 | PCI_SLOT(bus->host_pci->devfn)); | ||
185 | bcm47xx_fill_sprom(out, prefix, false); | ||
186 | return 0; | ||
187 | case BCMA_HOSTTYPE_SOC: | ||
188 | memset(out, 0, sizeof(struct ssb_sprom)); | ||
189 | core = bcma_find_core(bus, BCMA_CORE_80211); | ||
190 | if (core) { | ||
191 | snprintf(prefix, sizeof(prefix), "sb/%u/", | ||
192 | core->core_index); | ||
193 | bcm47xx_fill_sprom(out, prefix, true); | ||
194 | } else { | ||
195 | bcm47xx_fill_sprom(out, NULL, false); | ||
196 | } | ||
197 | return 0; | ||
198 | default: | ||
199 | pr_warn("bcm47xx: unable to fill SPROM for given bustype.\n"); | ||
200 | return -EINVAL; | ||
201 | } | ||
202 | } | ||
203 | |||
204 | static void __init bcm47xx_register_bcma(void) | 152 | static void __init bcm47xx_register_bcma(void) |
205 | { | 153 | { |
206 | int err; | 154 | int err; |
207 | 155 | ||
208 | err = bcma_arch_register_fallback_sprom(&bcm47xx_get_sprom_bcma); | ||
209 | if (err) | ||
210 | pr_warn("bcm47xx: someone else already registered a bcma SPROM callback handler (err %d)\n", err); | ||
211 | |||
212 | err = bcma_host_soc_register(&bcm47xx_bus.bcma); | 156 | err = bcma_host_soc_register(&bcm47xx_bus.bcma); |
213 | if (err) | 157 | if (err) |
214 | panic("Failed to register BCMA bus (err %d)", err); | 158 | panic("Failed to register BCMA bus (err %d)", err); |
215 | |||
216 | err = bcma_host_soc_init(&bcm47xx_bus.bcma); | ||
217 | if (err) | ||
218 | panic("Failed to initialize BCMA bus (err %d)", err); | ||
219 | |||
220 | bcm47xx_fill_bcma_boardinfo(&bcm47xx_bus.bcma.bus.boardinfo, NULL); | ||
221 | } | 159 | } |
222 | #endif | 160 | #endif |
223 | 161 | ||
162 | /* | ||
163 | * Memory setup is done in the early part of MIPS's arch_mem_init. It's supposed | ||
164 | * to detect memory and record it with add_memory_region. | ||
165 | * Any extra initializaion performed here must not use kmalloc or bootmem. | ||
166 | */ | ||
224 | void __init plat_mem_setup(void) | 167 | void __init plat_mem_setup(void) |
225 | { | 168 | { |
226 | struct cpuinfo_mips *c = ¤t_cpu_data; | 169 | struct cpuinfo_mips *c = ¤t_cpu_data; |
@@ -229,6 +172,7 @@ void __init plat_mem_setup(void) | |||
229 | printk(KERN_INFO "bcm47xx: using bcma bus\n"); | 172 | printk(KERN_INFO "bcm47xx: using bcma bus\n"); |
230 | #ifdef CONFIG_BCM47XX_BCMA | 173 | #ifdef CONFIG_BCM47XX_BCMA |
231 | bcm47xx_bus_type = BCM47XX_BUS_TYPE_BCMA; | 174 | bcm47xx_bus_type = BCM47XX_BUS_TYPE_BCMA; |
175 | bcm47xx_sprom_register_fallbacks(); | ||
232 | bcm47xx_register_bcma(); | 176 | bcm47xx_register_bcma(); |
233 | bcm47xx_set_system_type(bcm47xx_bus.bcma.bus.chipinfo.id); | 177 | bcm47xx_set_system_type(bcm47xx_bus.bcma.bus.chipinfo.id); |
234 | #ifdef CONFIG_HIGHMEM | 178 | #ifdef CONFIG_HIGHMEM |
@@ -239,6 +183,7 @@ void __init plat_mem_setup(void) | |||
239 | printk(KERN_INFO "bcm47xx: using ssb bus\n"); | 183 | printk(KERN_INFO "bcm47xx: using ssb bus\n"); |
240 | #ifdef CONFIG_BCM47XX_SSB | 184 | #ifdef CONFIG_BCM47XX_SSB |
241 | bcm47xx_bus_type = BCM47XX_BUS_TYPE_SSB; | 185 | bcm47xx_bus_type = BCM47XX_BUS_TYPE_SSB; |
186 | bcm47xx_sprom_register_fallbacks(); | ||
242 | bcm47xx_register_ssb(); | 187 | bcm47xx_register_ssb(); |
243 | bcm47xx_set_system_type(bcm47xx_bus.ssb.chip_id); | 188 | bcm47xx_set_system_type(bcm47xx_bus.ssb.chip_id); |
244 | #endif | 189 | #endif |
@@ -247,6 +192,28 @@ void __init plat_mem_setup(void) | |||
247 | _machine_restart = bcm47xx_machine_restart; | 192 | _machine_restart = bcm47xx_machine_restart; |
248 | _machine_halt = bcm47xx_machine_halt; | 193 | _machine_halt = bcm47xx_machine_halt; |
249 | pm_power_off = bcm47xx_machine_halt; | 194 | pm_power_off = bcm47xx_machine_halt; |
195 | } | ||
196 | |||
197 | /* | ||
198 | * This finishes bus initialization doing things that were not possible without | ||
199 | * kmalloc. Make sure to call it late enough (after mm_init). | ||
200 | */ | ||
201 | void __init bcm47xx_bus_setup(void) | ||
202 | { | ||
203 | #ifdef CONFIG_BCM47XX_BCMA | ||
204 | if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_BCMA) { | ||
205 | int err; | ||
206 | |||
207 | err = bcma_host_soc_init(&bcm47xx_bus.bcma); | ||
208 | if (err) | ||
209 | panic("Failed to initialize BCMA bus (err %d)", err); | ||
210 | |||
211 | bcm47xx_fill_bcma_boardinfo(&bcm47xx_bus.bcma.bus.boardinfo, | ||
212 | NULL); | ||
213 | } | ||
214 | #endif | ||
215 | |||
216 | /* With bus initialized we can access NVRAM and detect the board */ | ||
250 | bcm47xx_board_detect(); | 217 | bcm47xx_board_detect(); |
251 | mips_set_machine_name(bcm47xx_board_get_name()); | 218 | mips_set_machine_name(bcm47xx_board_get_name()); |
252 | } | 219 | } |