Search Linux Wireless

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux