aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2023-06-14 23:21:34 +0200
committerÁlvaro Fernández Rojas <noltari@gmail.com>2023-06-15 11:55:51 +0200
commite908856c43c77efa2c3fce1978a4e92b9c32cf37 (patch)
treeaac3c841c16451b8009c9019e8c2f79c4a69d458 /target
parent17f60018535fba90c6b1e2df97c050bd36749769 (diff)
downloadupstream-e908856c43c77efa2c3fce1978a4e92b9c32cf37.tar.gz
upstream-e908856c43c77efa2c3fce1978a4e92b9c32cf37.tar.bz2
upstream-e908856c43c77efa2c3fce1978a4e92b9c32cf37.zip
kernel: mtd: bcm-wfi: add cferam name support
Some devices rename cferam bootloader using specific patterns and don't follow broadcom standards for renaming cferam files. This requires supporting different cferam file names. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> (cherry picked from commit 8813edd8d9695d4e3939fdaa3c530c682f91de11)
Diffstat (limited to 'target')
-rw-r--r--target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_bcm_wfi.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_bcm_wfi.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_bcm_wfi.c
index 1ddcf6745f..1cafc91fde 100644
--- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_bcm_wfi.c
+++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_bcm_wfi.c
@@ -31,6 +31,7 @@
#define CFERAM_NAME "cferam"
#define CFERAM_NAME_LEN (sizeof(CFERAM_NAME) - 1)
+#define CFERAM_NAME_MAX_LEN 32
#define KERNEL_NAME "vmlinux.lz"
#define KERNEL_NAME_LEN (sizeof(KERNEL_NAME) - 1)
#define OPENWRT_NAME "1-openwrt"
@@ -157,17 +158,28 @@ static int parse_bcm_wfi(struct mtd_info *master,
const struct mtd_partition **pparts,
uint8_t *buf, loff_t off, loff_t size, bool cfe_part)
{
+ struct device_node *mtd_node;
struct mtd_partition *parts;
loff_t cfe_off, kernel_off, rootfs_off;
unsigned int num_parts = BCM_WFI_PARTS, cur_part = 0;
+ const char *cferam_name = CFERAM_NAME;
+ size_t cferam_name_len;
int ret;
+ mtd_node = mtd_get_of_node(master);
+ if (mtd_node)
+ of_property_read_string(mtd_node, "brcm,cferam", &cferam_name);
+
+ cferam_name_len = strnlen(cferam_name, CFERAM_NAME_MAX_LEN);
+ if (cferam_name_len > 0)
+ cferam_name_len--;
+
if (cfe_part) {
num_parts++;
cfe_off = off;
- ret = jffs2_find_file(master, buf, CFERAM_NAME,
- CFERAM_NAME_LEN, &cfe_off,
+ ret = jffs2_find_file(master, buf, cferam_name,
+ cferam_name_len, &cfe_off,
size - (cfe_off - off), NULL, NULL);
if (ret)
return ret;