aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/bcma/driver_chipcommon.c23
-rw-r--r--drivers/bcma/driver_chipcommon_pmu.c5
-rw-r--r--drivers/bcma/driver_mips.c26
-rw-r--r--drivers/bcma/main.c8
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h3
-rw-r--r--include/linux/bcma/bcma_driver_mips.h3
6 files changed, 51 insertions, 17 deletions
diff --git a/drivers/bcma/driver_chipcommon.c b/drivers/bcma/driver_chipcommon.c
index a4c3ebcc4c86..ffd74e51f02d 100644
--- a/drivers/bcma/driver_chipcommon.c
+++ b/drivers/bcma/driver_chipcommon.c
@@ -22,12 +22,9 @@ static inline u32 bcma_cc_write32_masked(struct bcma_drv_cc *cc, u16 offset,
22 return value; 22 return value;
23} 23}
24 24
25void bcma_core_chipcommon_init(struct bcma_drv_cc *cc) 25void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc)
26{ 26{
27 u32 leddc_on = 10; 27 if (cc->early_setup_done)
28 u32 leddc_off = 90;
29
30 if (cc->setup_done)
31 return; 28 return;
32 29
33 if (cc->core->id.rev >= 11) 30 if (cc->core->id.rev >= 11)
@@ -36,6 +33,22 @@ void bcma_core_chipcommon_init(struct bcma_drv_cc *cc)
36 if (cc->core->id.rev >= 35) 33 if (cc->core->id.rev >= 35)
37 cc->capabilities_ext = bcma_cc_read32(cc, BCMA_CC_CAP_EXT); 34 cc->capabilities_ext = bcma_cc_read32(cc, BCMA_CC_CAP_EXT);
38 35
36 if (cc->capabilities & BCMA_CC_CAP_PMU)
37 bcma_pmu_early_init(cc);
38
39 cc->early_setup_done = true;
40}
41
42void bcma_core_chipcommon_init(struct bcma_drv_cc *cc)
43{
44 u32 leddc_on = 10;
45 u32 leddc_off = 90;
46
47 if (cc->setup_done)
48 return;
49
50 bcma_core_chipcommon_early_init(cc);
51
39 if (cc->core->id.rev >= 20) { 52 if (cc->core->id.rev >= 20) {
40 bcma_cc_write32(cc, BCMA_CC_GPIOPULLUP, 0); 53 bcma_cc_write32(cc, BCMA_CC_GPIOPULLUP, 0);
41 bcma_cc_write32(cc, BCMA_CC_GPIOPULLDOWN, 0); 54 bcma_cc_write32(cc, BCMA_CC_GPIOPULLDOWN, 0);
diff --git a/drivers/bcma/driver_chipcommon_pmu.c b/drivers/bcma/driver_chipcommon_pmu.c
index 201faf106b3f..a63ddd9c70eb 100644
--- a/drivers/bcma/driver_chipcommon_pmu.c
+++ b/drivers/bcma/driver_chipcommon_pmu.c
@@ -144,7 +144,7 @@ static void bcma_pmu_workarounds(struct bcma_drv_cc *cc)
144 } 144 }
145} 145}
146 146
147void bcma_pmu_init(struct bcma_drv_cc *cc) 147void bcma_pmu_early_init(struct bcma_drv_cc *cc)
148{ 148{
149 u32 pmucap; 149 u32 pmucap;
150 150
@@ -153,7 +153,10 @@ void bcma_pmu_init(struct bcma_drv_cc *cc)
153 153
154 bcma_debug(cc->core->bus, "Found rev %u PMU (capabilities 0x%08X)\n", 154 bcma_debug(cc->core->bus, "Found rev %u PMU (capabilities 0x%08X)\n",
155 cc->pmu.rev, pmucap); 155 cc->pmu.rev, pmucap);
156}
156 157
158void bcma_pmu_init(struct bcma_drv_cc *cc)
159{
157 if (cc->pmu.rev == 1) 160 if (cc->pmu.rev == 1)
158 bcma_cc_mask32(cc, BCMA_CC_PMU_CTL, 161 bcma_cc_mask32(cc, BCMA_CC_PMU_CTL,
159 ~BCMA_CC_PMU_CTL_NOILPONW); 162 ~BCMA_CC_PMU_CTL_NOILPONW);
diff --git a/drivers/bcma/driver_mips.c b/drivers/bcma/driver_mips.c
index cc65b45b4368..f44f1fb67011 100644
--- a/drivers/bcma/driver_mips.c
+++ b/drivers/bcma/driver_mips.c
@@ -212,16 +212,33 @@ static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore)
212 } 212 }
213} 213}
214 214
215void bcma_core_mips_early_init(struct bcma_drv_mips *mcore)
216{
217 struct bcma_bus *bus = mcore->core->bus;
218
219 if (mcore->early_setup_done)
220 return;
221
222 bcma_chipco_serial_init(&bus->drv_cc);
223 bcma_core_mips_flash_detect(mcore);
224
225 mcore->early_setup_done = true;
226}
227
215void bcma_core_mips_init(struct bcma_drv_mips *mcore) 228void bcma_core_mips_init(struct bcma_drv_mips *mcore)
216{ 229{
217 struct bcma_bus *bus; 230 struct bcma_bus *bus;
218 struct bcma_device *core; 231 struct bcma_device *core;
219 bus = mcore->core->bus; 232 bus = mcore->core->bus;
220 233
234 if (mcore->setup_done)
235 return;
236
221 bcma_info(bus, "Initializing MIPS core...\n"); 237 bcma_info(bus, "Initializing MIPS core...\n");
222 238
223 if (!mcore->setup_done) 239 bcma_core_mips_early_init(mcore);
224 mcore->assigned_irqs = 1; 240
241 mcore->assigned_irqs = 1;
225 242
226 /* Assign IRQs to all cores on the bus */ 243 /* Assign IRQs to all cores on the bus */
227 list_for_each_entry(core, &bus->cores, list) { 244 list_for_each_entry(core, &bus->cores, list) {
@@ -256,10 +273,5 @@ void bcma_core_mips_init(struct bcma_drv_mips *mcore)
256 bcma_info(bus, "IRQ reconfiguration done\n"); 273 bcma_info(bus, "IRQ reconfiguration done\n");
257 bcma_core_mips_dump_irq(bus); 274 bcma_core_mips_dump_irq(bus);
258 275
259 if (mcore->setup_done)
260 return;
261
262 bcma_chipco_serial_init(&bus->drv_cc);
263 bcma_core_mips_flash_detect(mcore);
264 mcore->setup_done = true; 276 mcore->setup_done = true;
265} 277}
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
index 432aeeedfd5e..bea2d7cfa6c2 100644
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -274,18 +274,18 @@ int __init bcma_bus_early_register(struct bcma_bus *bus,
274 return -1; 274 return -1;
275 } 275 }
276 276
277 /* Init CC core */ 277 /* Early init CC core */
278 core = bcma_find_core(bus, bcma_cc_core_id(bus)); 278 core = bcma_find_core(bus, bcma_cc_core_id(bus));
279 if (core) { 279 if (core) {
280 bus->drv_cc.core = core; 280 bus->drv_cc.core = core;
281 bcma_core_chipcommon_init(&bus->drv_cc); 281 bcma_core_chipcommon_early_init(&bus->drv_cc);
282 } 282 }
283 283
284 /* Init MIPS core */ 284 /* Early init MIPS core */
285 core = bcma_find_core(bus, BCMA_CORE_MIPS_74K); 285 core = bcma_find_core(bus, BCMA_CORE_MIPS_74K);
286 if (core) { 286 if (core) {
287 bus->drv_mips.core = core; 287 bus->drv_mips.core = core;
288 bcma_core_mips_init(&bus->drv_mips); 288 bcma_core_mips_early_init(&bus->drv_mips);
289 } 289 }
290 290
291 bcma_info(bus, "Early bus registered\n"); 291 bcma_info(bus, "Early bus registered\n");
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index 1cf1749440ac..fbde7cbd2d7d 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -552,6 +552,7 @@ struct bcma_drv_cc {
552 u32 capabilities; 552 u32 capabilities;
553 u32 capabilities_ext; 553 u32 capabilities_ext;
554 u8 setup_done:1; 554 u8 setup_done:1;
555 u8 early_setup_done:1;
555 /* Fast Powerup Delay constant */ 556 /* Fast Powerup Delay constant */
556 u16 fast_pwrup_delay; 557 u16 fast_pwrup_delay;
557 struct bcma_chipcommon_pmu pmu; 558 struct bcma_chipcommon_pmu pmu;
@@ -583,6 +584,7 @@ struct bcma_drv_cc {
583 bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set)) 584 bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set))
584 585
585extern void bcma_core_chipcommon_init(struct bcma_drv_cc *cc); 586extern void bcma_core_chipcommon_init(struct bcma_drv_cc *cc);
587extern void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc);
586 588
587extern void bcma_chipco_suspend(struct bcma_drv_cc *cc); 589extern void bcma_chipco_suspend(struct bcma_drv_cc *cc);
588extern void bcma_chipco_resume(struct bcma_drv_cc *cc); 590extern void bcma_chipco_resume(struct bcma_drv_cc *cc);
@@ -606,6 +608,7 @@ u32 bcma_chipco_gpio_polarity(struct bcma_drv_cc *cc, u32 mask, u32 value);
606 608
607/* PMU support */ 609/* PMU support */
608extern void bcma_pmu_init(struct bcma_drv_cc *cc); 610extern void bcma_pmu_init(struct bcma_drv_cc *cc);
611extern void bcma_pmu_early_init(struct bcma_drv_cc *cc);
609 612
610extern void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset, 613extern void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset,
611 u32 value); 614 u32 value);
diff --git a/include/linux/bcma/bcma_driver_mips.h b/include/linux/bcma/bcma_driver_mips.h
index c0043645cdcb..0baf8a56b794 100644
--- a/include/linux/bcma/bcma_driver_mips.h
+++ b/include/linux/bcma/bcma_driver_mips.h
@@ -35,13 +35,16 @@ struct bcma_device;
35struct bcma_drv_mips { 35struct bcma_drv_mips {
36 struct bcma_device *core; 36 struct bcma_device *core;
37 u8 setup_done:1; 37 u8 setup_done:1;
38 u8 early_setup_done:1;
38 unsigned int assigned_irqs; 39 unsigned int assigned_irqs;
39}; 40};
40 41
41#ifdef CONFIG_BCMA_DRIVER_MIPS 42#ifdef CONFIG_BCMA_DRIVER_MIPS
42extern void bcma_core_mips_init(struct bcma_drv_mips *mcore); 43extern void bcma_core_mips_init(struct bcma_drv_mips *mcore);
44extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
43#else 45#else
44static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { } 46static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { }
47static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { }
45#endif 48#endif
46 49
47extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore); 50extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore);