diff options
-rw-r--r-- | drivers/bcma/driver_mips.c | 62 | ||||
-rw-r--r-- | include/linux/bcma/bcma_regs.h | 5 |
2 files changed, 67 insertions, 0 deletions
diff --git a/drivers/bcma/driver_mips.c b/drivers/bcma/driver_mips.c index 11115bbe115c..004d6aa671ce 100644 --- a/drivers/bcma/driver_mips.c +++ b/drivers/bcma/driver_mips.c | |||
@@ -21,6 +21,14 @@ | |||
21 | #include <linux/serial_reg.h> | 21 | #include <linux/serial_reg.h> |
22 | #include <linux/time.h> | 22 | #include <linux/time.h> |
23 | 23 | ||
24 | enum bcma_boot_dev { | ||
25 | BCMA_BOOT_DEV_UNK = 0, | ||
26 | BCMA_BOOT_DEV_ROM, | ||
27 | BCMA_BOOT_DEV_PARALLEL, | ||
28 | BCMA_BOOT_DEV_SERIAL, | ||
29 | BCMA_BOOT_DEV_NAND, | ||
30 | }; | ||
31 | |||
24 | static const char * const part_probes[] = { "bcm47xxpart", NULL }; | 32 | static const char * const part_probes[] = { "bcm47xxpart", NULL }; |
25 | 33 | ||
26 | static struct physmap_flash_data bcma_pflash_data = { | 34 | static struct physmap_flash_data bcma_pflash_data = { |
@@ -229,11 +237,51 @@ u32 bcma_cpu_clock(struct bcma_drv_mips *mcore) | |||
229 | } | 237 | } |
230 | EXPORT_SYMBOL(bcma_cpu_clock); | 238 | EXPORT_SYMBOL(bcma_cpu_clock); |
231 | 239 | ||
240 | static enum bcma_boot_dev bcma_boot_dev(struct bcma_bus *bus) | ||
241 | { | ||
242 | struct bcma_drv_cc *cc = &bus->drv_cc; | ||
243 | u8 cc_rev = cc->core->id.rev; | ||
244 | |||
245 | if (cc_rev == 42) { | ||
246 | struct bcma_device *core; | ||
247 | |||
248 | core = bcma_find_core(bus, BCMA_CORE_NS_ROM); | ||
249 | if (core) { | ||
250 | switch (bcma_aread32(core, BCMA_IOST) & | ||
251 | BCMA_NS_ROM_IOST_BOOT_DEV_MASK) { | ||
252 | case BCMA_NS_ROM_IOST_BOOT_DEV_NOR: | ||
253 | return BCMA_BOOT_DEV_SERIAL; | ||
254 | case BCMA_NS_ROM_IOST_BOOT_DEV_NAND: | ||
255 | return BCMA_BOOT_DEV_NAND; | ||
256 | case BCMA_NS_ROM_IOST_BOOT_DEV_ROM: | ||
257 | default: | ||
258 | return BCMA_BOOT_DEV_ROM; | ||
259 | } | ||
260 | } | ||
261 | } else { | ||
262 | if (cc_rev == 38) { | ||
263 | if (cc->status & BCMA_CC_CHIPST_5357_NAND_BOOT) | ||
264 | return BCMA_BOOT_DEV_NAND; | ||
265 | else if (cc->status & BIT(5)) | ||
266 | return BCMA_BOOT_DEV_ROM; | ||
267 | } | ||
268 | |||
269 | if ((cc->capabilities & BCMA_CC_CAP_FLASHT) == | ||
270 | BCMA_CC_FLASHT_PARA) | ||
271 | return BCMA_BOOT_DEV_PARALLEL; | ||
272 | else | ||
273 | return BCMA_BOOT_DEV_SERIAL; | ||
274 | } | ||
275 | |||
276 | return BCMA_BOOT_DEV_SERIAL; | ||
277 | } | ||
278 | |||
232 | static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore) | 279 | static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore) |
233 | { | 280 | { |
234 | struct bcma_bus *bus = mcore->core->bus; | 281 | struct bcma_bus *bus = mcore->core->bus; |
235 | struct bcma_drv_cc *cc = &bus->drv_cc; | 282 | struct bcma_drv_cc *cc = &bus->drv_cc; |
236 | struct bcma_pflash *pflash = &cc->pflash; | 283 | struct bcma_pflash *pflash = &cc->pflash; |
284 | enum bcma_boot_dev boot_dev; | ||
237 | 285 | ||
238 | switch (cc->capabilities & BCMA_CC_CAP_FLASHT) { | 286 | switch (cc->capabilities & BCMA_CC_CAP_FLASHT) { |
239 | case BCMA_CC_FLASHT_STSER: | 287 | case BCMA_CC_FLASHT_STSER: |
@@ -269,6 +317,20 @@ static void bcma_core_mips_flash_detect(struct bcma_drv_mips *mcore) | |||
269 | bcma_nflash_init(cc); | 317 | bcma_nflash_init(cc); |
270 | } | 318 | } |
271 | } | 319 | } |
320 | |||
321 | /* Determine flash type this SoC boots from */ | ||
322 | boot_dev = bcma_boot_dev(bus); | ||
323 | switch (boot_dev) { | ||
324 | case BCMA_BOOT_DEV_PARALLEL: | ||
325 | case BCMA_BOOT_DEV_SERIAL: | ||
326 | /* TODO: Init NVRAM using BCMA_SOC_FLASH2 window */ | ||
327 | break; | ||
328 | case BCMA_BOOT_DEV_NAND: | ||
329 | /* TODO: Init NVRAM using BCMA_SOC_FLASH1 window */ | ||
330 | break; | ||
331 | default: | ||
332 | break; | ||
333 | } | ||
272 | } | 334 | } |
273 | 335 | ||
274 | void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) | 336 | void bcma_core_mips_early_init(struct bcma_drv_mips *mcore) |
diff --git a/include/linux/bcma/bcma_regs.h b/include/linux/bcma/bcma_regs.h index 917dcd7965e7..e64ae7bf80a1 100644 --- a/include/linux/bcma/bcma_regs.h +++ b/include/linux/bcma/bcma_regs.h | |||
@@ -39,6 +39,11 @@ | |||
39 | #define BCMA_RESET_CTL_RESET 0x0001 | 39 | #define BCMA_RESET_CTL_RESET 0x0001 |
40 | #define BCMA_RESET_ST 0x0804 | 40 | #define BCMA_RESET_ST 0x0804 |
41 | 41 | ||
42 | #define BCMA_NS_ROM_IOST_BOOT_DEV_MASK 0x0003 | ||
43 | #define BCMA_NS_ROM_IOST_BOOT_DEV_NOR 0x0000 | ||
44 | #define BCMA_NS_ROM_IOST_BOOT_DEV_NAND 0x0001 | ||
45 | #define BCMA_NS_ROM_IOST_BOOT_DEV_ROM 0x0002 | ||
46 | |||
42 | /* BCMA PCI config space registers. */ | 47 | /* BCMA PCI config space registers. */ |
43 | #define BCMA_PCI_PMCSR 0x44 | 48 | #define BCMA_PCI_PMCSR 0x44 |
44 | #define BCMA_PCI_PE 0x100 | 49 | #define BCMA_PCI_PE 0x100 |