| To: | linux-mtd@lists.infradead.org |
|---|---|
| Subject: | [PATCH 1/5] MTD: bcm63xxpart: check version marker string for newer CFEs |
| From: | Jonas Gorski <jonas.gorski@gmail.com> |
| Date: | Sat, 17 Dec 2011 13:58:14 +0100 |
| Cc: | linux-mips@linux-mips.org, Florian Fainelli <florian@openwrt.org>, David Woodhouse <dwmw2@infradead.org>, Artem Bityutskiy <Artem.Bityutskiy@intel.com> |
| Dkim-signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=zFS97cPSBx69fWMSCM2YAQI+DA54TAyuW507siRdLsE=; b=WKNFHPHhL4En84yhFTG3N3AJBgAQs1uaY2JeEjHKsx7kxo7lxa5WUyxvTta58ATxzf oBGQjOZmjE3NGp4kVYkfCLAwg6EuCLU7gWdY41dLXsBkkm94Of3VSerztpCR1ZTQwiCD Z6X7ThDcgmZf9UIO1xGpdRh/XSyUyUF0/T1vI= |
| In-reply-to: | <1324126698-9919-1-git-send-email-jonas.gorski@gmail.com> |
| References: | <1324126698-9919-1-git-send-email-jonas.gorski@gmail.com> |
| Sender: | linux-mips-bounce@linux-mips.org |
Recent CFEs do not contain the CFE1CFE1 magic anymore, so check for the
"cfe-v" version marker string instead. As very old CFEs do not have
this string, leave the CFE1CFE1 magic as a fallback for detection.
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
drivers/mtd/bcm63xxpart.c | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/drivers/mtd/bcm63xxpart.c b/drivers/mtd/bcm63xxpart.c
index ac7d3c8..9933b34 100644
--- a/drivers/mtd/bcm63xxpart.c
+++ b/drivers/mtd/bcm63xxpart.c
@@ -32,22 +32,34 @@
#include <linux/mtd/partitions.h>
#include <asm/mach-bcm63xx/bcm963xx_tag.h>
+#include <asm/mach-bcm63xx/board_bcm963xx.h>
#define BCM63XX_EXTENDED_SIZE 0xBFC00000 /* Extended flash address */
+#define BCM63XX_CFE_MAGIC_OFFSET 0x4e0
+
static int bcm63xx_detect_cfe(struct mtd_info *master)
{
- int idoffset = 0x4e0;
- static char idstring[8] = "CFE1CFE1";
char buf[9];
int ret;
size_t retlen;
- ret = master->read(master, idoffset, 8, &retlen, (void *)buf);
+ ret = master->read(master, BCM963XX_CFE_VERSION_OFFSET, 5, &retlen,
+ (void *)buf);
+ buf[retlen] = 0;
+
+ if (ret)
+ return ret;
+
+ if (strncmp("cfe-v", buf, 5) == 0)
+ return 0;
+
+ /* very old CFE's do not have the cfe-v string, so check for magic */
+ ret = master->read(master, BCM63XX_CFE_MAGIC_OFFSET, 8, &retlen,
+ (void *)buf);
buf[retlen] = 0;
- pr_info("Read Signature value of %s\n", buf);
- return strncmp(idstring, buf, 8);
+ return strncmp("CFE1CFE1", buf, 8);
}
static int bcm63xx_parse_cfe_partitions(struct mtd_info *master,
--
1.7.2.5
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH 0/5] MTD: bcm63xxpart: improve robustness, Jonas Gorski |
|---|---|
| Next by Date: | [PATCH 2/5] MTD: bcm63xxpart: make sure CFE and NVRAM partitions are at least 64K, Jonas Gorski |
| Previous by Thread: | [PATCH 0/5] MTD: bcm63xxpart: improve robustness, Jonas Gorski |
| Next by Thread: | [PATCH 2/5] MTD: bcm63xxpart: make sure CFE and NVRAM partitions are at least 64K, Jonas Gorski |
| Indexes: | [Date] [Thread] [Top] [All Lists] |