aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bcma/driver_mips.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/bcma/driver_mips.c')
-rw-r--r--drivers/bcma/driver_mips.c48
1 files changed, 31 insertions, 17 deletions
diff --git a/drivers/bcma/driver_mips.c b/drivers/bcma/driver_mips.c
index cc65b45b4368..170822ea51c7 100644
--- a/drivers/bcma/driver_mips.c
+++ b/drivers/bcma/driver_mips.c
@@ -181,47 +181,66 @@ EXPORT_SYMBOL(bcma_cpu_clock);
181static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore) 181static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore)
182{ 182{
183 struct bcma_bus *bus = mcore->core->bus; 183 struct bcma_bus *bus = mcore->core->bus;
184 struct bcma_drv_cc *cc = &bus->drv_cc;
184 185
185 switch (bus->drv_cc.capabilities & BCMA_CC_CAP_FLASHT) { 186 switch (cc->capabilities & BCMA_CC_CAP_FLASHT) {
186 case BCMA_CC_FLASHT_STSER: 187 case BCMA_CC_FLASHT_STSER:
187 case BCMA_CC_FLASHT_ATSER: 188 case BCMA_CC_FLASHT_ATSER:
188 bcma_debug(bus, "Found serial flash\n"); 189 bcma_debug(bus, "Found serial flash\n");
189 bcma_sflash_init(&bus->drv_cc); 190 bcma_sflash_init(cc);
190 break; 191 break;
191 case BCMA_CC_FLASHT_PARA: 192 case BCMA_CC_FLASHT_PARA:
192 bcma_debug(bus, "Found parallel flash\n"); 193 bcma_debug(bus, "Found parallel flash\n");
193 bus->drv_cc.pflash.window = 0x1c000000; 194 cc->pflash.present = true;
194 bus->drv_cc.pflash.window_size = 0x02000000; 195 cc->pflash.window = BCMA_SOC_FLASH2;
196 cc->pflash.window_size = BCMA_SOC_FLASH2_SZ;
195 197
196 if ((bcma_read32(bus->drv_cc.core, BCMA_CC_FLASH_CFG) & 198 if ((bcma_read32(cc->core, BCMA_CC_FLASH_CFG) &
197 BCMA_CC_FLASH_CFG_DS) == 0) 199 BCMA_CC_FLASH_CFG_DS) == 0)
198 bus->drv_cc.pflash.buswidth = 1; 200 cc->pflash.buswidth = 1;
199 else 201 else
200 bus->drv_cc.pflash.buswidth = 2; 202 cc->pflash.buswidth = 2;
201 break; 203 break;
202 default: 204 default:
203 bcma_err(bus, "Flash type not supported\n"); 205 bcma_err(bus, "Flash type not supported\n");
204 } 206 }
205 207
206 if (bus->drv_cc.core->id.rev == 38 || 208 if (cc->core->id.rev == 38 ||
207 bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) { 209 bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) {
208 if (bus->drv_cc.capabilities & BCMA_CC_CAP_NFLASH) { 210 if (cc->capabilities & BCMA_CC_CAP_NFLASH) {
209 bcma_debug(bus, "Found NAND flash\n"); 211 bcma_debug(bus, "Found NAND flash\n");
210 bcma_nflash_init(&bus->drv_cc); 212 bcma_nflash_init(cc);
211 } 213 }
212 } 214 }
213} 215}
214 216
217void bcma_core_mips_early_init(struct bcma_drv_mips *mcore)
218{
219 struct bcma_bus *bus = mcore->core->bus;
220
221 if (mcore->early_setup_done)
222 return;
223
224 bcma_chipco_serial_init(&bus->drv_cc);
225 bcma_core_mips_flash_detect(mcore);
226
227 mcore->early_setup_done = true;
228}
229
215void bcma_core_mips_init(struct bcma_drv_mips *mcore) 230void bcma_core_mips_init(struct bcma_drv_mips *mcore)
216{ 231{
217 struct bcma_bus *bus; 232 struct bcma_bus *bus;
218 struct bcma_device *core; 233 struct bcma_device *core;
219 bus = mcore->core->bus; 234 bus = mcore->core->bus;
220 235
236 if (mcore->setup_done)
237 return;
238
221 bcma_info(bus, "Initializing MIPS core...\n"); 239 bcma_info(bus, "Initializing MIPS core...\n");
222 240
223 if (!mcore->setup_done) 241 bcma_core_mips_early_init(mcore);
224 mcore->assigned_irqs = 1; 242
243 mcore->assigned_irqs = 1;
225 244
226 /* Assign IRQs to all cores on the bus */ 245 /* Assign IRQs to all cores on the bus */
227 list_for_each_entry(core, &bus->cores, list) { 246 list_for_each_entry(core, &bus->cores, list) {
@@ -256,10 +275,5 @@ void bcma_core_mips_init(struct bcma_drv_mips *mcore)
256 bcma_info(bus, "IRQ reconfiguration done\n"); 275 bcma_info(bus, "IRQ reconfiguration done\n");
257 bcma_core_mips_dump_irq(bus); 276 bcma_core_mips_dump_irq(bus);
258 277
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; 278 mcore->setup_done = true;
265} 279}