aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mediatek/patches-5.10/351-mtd-parsers-trx-Allow-to-specify-brcm-trx-magic-in-D.patch
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2021-04-18 21:51:00 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2021-05-23 17:10:17 +0200
commita6616eea406d8654f5a0198a26c5748a86c75272 (patch)
treea88c49947f6de28a7acde088d03cbabe34eac976 /target/linux/mediatek/patches-5.10/351-mtd-parsers-trx-Allow-to-specify-brcm-trx-magic-in-D.patch
parentd6831752367722e916bd15e5d1af79993c637a67 (diff)
downloadupstream-a6616eea406d8654f5a0198a26c5748a86c75272.tar.gz
upstream-a6616eea406d8654f5a0198a26c5748a86c75272.tar.bz2
upstream-a6616eea406d8654f5a0198a26c5748a86c75272.zip
mediatek: update mtd parser patches
This updates the patches to match the versions included in the mtd subsystem for the next Linux kernel version. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'target/linux/mediatek/patches-5.10/351-mtd-parsers-trx-Allow-to-specify-brcm-trx-magic-in-D.patch')
-rw-r--r--target/linux/mediatek/patches-5.10/351-mtd-parsers-trx-Allow-to-specify-brcm-trx-magic-in-D.patch50
1 files changed, 50 insertions, 0 deletions
diff --git a/target/linux/mediatek/patches-5.10/351-mtd-parsers-trx-Allow-to-specify-brcm-trx-magic-in-D.patch b/target/linux/mediatek/patches-5.10/351-mtd-parsers-trx-Allow-to-specify-brcm-trx-magic-in-D.patch
new file mode 100644
index 0000000000..ac98556101
--- /dev/null
+++ b/target/linux/mediatek/patches-5.10/351-mtd-parsers-trx-Allow-to-specify-brcm-trx-magic-in-D.patch
@@ -0,0 +1,50 @@
+From d7f7e04f8b67571a4bf5a0dcd4f9da4214f5262c Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Sun, 18 Apr 2021 23:46:15 +0200
+Subject: mtd: parsers: trx: Allow to specify brcm, trx-magic in DT
+
+Buffalo uses a different TRX magic for every device, to be able to use
+this trx parser, make it possible to specify the TRX magic in device
+tree. If no TRX magic is specified in device tree, the standard value
+will be used. This value should only be specified if a vendor chooses to
+use a non standard TRX magic.
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Link: https://lore.kernel.org/linux-mtd/20210418214616.239574-3-hauke@hauke-m.de
+---
+ drivers/mtd/parsers/parser_trx.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+--- a/drivers/mtd/parsers/parser_trx.c
++++ b/drivers/mtd/parsers/parser_trx.c
+@@ -78,13 +78,20 @@ static int parser_trx_parse(struct mtd_i
+ const struct mtd_partition **pparts,
+ struct mtd_part_parser_data *data)
+ {
++ struct device_node *np = mtd_get_of_node(mtd);
+ struct mtd_partition *parts;
+ struct mtd_partition *part;
+ struct trx_header trx;
+ size_t bytes_read;
+ uint8_t curr_part = 0, i = 0;
++ uint32_t trx_magic = TRX_MAGIC;
+ int err;
+
++ /* Get different magic from device tree if specified */
++ err = of_property_read_u32(np, "brcm,trx-magic", &trx_magic);
++ if (err != 0 && err != -EINVAL)
++ pr_err("failed to parse \"brcm,trx-magic\" DT attribute, using default: %d\n", err);
++
+ parts = kcalloc(TRX_PARSER_MAX_PARTS, sizeof(struct mtd_partition),
+ GFP_KERNEL);
+ if (!parts)
+@@ -97,7 +104,7 @@ static int parser_trx_parse(struct mtd_i
+ return err;
+ }
+
+- if (trx.magic != TRX_MAGIC) {
++ if (trx.magic != trx_magic) {
+ kfree(parts);
+ return -ENOENT;
+ }