MIPS: BCM47XX: Initialize bcma bus later (with mm available)
Subsystems (2)
Rafał Miłecki
maintainerRFC PATCH 1/1 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.
---
Hi Ralf,
As recently described in the e-mail thread "Booting bcm47xx (bcma & stuff), sharing code with bcm53xx" I plan to simplify bcma code for SoC booting.
This is one of my patches. As most of them touch "bcma" driver code, I wanted to push them through John's wireless-next tree. Of course this patch is not wireless related at all, so I'd need your Ack for it.
Could you review it and let me know if it looks OK for you? Is that acceptable for you to push this one patch using wireless-next git tree?
This patch already depends on two that were submitted to John:
[PATCH 1/2] bcma: move bus struct setup into early part of host specific code [PATCH 2/2] bcma: use separated function to initialize bus on SoC
Hauke: could you review it as well, please?
--- arch/mips/bcm47xx/bcm47xx_private.h | 3 +++ arch/mips/bcm47xx/irq.c | 8 ++++++++ arch/mips/bcm47xx/setup.c | 33 +++++++++++++++++++++++++++------ 3 files changed, 38 insertions(+), 6 deletions(-)
arch/mips/bcm47xx/bcm47xx_private.h +3 -0
@@ -12,6 +12,9 @@ int __init bcm47xx_buttons_register(void);/* leds.c */ void __init bcm47xx_leds_register (void ); +/* setup.c */ +void __init bcm47xx_bus_setup (void ); +/* workarounds.c */ void __init bcm47xx_workarounds (void );
arch/mips/bcm47xx/irq.c +8 -0
@@ -22,6 +22,8 @@* 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "bcm47xx_private.h" +#include <linux/types.h> #include <linux/interrupt.h> #include <linux/irq.h>
@@ -65,6 +67,12 @@ DEFINE_HWx_IRQDISPATCH(7)void __init arch_init_irq (void ) { +/* +* This is the first arch callback after mm_init (we can use kmalloc), +* so let's finish bus initialization now. +*/ +bcm47xx_bus_setup (); +#ifdef CONFIG_BCM47XX_BCMA if (bcm47xx_bus_type ==BCM47XX_BUS_TYPE_BCMA ) { bcma_write32(bcm47xx_bus.bcma.bus.drv_mips.core,
arch/mips/bcm47xx/setup.c +27 -6
@@ -217,15 +217,14 @@ static void __init bcm47xx_register_bcma(void) err =bcma_host_soc_register (&bcm47xx_bus.bcma);if (err) panic("Failed to register BCMA bus (err %d)", err); - - err =bcma_host_soc_init (&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 +/* +* Memory setup is done in the early part of MIPS's arch_mem_init. It's supposed +* to detect memory and record it with add_memory_region. +* Any extra initializaion performed here must not use kmalloc or bootmem. +*/ void __init plat_mem_setup (void ) {struct cpuinfo_mips *c = ¤t_cpu_data;
@@ -252,6 +251,28 @@ void __init plat_mem_setup(void) _machine_restart = bcm47xx_machine_restart; _machine_halt = bcm47xx_machine_halt; pm_power_off = bcm47xx_machine_halt; +} + +/* +* This finishes bus initialization doing things that were not possible without +* kmalloc. Make sure to call it late enough (after mm_init). +*/ +void __init bcm47xx_bus_setup (void ) +{ +#ifdef CONFIG_BCM47XX_BCMA +if (bcm47xx_bus_type ==BCM47XX_BUS_TYPE_BCMA ) { +int err; + + err =bcma_host_soc_init (&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 + +/* With bus initialized we can access NVRAM and detect the board */ bcm47xx_board_detect ();mips_set_machine_name (bcm47xx_board_get_name ()); }
Signature · 1 line
1.8.4.5
Quoted 4 lines · Rafał Miłecki
Initializaion with memory allocator available will be much simpler, this will allow cleanup in the bcma code.
Signed-off-by Rafał Miłecki <[email protected]>
Quoted 25 lines
---
Hi Ralf,As recently described in the e-mail thread "Booting bcm47xx (bcma & stuff), sharing code with bcm53xx" I plan to simplify bcma code for SoC booting.
This is one of my patches. As most of them touch "bcma" driver code, I wanted to push them through John's wireless-next tree. Of course this patch is not wireless related at all, so I'd need your Ack for it.
Could you review it and let me know if it looks OK for you? Is that acceptable for you to push this one patch using wireless-next git tree?
This patch already depends on two that were submitted to John:
[PATCH 1/2] bcma: move bus struct setup into early part of host specific code [PATCH 2/2] bcma: use separated function to initialize bus on SoCHauke: could you review it as well, please?
--- arch/mips/bcm47xx/bcm47xx_private.h | 3 +++ arch/mips/bcm47xx/irq.c | 8 ++++++++ arch/mips/bcm47xx/setup.c | 33 +++++++++++++++++++++++++++------ 3 files changed, 38 insertions(+), 6 deletions(-)