aboutsummaryrefslogtreecommitdiff
path: root/drivers/ssb/driver_mipscore.c
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2012-08-08 19:37:04 +0200
committerJohn W. Linville <linville@tuxdriver.com>2012-08-10 15:27:02 -0400
commit902d9e0f48ddc18fb37c1b1edf5e3b27aaba1505 (patch)
treec922aceb9e0ef671da2529eef5e82f51976f02d3 /drivers/ssb/driver_mipscore.c
parent85ce5ae52690aab0b3a4a6e9a1c2f951d2d8a5cc (diff)
ssb: check for flash presentence
We can not assume parallel flash is always present, there are boards with *serial* flash and probably some without flash at all. Define some bits by the way. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Reviewed-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/ssb/driver_mipscore.c')
-rw-r--r--drivers/ssb/driver_mipscore.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/drivers/ssb/driver_mipscore.c b/drivers/ssb/driver_mipscore.c
index 7e2ddc042f5..c6250867a95 100644
--- a/drivers/ssb/driver_mipscore.c
+++ b/drivers/ssb/driver_mipscore.c
@@ -190,16 +190,30 @@ static void ssb_mips_flash_detect(struct ssb_mipscore *mcore)
{
struct ssb_bus *bus = mcore->dev->bus;
- mcore->flash_buswidth = 2;
- if (bus->chipco.dev) {
- mcore->flash_window = 0x1c000000;
- mcore->flash_window_size = 0x02000000;
+ /* When there is no chipcommon on the bus there is 4MB flash */
+ if (!bus->chipco.dev) {
+ mcore->flash_buswidth = 2;
+ mcore->flash_window = SSB_FLASH1;
+ mcore->flash_window_size = SSB_FLASH1_SZ;
+ return;
+ }
+
+ /* There is ChipCommon, so use it to read info about flash */
+ switch (bus->chipco.capabilities & SSB_CHIPCO_CAP_FLASHT) {
+ case SSB_CHIPCO_FLASHT_STSER:
+ case SSB_CHIPCO_FLASHT_ATSER:
+ pr_err("Serial flash not supported\n");
+ break;
+ case SSB_CHIPCO_FLASHT_PARA:
+ pr_debug("Found parallel flash\n");
+ mcore->flash_window = SSB_FLASH2;
+ mcore->flash_window_size = SSB_FLASH2_SZ;
if ((ssb_read32(bus->chipco.dev, SSB_CHIPCO_FLASH_CFG)
& SSB_CHIPCO_CFG_DS16) == 0)
mcore->flash_buswidth = 1;
- } else {
- mcore->flash_window = 0x1fc00000;
- mcore->flash_window_size = 0x00400000;
+ else
+ mcore->flash_buswidth = 2;
+ break;
}
}