Commit 49655bb8a51565f0375a4f783334c9de78134be5

Authored by Hauke Mehrtens
Committed by John W. Linville
1 parent b0a949b42b

bcma: just do the necessary things in early register on SoCs

Some parts of the initialization for chip common and the pcie core are
accessing the sprom struct, but it is not initialized at that stage.
Just do the necessary thing in the early register on SoCs and not the
complete initialization to read out the nvram from the flash chip.
After it is possible to read out the nvram, the sprom should be parsed
from it and the full initialization of the cores should be run.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Showing 6 changed files with 51 additions and 17 deletions Side-by-side Diff

drivers/bcma/driver_chipcommon.c
... ... @@ -22,12 +22,9 @@
22 22 return value;
23 23 }
24 24  
25   -void bcma_core_chipcommon_init(struct bcma_drv_cc *cc)
  25 +void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc)
26 26 {
27   - u32 leddc_on = 10;
28   - u32 leddc_off = 90;
29   -
30   - if (cc->setup_done)
  27 + if (cc->early_setup_done)
31 28 return;
32 29  
33 30 if (cc->core->id.rev >= 11)
... ... @@ -35,6 +32,22 @@
35 32 cc->capabilities = bcma_cc_read32(cc, BCMA_CC_CAP);
36 33 if (cc->core->id.rev >= 35)
37 34 cc->capabilities_ext = bcma_cc_read32(cc, BCMA_CC_CAP_EXT);
  35 +
  36 + if (cc->capabilities & BCMA_CC_CAP_PMU)
  37 + bcma_pmu_early_init(cc);
  38 +
  39 + cc->early_setup_done = true;
  40 +}
  41 +
  42 +void 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);
38 51  
39 52 if (cc->core->id.rev >= 20) {
40 53 bcma_cc_write32(cc, BCMA_CC_GPIOPULLUP, 0);
drivers/bcma/driver_chipcommon_pmu.c
... ... @@ -144,7 +144,7 @@
144 144 }
145 145 }
146 146  
147   -void bcma_pmu_init(struct bcma_drv_cc *cc)
  147 +void bcma_pmu_early_init(struct bcma_drv_cc *cc)
148 148 {
149 149 u32 pmucap;
150 150  
151 151  
... ... @@ -153,7 +153,10 @@
153 153  
154 154 bcma_debug(cc->core->bus, "Found rev %u PMU (capabilities 0x%08X)\n",
155 155 cc->pmu.rev, pmucap);
  156 +}
156 157  
  158 +void bcma_pmu_init(struct bcma_drv_cc *cc)
  159 +{
157 160 if (cc->pmu.rev == 1)
158 161 bcma_cc_mask32(cc, BCMA_CC_PMU_CTL,
159 162 ~BCMA_CC_PMU_CTL_NOILPONW);
drivers/bcma/driver_mips.c
... ... @@ -212,17 +212,34 @@
212 212 }
213 213 }
214 214  
  215 +void 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 +
215 228 void bcma_core_mips_init(struct bcma_drv_mips *mcore)
216 229 {
217 230 struct bcma_bus *bus;
218 231 struct bcma_device *core;
219 232 bus = mcore->core->bus;
220 233  
  234 + if (mcore->setup_done)
  235 + return;
  236 +
221 237 bcma_info(bus, "Initializing MIPS core...\n");
222 238  
223   - if (!mcore->setup_done)
224   - mcore->assigned_irqs = 1;
  239 + bcma_core_mips_early_init(mcore);
225 240  
  241 + mcore->assigned_irqs = 1;
  242 +
226 243 /* Assign IRQs to all cores on the bus */
227 244 list_for_each_entry(core, &bus->cores, list) {
228 245 int mips_irq;
... ... @@ -256,11 +273,6 @@
256 273 bcma_info(bus, "IRQ reconfiguration done\n");
257 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 276 mcore->setup_done = true;
265 277 }
... ... @@ -274,18 +274,18 @@
274 274 return -1;
275 275 }
276 276  
277   - /* Init CC core */
  277 + /* Early init CC core */
278 278 core = bcma_find_core(bus, bcma_cc_core_id(bus));
279 279 if (core) {
280 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 285 core = bcma_find_core(bus, BCMA_CORE_MIPS_74K);
286 286 if (core) {
287 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 291 bcma_info(bus, "Early bus registered\n");
include/linux/bcma/bcma_driver_chipcommon.h
... ... @@ -552,6 +552,7 @@
552 552 u32 capabilities;
553 553 u32 capabilities_ext;
554 554 u8 setup_done:1;
  555 + u8 early_setup_done:1;
555 556 /* Fast Powerup Delay constant */
556 557 u16 fast_pwrup_delay;
557 558 struct bcma_chipcommon_pmu pmu;
... ... @@ -583,6 +584,7 @@
583 584 bcma_cc_write32(cc, offset, (bcma_cc_read32(cc, offset) & (mask)) | (set))
584 585  
585 586 extern void bcma_core_chipcommon_init(struct bcma_drv_cc *cc);
  587 +extern void bcma_core_chipcommon_early_init(struct bcma_drv_cc *cc);
586 588  
587 589 extern void bcma_chipco_suspend(struct bcma_drv_cc *cc);
588 590 extern void bcma_chipco_resume(struct bcma_drv_cc *cc);
... ... @@ -606,6 +608,7 @@
606 608  
607 609 /* PMU support */
608 610 extern void bcma_pmu_init(struct bcma_drv_cc *cc);
  611 +extern void bcma_pmu_early_init(struct bcma_drv_cc *cc);
609 612  
610 613 extern void bcma_chipco_pll_write(struct bcma_drv_cc *cc, u32 offset,
611 614 u32 value);
include/linux/bcma/bcma_driver_mips.h
... ... @@ -35,13 +35,16 @@
35 35 struct bcma_drv_mips {
36 36 struct bcma_device *core;
37 37 u8 setup_done:1;
  38 + u8 early_setup_done:1;
38 39 unsigned int assigned_irqs;
39 40 };
40 41  
41 42 #ifdef CONFIG_BCMA_DRIVER_MIPS
42 43 extern void bcma_core_mips_init(struct bcma_drv_mips *mcore);
  44 +extern void bcma_core_mips_early_init(struct bcma_drv_mips *mcore);
43 45 #else
44 46 static inline void bcma_core_mips_init(struct bcma_drv_mips *mcore) { }
  47 +static inline void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) { }
45 48 #endif
46 49  
47 50 extern u32 bcma_cpu_clock(struct bcma_drv_mips *mcore);