]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
kernel: backport "ofpart" mtd parser upstream quirks support
authorRafał Miłecki <rafal@milecki.pl>
Mon, 15 Feb 2021 10:47:17 +0000 (11:47 +0100)
committerRafał Miłecki <rafal@milecki.pl>
Mon, 15 Feb 2021 11:02:33 +0000 (12:02 +0100)
This adds quirks support to the "ofpart" parser. It's required to
support fixed partitions that require some extra logic.

Right now only BCM4908 binding is supported (BCM4908 requires detecting
currently used "firmware" partition).

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
target/linux/generic/backport-5.4/402-v5.12-0001-dt-bindings-mtd-move-partition-binding-to-its-own-fi.patch [moved from target/linux/bcm4908/patches-5.4/140-0001-dt-bindings-mtd-move-partition-binding-to-its-own-fi.patch with 92% similarity]
target/linux/generic/backport-5.4/402-v5.12-0002-dt-bindings-mtd-add-binding-for-BCM4908-partitions.patch [moved from target/linux/bcm4908/patches-5.4/140-0002-dt-bindings-mtd-add-binding-from-BCM4908-partitions.patch with 73% similarity]
target/linux/generic/backport-5.4/402-v5.12-0003-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch [moved from target/linux/bcm4908/patches-5.4/140-0003-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch with 91% similarity]
target/linux/generic/backport-5.4/402-v5.12-0004-mtd-parsers-ofpart-fix-building-as-module.patch [new file with mode: 0644]
target/linux/generic/pending-5.4/430-mtd-add-myloader-partition-parser.patch
target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch

similarity index 92%
rename from target/linux/bcm4908/patches-5.4/140-0001-dt-bindings-mtd-move-partition-binding-to-its-own-fi.patch
rename to target/linux/generic/backport-5.4/402-v5.12-0001-dt-bindings-mtd-move-partition-binding-to-its-own-fi.patch
index 1ad61d89f997b20e00b019275361821572159b06..f3b1179ecd8023fa4e12019109161e3fcae0f3c1 100644 (file)
@@ -1,7 +1,7 @@
-From 4fdbaa5a3dbe761b231c13feaa53242aae3306cc Mon Sep 17 00:00:00 2001
+From 6418522022c706fd867b00b2571edba48b8fa8c7 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Fri, 15 Jan 2021 15:23:02 +0100
-Subject: [PATCH 1/3] dt-bindings: mtd: move partition binding to its own file
+Date: Thu, 11 Feb 2021 23:04:25 +0100
+Subject: [PATCH] dt-bindings: mtd: move partition binding to its own file
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
@@ -13,6 +13,8 @@ Single partition binding is quite common and may be:
 Move it to separated file to avoid code duplication.
 
 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Reviewed-by: Rob Herring <robh@kernel.org>
+Signed-off-by: Richard Weinberger <richard@nod.at>
 ---
  .../mtd/partitions/fixed-partitions.yaml      | 33 +------------
  .../bindings/mtd/partitions/partition.yaml    | 47 +++++++++++++++++++
similarity index 73%
rename from target/linux/bcm4908/patches-5.4/140-0002-dt-bindings-mtd-add-binding-from-BCM4908-partitions.patch
rename to target/linux/generic/backport-5.4/402-v5.12-0002-dt-bindings-mtd-add-binding-for-BCM4908-partitions.patch
index 4967e6c1e3e1958b98a3b76eeb5b43ef50438768..8576c7d78d223a771b6f55251de25e5bb4d81d50 100644 (file)
@@ -1,24 +1,25 @@
-From 4f740351484e88bcea3776578288b6ec400829c8 Mon Sep 17 00:00:00 2001
+From 6e9dff6fe3fbc452f16566e4a7e293b0decefdba Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Fri, 15 Jan 2021 16:01:04 +0100
-Subject: [PATCH 2/3] dt-bindings: mtd: add binding from BCM4908 partitions
+Date: Thu, 11 Feb 2021 23:04:26 +0100
+Subject: [PATCH] dt-bindings: mtd: add binding for BCM4908 partitions
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
 
 BCM4908 uses fixed partitions layout but function of some partitions may
-vary. Some devices use multiple firmware partitions and those should be
-marked to let system discover their purpose.
+vary. Some devices use multiple firmware partitions and those partitions
+should be marked to let system discover their purpose.
 
 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Signed-off-by: Richard Weinberger <richard@nod.at>
 ---
- .../partitions/brcm,bcm4908-partitions.yaml   | 68 +++++++++++++++++++
- 1 file changed, 68 insertions(+)
+ .../partitions/brcm,bcm4908-partitions.yaml   | 70 +++++++++++++++++++
+ 1 file changed, 70 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml
 
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml
-@@ -0,0 +1,68 @@
+@@ -0,0 +1,70 @@
 +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
 +%YAML 1.2
 +---
@@ -42,17 +43,19 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
 +  compatible:
 +    const: brcm,bcm4908-partitions
 +
-+  "#address-cells": true
++  "#address-cells":
++    enum: [ 1, 2 ]
 +
-+  "#size-cells": true
++  "#size-cells":
++    enum: [ 1, 2 ]
 +
 +patternProperties:
-+  "@[0-9a-f]+$":
-+    allOf:
-+      - $ref: "partition.yaml#"
-+      - properties:
-+          compatible:
-+            const: brcm,bcm4908-firmware
++  "^partition@[0-9a-f]+$":
++    $ref: "partition.yaml#"
++    properties:
++      compatible:
++        const: brcm,bcm4908-firmware
++    unevaluatedProperties: false
 +
 +required:
 +  - "#address-cells"
similarity index 91%
rename from target/linux/bcm4908/patches-5.4/140-0003-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch
rename to target/linux/generic/backport-5.4/402-v5.12-0003-mtd-parsers-ofpart-support-BCM4908-fixed-partitions.patch
index 689807d48e6e4c97c00e2c1c585daf8d31d0d92b..340091fab94019b7f1a492d3133730c6654422dc 100644 (file)
@@ -1,7 +1,7 @@
-From db18357719613cc40234300b10e28e4dfa075375 Mon Sep 17 00:00:00 2001
+From 09cf6ee6d21cd9ef2eb857ccb24305cf51166792 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
-Date: Fri, 15 Jan 2021 16:23:01 +0100
-Subject: [PATCH 3/3] mtd: parsers: ofpart: support BCM4908 fixed partitions
+Date: Thu, 11 Feb 2021 23:04:27 +0100
+Subject: [PATCH] mtd: parsers: ofpart: support BCM4908 fixed partitions
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: 8bit
@@ -18,20 +18,21 @@ partition from the DT. Bootloader specifies it using the "brcm_blparms"
 property.
 
 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Signed-off-by: Richard Weinberger <richard@nod.at>
 ---
  drivers/mtd/parsers/Makefile             |  1 +
- drivers/mtd/parsers/bcm4908-partitions.c | 62 ++++++++++++++++++++++++
+ drivers/mtd/parsers/bcm4908-partitions.c | 64 ++++++++++++++++++++++++
  drivers/mtd/parsers/bcm4908-partitions.h |  7 +++
  drivers/mtd/parsers/ofpart.c             | 28 ++++++++++-
- 4 files changed, 96 insertions(+), 2 deletions(-)
+ 4 files changed, 98 insertions(+), 2 deletions(-)
  create mode 100644 drivers/mtd/parsers/bcm4908-partitions.c
  create mode 100644 drivers/mtd/parsers/bcm4908-partitions.h
 
 --- a/drivers/mtd/parsers/Makefile
 +++ b/drivers/mtd/parsers/Makefile
-@@ -5,6 +5,7 @@ obj-$(CONFIG_MTD_BCM63XX_PARTS)                += bcm6
+@@ -4,6 +4,7 @@ obj-$(CONFIG_MTD_BCM47XX_PARTS)                += bcm4
+ obj-$(CONFIG_MTD_BCM63XX_PARTS)               += bcm63xxpart.o
  obj-$(CONFIG_MTD_CMDLINE_PARTS)               += cmdlinepart.o
- obj-$(CONFIG_MTD_MYLOADER_PARTS)              += myloader.o
  obj-$(CONFIG_MTD_OF_PARTS)            += ofpart.o
 +obj-$(CONFIG_MTD_OF_PARTS)            += bcm4908-partitions.o
  obj-$(CONFIG_MTD_PARSER_IMAGETAG)     += parser_imagetag.o
@@ -39,7 +40,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  obj-$(CONFIG_MTD_PARSER_TRX)          += parser_trx.o
 --- /dev/null
 +++ b/drivers/mtd/parsers/bcm4908-partitions.c
-@@ -0,0 +1,62 @@
+@@ -0,0 +1,64 @@
 +// SPDX-License-Identifier: GPL-2.0
 +/*
 + * Copyright (C) 2021 Rafał Miłecki <rafal@milecki.pl>
@@ -52,6 +53,8 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
 +#include <linux/slab.h>
 +#include <linux/mtd/partitions.h>
 +
++#include "bcm4908-partitions.h"
++
 +#define BLPARAMS_FW_OFFSET            "NAND_RFS_OFS"
 +
 +static long long bcm4908_partitions_fw_offset(void)
diff --git a/target/linux/generic/backport-5.4/402-v5.12-0004-mtd-parsers-ofpart-fix-building-as-module.patch b/target/linux/generic/backport-5.4/402-v5.12-0004-mtd-parsers-ofpart-fix-building-as-module.patch
new file mode 100644 (file)
index 0000000..4722309
--- /dev/null
@@ -0,0 +1,40 @@
+From bc6dcf44da2bea215ae3edbdac5d350e96de3996 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
+Date: Mon, 15 Feb 2021 08:28:44 +0100
+Subject: [PATCH] mtd: parsers: ofpart: fix building as module
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This fixes:
+ERROR: modpost: missing MODULE_LICENSE() in drivers/mtd/parsers/bcm4908-partitions.o
+ERROR: modpost: "bcm4908_partitions_post_parse" [drivers/mtd/parsers/ofpart.ko] undefined!
+
+Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
+Fixes: 09cf6ee6d21c ("mtd: parsers: ofpart: support BCM4908 fixed partitions")
+Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
+Signed-off-by: Richard Weinberger <richard@nod.at>
+---
+ drivers/mtd/parsers/Makefile             | 2 +-
+ drivers/mtd/parsers/bcm4908-partitions.c | 2 ++
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/mtd/parsers/Makefile
++++ b/drivers/mtd/parsers/Makefile
+@@ -4,7 +4,7 @@ obj-$(CONFIG_MTD_BCM47XX_PARTS)                += bcm4
+ obj-$(CONFIG_MTD_BCM63XX_PARTS)               += bcm63xxpart.o
+ obj-$(CONFIG_MTD_CMDLINE_PARTS)               += cmdlinepart.o
+ obj-$(CONFIG_MTD_OF_PARTS)            += ofpart.o
+-obj-$(CONFIG_MTD_OF_PARTS)            += bcm4908-partitions.o
++ofpart-objs                           := bcm4908-partitions.o
+ obj-$(CONFIG_MTD_PARSER_IMAGETAG)     += parser_imagetag.o
+ obj-$(CONFIG_MTD_AFS_PARTS)           += afs.o
+ obj-$(CONFIG_MTD_PARSER_TRX)          += parser_trx.o
+--- a/drivers/mtd/parsers/bcm4908-partitions.c
++++ b/drivers/mtd/parsers/bcm4908-partitions.c
+@@ -62,3 +62,5 @@ int bcm4908_partitions_post_parse(struct
+       return 0;
+ }
++
++MODULE_LICENSE("GPL");
index 9600dfc67acf1a48d595a6585a1e04e63b3a1172..fc999966744c1af865387f500daa555bed918c34 100644 (file)
@@ -41,8 +41,8 @@ Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
  obj-$(CONFIG_MTD_CMDLINE_PARTS)               += cmdlinepart.o
 +obj-$(CONFIG_MTD_MYLOADER_PARTS)              += myloader.o
  obj-$(CONFIG_MTD_OF_PARTS)            += ofpart.o
+ ofpart-objs                           := bcm4908-partitions.o
  obj-$(CONFIG_MTD_PARSER_IMAGETAG)     += parser_imagetag.o
- obj-$(CONFIG_MTD_AFS_PARTS)           += afs.o
 --- /dev/null
 +++ b/drivers/mtd/parsers/myloader.c
 @@ -0,0 +1,181 @@
index 1523e757c70aca723bd80d11d4c5bf3f50d48b02..ed7eb6e98913d207ef42e85cd6b0967aafbab69c 100644 (file)
@@ -31,7 +31,7 @@ Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
 +       formatted DTS.
 --- a/drivers/mtd/parsers/Makefile
 +++ b/drivers/mtd/parsers/Makefile
-@@ -10,3 +10,4 @@ obj-$(CONFIG_MTD_AFS_PARTS)          += afs.o
+@@ -11,3 +11,4 @@ obj-$(CONFIG_MTD_AFS_PARTS)          += afs.o
  obj-$(CONFIG_MTD_PARSER_TRX)          += parser_trx.o
  obj-$(CONFIG_MTD_SHARPSL_PARTS)               += sharpslpart.o
  obj-$(CONFIG_MTD_REDBOOT_PARTS)               += redboot.o