Thread (5 messages) 5 messages, 2 authors, 2012-07-25

[RFT][PATCH 3/3] ssb: check for flash presentence

From: Rafał Miłecki <zajec5@gmail.com>
Date: 2012-07-22 16:51:21
Subsystem: sonics silicon backplane driver (ssb), the rest · Maintainers: Michael Buesch, Linus Torvalds

We can not assume parallel flash is always present, there are boards
with *serial* flash and probably some without flash at all.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 drivers/ssb/driver_mipscore.c |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/drivers/ssb/driver_mipscore.c b/drivers/ssb/driver_mipscore.c
index 873bc0a..266a4c8 100644
--- a/drivers/ssb/driver_mipscore.c
+++ b/drivers/ssb/driver_mipscore.c
@@ -190,16 +190,32 @@ static void ssb_mips_flash_detect(struct ssb_mipscore *mcore)
 {
 	struct ssb_bus *bus = mcore->dev->bus;
 
-	bus->chipco.pflash.buswidth = 2;
-	if (bus->chipco.dev) {
+	/* When there is no chipcommon on the bus there is 4MB flash */
+	if (!bus->chipco.dev) {
+		bus->chipco.pflash.buswidth = 2;
+		bus->chipco.pflash.window = SSB_FLASH1;
+		bus->chipco.pflash.window_size = SSB_FLASH1_SZ;
+		return;
+	}
+
+	/* Read info about flash from the ChipCommon */
+	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_info("Found parallel flash\n");
 		bus->chipco.pflash.window = SSB_FLASH2;
 		bus->chipco.pflash.window_size = SSB_FLASH2_SZ;
 		if ((ssb_read32(bus->chipco.dev, SSB_CHIPCO_FLASH_CFG)
-		               & SSB_CHIPCO_CFG_DS16) == 0)
+		     & SSB_CHIPCO_CFG_DS16) == 0)
 			bus->chipco.pflash.buswidth = 1;
-	} else {
-		bus->chipco.pflash.window = SSB_FLASH1;
-		bus->chipco.pflash.window_size = SSB_FLASH1_SZ;
+		else
+			bus->chipco.pflash.buswidth = 2;
+		break;
+	default:
+		pr_err("Flash type not supported\n");
 	}
 }
 
-- 
1.7.7
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help