aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm53xx/patches-5.10/500-UBI-Detect-EOF-mark-and-erase-all-remaining-blocks.patch
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2021-07-29 13:50:19 +0200
committerRafał Miłecki <rafal@milecki.pl>2021-07-29 14:56:14 +0200
commitd8e8a2a8db1e671aff2623dbec8e47b36f956eb8 (patch)
treea27af596dfd8b4c776bd28004c5749330ed1e3c6 /target/linux/bcm53xx/patches-5.10/500-UBI-Detect-EOF-mark-and-erase-all-remaining-blocks.patch
parent5be1c022fee1c67e7553e45ee641e276319cbb66 (diff)
downloadupstream-d8e8a2a8db1e671aff2623dbec8e47b36f956eb8.tar.gz
upstream-d8e8a2a8db1e671aff2623dbec8e47b36f956eb8.tar.bz2
upstream-d8e8a2a8db1e671aff2623dbec8e47b36f956eb8.zip
bcm53xx: add testing support for kernel 5.10
It still requires fixing PCIe support: [ 6.644699] pcie_iproc_bcma bcma0:7: host bridge /axi@18000000/pcie@12000 ranges: [ 6.652217] pcie_iproc_bcma bcma0:7: No bus range found for /axi@18000000/pcie@12000, using [bus 00-ff] [ 6.661833] OF: /axi@18000000/pcie@12000: Missing device_type [ 6.667622] pcie_iproc_bcma: probe of bcma0:7 failed with error -12 [ 6.673985] pcie_iproc_bcma bcma0:8: host bridge /axi@18000000/pcie@13000 ranges: [ 6.681514] pcie_iproc_bcma bcma0:8: No bus range found for /axi@18000000/pcie@13000, using [bus 00-ff] [ 6.691137] pcie_iproc_bcma: probe of bcma0:8 failed with error -12 [ 6.697522] pcie_iproc_bcma bcma0:9: host bridge /axi@18000000/pcie@14000 ranges: [ 6.705048] pcie_iproc_bcma bcma0:9: No bus range found for /axi@18000000/pcie@14000, using [bus 00-ff] [ 6.714669] pcie_iproc_bcma: probe of bcma0:9 failed with error -12 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Diffstat (limited to 'target/linux/bcm53xx/patches-5.10/500-UBI-Detect-EOF-mark-and-erase-all-remaining-blocks.patch')
-rw-r--r--target/linux/bcm53xx/patches-5.10/500-UBI-Detect-EOF-mark-and-erase-all-remaining-blocks.patch59
1 files changed, 59 insertions, 0 deletions
diff --git a/target/linux/bcm53xx/patches-5.10/500-UBI-Detect-EOF-mark-and-erase-all-remaining-blocks.patch b/target/linux/bcm53xx/patches-5.10/500-UBI-Detect-EOF-mark-and-erase-all-remaining-blocks.patch
new file mode 100644
index 0000000000..ff9d6b0005
--- /dev/null
+++ b/target/linux/bcm53xx/patches-5.10/500-UBI-Detect-EOF-mark-and-erase-all-remaining-blocks.patch
@@ -0,0 +1,59 @@
+From 2a2af518266a29323cf30c3f9ba9ef2ceb1dd84b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
+Date: Thu, 16 Oct 2014 20:52:16 +0200
+Subject: [PATCH] UBI: Detect EOF mark and erase all remaining blocks
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
+---
+ drivers/mtd/ubi/attach.c | 5 +++++
+ drivers/mtd/ubi/io.c | 4 ++++
+ drivers/mtd/ubi/ubi.h | 1 +
+ 3 files changed, 10 insertions(+)
+
+--- a/drivers/mtd/ubi/attach.c
++++ b/drivers/mtd/ubi/attach.c
+@@ -82,6 +82,9 @@ static int self_check_ai(struct ubi_devi
+ #define AV_ADD BIT(1)
+ #define AV_FIND_OR_ADD (AV_FIND | AV_ADD)
+
++/* Set on finding block with 0xdeadc0de, indicates erasing all blocks behind */
++bool erase_all_next;
++
+ /**
+ * find_or_add_av - internal function to find a volume, add a volume or do
+ * both (find and add if missing).
+@@ -1580,6 +1583,8 @@ int ubi_attach(struct ubi_device *ubi, i
+ if (!ai)
+ return -ENOMEM;
+
++ erase_all_next = false;
++
+ #ifdef CONFIG_MTD_UBI_FASTMAP
+ /* On small flash devices we disable fastmap in any case. */
+ if ((int)mtd_div_by_eb(ubi->mtd->size, ubi->mtd) <= UBI_FM_MAX_START) {
+--- a/drivers/mtd/ubi/io.c
++++ b/drivers/mtd/ubi/io.c
+@@ -710,6 +710,10 @@ int ubi_io_read_ec_hdr(struct ubi_device
+ }
+
+ magic = be32_to_cpu(ec_hdr->magic);
++ if (magic == 0xdeadc0de)
++ erase_all_next = true;
++ if (erase_all_next)
++ return read_err ? UBI_IO_FF_BITFLIPS : UBI_IO_FF;
+ if (magic != UBI_EC_HDR_MAGIC) {
+ if (mtd_is_eccerr(read_err))
+ return UBI_IO_BAD_HDR_EBADMSG;
+--- a/drivers/mtd/ubi/ubi.h
++++ b/drivers/mtd/ubi/ubi.h
+@@ -822,6 +822,7 @@ extern struct mutex ubi_devices_mutex;
+ extern struct blocking_notifier_head ubi_notifiers;
+
+ /* attach.c */
++extern bool erase_all_next;
+ struct ubi_ainf_peb *ubi_alloc_aeb(struct ubi_attach_info *ai, int pnum,
+ int ec);
+ void ubi_free_aeb(struct ubi_attach_info *ai, struct ubi_ainf_peb *aeb);