1 --- a/drivers/bcma/driver_chipcommon.c
2 +++ b/drivers/bcma/driver_chipcommon.c
3 @@ -22,12 +22,9 @@ static inline u32 bcma_cc_write32_masked
7 -void bcma_core_chipcommon_init(struct bcma_drv_cc *cc)
8 +void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc)
14 + if (cc->early_setup_done)
17 if (cc->core->id.rev >= 11)
18 @@ -36,6 +33,22 @@ void bcma_core_chipcommon_init(struct bc
19 if (cc->core->id.rev >= 35)
20 cc->capabilities_ext = bcma_cc_read32(cc, BCMA_CC_CAP_EXT);
22 + if (cc->capabilities & BCMA_CC_CAP_PMU)
23 + bcma_pmu_early_init(cc);
25 + cc->early_setup_done = true;
28 +void bcma_core_chipcommon_init(struct bcma_drv_cc *cc)
36 + bcma_core_chipcommon_early_init(cc);
38 if (cc->core->id.rev >= 20) {
39 bcma_cc_write32(cc, BCMA_CC_GPIOPULLUP, 0);
40 bcma_cc_write32(cc, BCMA_CC_GPIOPULLDOWN, 0);
41 --- a/drivers/bcma/driver_chipcommon_pmu.c
42 +++ b/drivers/bcma/driver_chipcommon_pmu.c
43 @@ -141,7 +141,7 @@ void bcma_pmu_workarounds(struct bcma_dr
47 -void bcma_pmu_init(struct bcma_drv_cc *cc)
48 +void bcma_pmu_early_init(struct bcma_drv_cc *cc)
52 @@ -150,7 +150,10 @@ void bcma_pmu_init(struct bcma_drv_cc *c
54 bcma_debug(cc->core->bus, "Found rev %u PMU (capabilities 0x%08X)\n",
58 +void bcma_pmu_init(struct bcma_drv_cc *cc)
61 bcma_cc_mask32(cc, BCMA_CC_PMU_CTL,
62 ~BCMA_CC_PMU_CTL_NOILPONW);
63 --- a/drivers/bcma/driver_mips.c
64 +++ b/drivers/bcma/driver_mips.c
65 @@ -222,16 +222,33 @@ static void bcma_core_mips_flash_detect(
69 +void bcma_core_mips_early_init(struct bcma_drv_mips *mcore)
71 + struct bcma_bus *bus = mcore->core->bus;
73 + if (mcore->early_setup_done)
76 + bcma_chipco_serial_init(&bus->drv_cc);
77 + bcma_core_mips_flash_detect(mcore);
79 + mcore->early_setup_done = true;
82 void bcma_core_mips_init(struct bcma_drv_mips *mcore)
85 struct bcma_device *core;
86 bus = mcore->core->bus;
88 + if (mcore->setup_done)
91 bcma_info(bus, "Initializing MIPS core...\n");
93 - if (!mcore->setup_done)
94 - mcore->assigned_irqs = 1;
95 + bcma_core_mips_early_init(mcore);
97 + mcore->assigned_irqs = 1;
99 /* Assign IRQs to all cores on the bus */
100 list_for_each_entry(core, &bus->cores, list) {
101 @@ -266,10 +283,5 @@ void bcma_core_mips_init(struct bcma_drv
102 bcma_info(bus, "IRQ reconfiguration done\n");
103 bcma_core_mips_dump_irq(bus);
105 - if (mcore->setup_done)
108 - bcma_chipco_serial_init(&bus->drv_cc);
109 - bcma_core_mips_flash_detect(mcore);
110 mcore->setup_done = true;
112 --- a/drivers/bcma/main.c
113 +++ b/drivers/bcma/main.c
114 @@ -247,18 +247,18 @@ int __init bcma_bus_early_register(struc
119 + /* Early init CC core */
120 core = bcma_find_core(bus, bcma_cc_core_id(bus));
122 bus->drv_cc.core = core;
123 - bcma_core_chipcommon_init(&bus->drv_cc);
124 + bcma_core_chipcommon_early_init(&bus->drv_cc);
127 - /* Init MIPS core */
128 + /* Early init MIPS core */
129 core = bcma_find_core(bus, BCMA_CORE_MIPS_74K);
131 bus->drv_mips.core = core;
132 - bcma_core_mips_init(&bus->drv_mips);
133 + bcma_core_mips_early_init(&bus->drv_mips);
136 bcma_info(bus, "Early bus registered\n");
137 --- a/include/linux/bcma/bcma_driver_chipcommon.h
138 +++ b/include/linux/bcma/bcma_driver_chipcommon.h
139 @@ -476,6 +476,7 @@ struct bcma_drv_cc {
141 u32 capabilities_ext;
143 + u8 early_setup_done:1;
144 /* Fast Powerup Delay constant */
145 u16 fast_pwrup_delay;
146 struct bcma_chipcommon_pmu pmu;
147 @@ -510,6 +511,7 @@ struct bcma_drv_cc {
148 bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set))
150 extern void bcma_core_chipcommon_init(struct bcma_drv_cc *cc);
151 +extern void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc);
153 extern void bcma_chipco_suspend(struct bcma_drv_cc *cc);
154 extern void bcma_chipco_resume(struct bcma_drv_cc *cc);
155 @@ -533,6 +535,7 @@ u32 bcma_chipco_gpio_polarity(struct bcm
158 extern void bcma_pmu_init(struct bcma_drv_cc *cc);
159 +extern void bcma_pmu_early_init(struct bcma_drv_cc *cc);
161 extern void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset,
163 --- a/include/linux/bcma/bcma_driver_mips.h
164 +++ b/include/linux/bcma/bcma_driver_mips.h
165 @@ -35,13 +35,16 @@ struct bcma_device;
166 struct bcma_drv_mips {
167 struct bcma_device *core;
169 + u8 early_setup_done:1;
170 unsigned int assigned_irqs;
173 #ifdef CONFIG_BCMA_DRIVER_MIPS
174 extern void bcma_core_mips_init(struct bcma_drv_mips *mcore);
175 +extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
177 static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { }
178 +static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { }
181 extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore);