mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-29 18:19:02 +00:00
f586dd67ac
Boot tested on Comtrend AR-5387un: https://gist.github.com/Noltari/57e5030455da8dc38e61f8c3a5922254 Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> [jonas.gorski: make 4.19 an optional testing version; add gcc 8.3 fix] Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
52 lines
1.2 KiB
Diff
52 lines
1.2 KiB
Diff
--- a/drivers/mtd/bcm63xxpart.c
|
|
+++ b/drivers/mtd/bcm63xxpart.c
|
|
@@ -35,6 +35,8 @@
|
|
#include <linux/mtd/mtd.h>
|
|
#include <linux/mtd/partitions.h>
|
|
#include <linux/of.h>
|
|
+
|
|
+#include <asm/mach-bcm63xx/bcm63xx_board.h>
|
|
|
|
#define BCM963XX_CFE_BLOCK_SIZE SZ_64K /* always at least 64KiB */
|
|
|
|
@@ -46,30 +48,6 @@
|
|
#define STR_NULL_TERMINATE(x) \
|
|
do { char *_str = (x); _str[sizeof(x) - 1] = 0; } while (0)
|
|
|
|
-static int bcm63xx_detect_cfe(struct mtd_info *master)
|
|
-{
|
|
- char buf[9];
|
|
- int ret;
|
|
- size_t retlen;
|
|
-
|
|
- ret = mtd_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 = mtd_read(master, BCM963XX_CFE_MAGIC_OFFSET, 8, &retlen,
|
|
- (void *)buf);
|
|
- buf[retlen] = 0;
|
|
-
|
|
- return strncmp("CFE1CFE1", buf, 8);
|
|
-}
|
|
-
|
|
static int bcm63xx_read_nvram(struct mtd_info *master,
|
|
struct bcm963xx_nvram *nvram)
|
|
{
|
|
@@ -152,7 +130,7 @@ static int bcm63xx_parse_cfe_partitions(
|
|
struct bcm963xx_nvram *nvram = NULL;
|
|
int ret;
|
|
|
|
- if (bcm63xx_detect_cfe(master))
|
|
+ if (!bcm63xx_is_cfe_present())
|
|
return -EINVAL;
|
|
|
|
nvram = vzalloc(sizeof(*nvram));
|