aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2014-10-28 09:40:38 -0400
committerRalf Baechle <ralf@linux-mips.org>2014-11-24 01:45:00 -0500
commite5810fa0c1bed16fdfb408862a2e17e962ec5cf6 (patch)
tree424fd47ac92e2696afe287a29dfc14f4fc5f399d /arch/mips
parenta59da8fb3b2a1f2df5f871464e43cd5b6ca6ceb1 (diff)
MIPS: BCM47XX: Initialize bcma bus later (with mm available)
Initializaion with memory allocator available will be much simpler, this will allow cleanup in the bcma code. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Acked-by: Hauke Mehrtens <hauke@hauke-m.de> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/8234/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/bcm47xx/bcm47xx_private.h3
-rw-r--r--arch/mips/bcm47xx/irq.c8
-rw-r--r--arch/mips/bcm47xx/setup.c33
3 files changed, 38 insertions, 6 deletions
diff --git a/arch/mips/bcm47xx/bcm47xx_private.h b/arch/mips/bcm47xx/bcm47xx_private.h
index 12a112dd0ae0..ea909a56a3ee 100644
--- a/arch/mips/bcm47xx/bcm47xx_private.h
+++ b/arch/mips/bcm47xx/bcm47xx_private.h
@@ -15,6 +15,9 @@ int __init bcm47xx_buttons_register(void);
15/* leds.c */ 15/* leds.c */
16void __init bcm47xx_leds_register(void); 16void __init bcm47xx_leds_register(void);
17 17
18/* setup.c */
19void __init bcm47xx_bus_setup(void);
20
18/* workarounds.c */ 21/* workarounds.c */
19void __init bcm47xx_workarounds(void); 22void __init bcm47xx_workarounds(void);
20 23
diff --git a/arch/mips/bcm47xx/irq.c b/arch/mips/bcm47xx/irq.c
index e0585b76ec19..21b4497f09be 100644
--- a/arch/mips/bcm47xx/irq.c
+++ b/arch/mips/bcm47xx/irq.c
@@ -22,6 +22,8 @@
22 * 675 Mass Ave, Cambridge, MA 02139, USA. 22 * 675 Mass Ave, Cambridge, MA 02139, USA.
23 */ 23 */
24 24
25#include "bcm47xx_private.h"
26
25#include <linux/types.h> 27#include <linux/types.h>
26#include <linux/interrupt.h> 28#include <linux/interrupt.h>
27#include <linux/irq.h> 29#include <linux/irq.h>
@@ -65,6 +67,12 @@ DEFINE_HWx_IRQDISPATCH(7)
65 67
66void __init arch_init_irq(void) 68void __init arch_init_irq(void)
67{ 69{
70 /*
71 * This is the first arch callback after mm_init (we can use kmalloc),
72 * so let's finish bus initialization now.
73 */
74 bcm47xx_bus_setup();
75
68#ifdef CONFIG_BCM47XX_BCMA 76#ifdef CONFIG_BCM47XX_BCMA
69 if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_BCMA) { 77 if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_BCMA) {
70 bcma_write32(bcm47xx_bus.bcma.bus.drv_mips.core, 78 bcma_write32(bcm47xx_bus.bcma.bus.drv_mips.core,
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
index 444c65a09970..e43b5046cb30 100644
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -156,15 +156,14 @@ static void __init bcm47xx_register_bcma(void)
156 err = bcma_host_soc_register(&bcm47xx_bus.bcma); 156 err = bcma_host_soc_register(&bcm47xx_bus.bcma);
157 if (err) 157 if (err)
158 panic("Failed to register BCMA bus (err %d)", err); 158 panic("Failed to register BCMA bus (err %d)", err);
159
160 err = bcma_host_soc_init(&bcm47xx_bus.bcma);
161 if (err)
162 panic("Failed to initialize BCMA bus (err %d)", err);
163
164 bcm47xx_fill_bcma_boardinfo(&bcm47xx_bus.bcma.bus.boardinfo, NULL);
165} 159}
166#endif 160#endif
167 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 */
168void __init plat_mem_setup(void) 167void __init plat_mem_setup(void)
169{ 168{
170 struct cpuinfo_mips *c = &current_cpu_data; 169 struct cpuinfo_mips *c = &current_cpu_data;
@@ -193,6 +192,28 @@ void __init plat_mem_setup(void)
193 _machine_restart = bcm47xx_machine_restart; 192 _machine_restart = bcm47xx_machine_restart;
194 _machine_halt = bcm47xx_machine_halt; 193 _machine_halt = bcm47xx_machine_halt;
195 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 */
201void __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 */
196 bcm47xx_board_detect(); 217 bcm47xx_board_detect();
197 mips_set_machine_name(bcm47xx_board_get_name()); 218 mips_set_machine_name(bcm47xx_board_get_name());
198} 219}