diff options
author | Jonas Gorski <jonas.gorski@gmail.com> | 2011-12-17 07:58:14 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-01-09 13:19:00 -0500 |
commit | f2d9739b8e0bc9bdcc972950dd433b5083edf72f (patch) | |
tree | fa3779069cc5608eeef1048d576a9c196b8095ec /drivers/mtd/bcm63xxpart.c | |
parent | f9fbcdc357f37d6c82a75a89c64efbe8bd5274e1 (diff) |
mtd: bcm63xxpart: check version marker string for newer CFEs
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>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/bcm63xxpart.c')
-rw-r--r-- | 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 ac7d3c823949..9933b347a555 100644 --- a/drivers/mtd/bcm63xxpart.c +++ b/drivers/mtd/bcm63xxpart.c | |||
@@ -32,22 +32,34 @@ | |||
32 | #include <linux/mtd/partitions.h> | 32 | #include <linux/mtd/partitions.h> |
33 | 33 | ||
34 | #include <asm/mach-bcm63xx/bcm963xx_tag.h> | 34 | #include <asm/mach-bcm63xx/bcm963xx_tag.h> |
35 | #include <asm/mach-bcm63xx/board_bcm963xx.h> | ||
35 | 36 | ||
36 | #define BCM63XX_EXTENDED_SIZE 0xBFC00000 /* Extended flash address */ | 37 | #define BCM63XX_EXTENDED_SIZE 0xBFC00000 /* Extended flash address */ |
37 | 38 | ||
39 | #define BCM63XX_CFE_MAGIC_OFFSET 0x4e0 | ||
40 | |||
38 | static int bcm63xx_detect_cfe(struct mtd_info *master) | 41 | static int bcm63xx_detect_cfe(struct mtd_info *master) |
39 | { | 42 | { |
40 | int idoffset = 0x4e0; | ||
41 | static char idstring[8] = "CFE1CFE1"; | ||
42 | char buf[9]; | 43 | char buf[9]; |
43 | int ret; | 44 | int ret; |
44 | size_t retlen; | 45 | size_t retlen; |
45 | 46 | ||
46 | ret = master->read(master, idoffset, 8, &retlen, (void *)buf); | 47 | ret = master->read(master, BCM963XX_CFE_VERSION_OFFSET, 5, &retlen, |
48 | (void *)buf); | ||
49 | buf[retlen] = 0; | ||
50 | |||
51 | if (ret) | ||
52 | return ret; | ||
53 | |||
54 | if (strncmp("cfe-v", buf, 5) == 0) | ||
55 | return 0; | ||
56 | |||
57 | /* very old CFE's do not have the cfe-v string, so check for magic */ | ||
58 | ret = master->read(master, BCM63XX_CFE_MAGIC_OFFSET, 8, &retlen, | ||
59 | (void *)buf); | ||
47 | buf[retlen] = 0; | 60 | buf[retlen] = 0; |
48 | pr_info("Read Signature value of %s\n", buf); | ||
49 | 61 | ||
50 | return strncmp(idstring, buf, 8); | 62 | return strncmp("CFE1CFE1", buf, 8); |
51 | } | 63 | } |
52 | 64 | ||
53 | static int bcm63xx_parse_cfe_partitions(struct mtd_info *master, | 65 | static int bcm63xx_parse_cfe_partitions(struct mtd_info *master, |