linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <zajec5@gmail.com>
To: linux-wireless@vger.kernel.org, Hauke Mehrtens <hauke@hauke-m.de>
Cc: "Rafał Miłecki" <zajec5@gmail.com>
Subject: [RFT][PATCH 3/3] ssb: check for flash presentence
Date: Sun, 22 Jul 2012 18:51:29 +0200	[thread overview]
Message-ID: <1342975889-32687-4-git-send-email-zajec5@gmail.com> (raw)
In-Reply-To: <1342975889-32687-1-git-send-email-zajec5@gmail.com>

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


      parent reply	other threads:[~2012-07-22 16:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-22 16:51 [RFT][PATCH 0/3] ssb: Flash memory improvements Rafał Miłecki
2012-07-22 16:51 ` [RFT][PATCH 1/3] ssb: update defines Rafał Miłecki
2012-07-22 16:51 ` [RFT][PATCH 2/3] ssb: move flash info to ChipCommon driver Rafał Miłecki
2012-07-25 12:18   ` Hauke Mehrtens
2012-07-22 16:51 ` Rafał Miłecki [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1342975889-32687-4-git-send-email-zajec5@gmail.com \
    --to=zajec5@gmail.com \
    --cc=hauke@hauke-m.de \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).