kernel: update bcm47xxpart failsafe partition patches
authorRafał Miłecki <rafal@milecki.pl>
Wed, 11 Jan 2017 08:53:44 +0000 (09:53 +0100)
committerRafał Miłecki <rafal@milecki.pl>
Wed, 11 Jan 2017 08:54:47 +0000 (09:54 +0100)
V2 using helper function was sent for upstream kernel

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
target/linux/bcm53xx/patches-4.4/901-mtd-bcm47xxpart-add-device-specific-workarounds.patch
target/linux/generic/patches-4.4/141-0001-mtd-bcm47xxpart-move-TRX-parsing-code-to-separated-f.patch
target/linux/generic/patches-4.4/141-0002-mtd-bcm47xxpart-support-layouts-with-multiple-TRX-pa.patch
target/linux/generic/patches-4.4/431-mtd-bcm47xxpart-check-for-bad-blocks-when-calculatin.patch
target/linux/generic/patches-4.4/432-mtd-bcm47xxpart-detect-T_Meter-partition.patch

index 7713466..0ffa82f 100644 (file)
@@ -17,7 +17,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  
  #include <uapi/linux/magic.h>
  
-@@ -250,6 +251,28 @@ static int bcm47xxpart_parse(struct mtd_
+@@ -249,6 +250,28 @@ static int bcm47xxpart_parse(struct mtd_
                        break;
                }
  
index 09cbec6..a204fe6 100644 (file)
@@ -14,12 +14,12 @@ is more than 1 TRX partition.
 
 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
 ---
- drivers/mtd/bcm47xxpart.c | 124 ++++++++++++++++++++++++++++------------------
- 1 file changed, 77 insertions(+), 47 deletions(-)
+ drivers/mtd/bcm47xxpart.c | 121 ++++++++++++++++++++++++++++------------------
+ 1 file changed, 74 insertions(+), 47 deletions(-)
 
 --- a/drivers/mtd/bcm47xxpart.c
 +++ b/drivers/mtd/bcm47xxpart.c
-@@ -83,6 +83,70 @@ out_default:
+@@ -83,6 +83,67 @@ out_default:
        return "rootfs";
  }
  
@@ -28,7 +28,6 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
 +                               struct mtd_partition *parts,
 +                               size_t parts_len)
 +{
-+      struct mtd_partition *part;
 +      struct trx_header header;
 +      size_t bytes_read;
 +      int curr_part = 0;
@@ -50,25 +49,23 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
 +
 +      /* We have LZMA loader if offset[2] points to sth */
 +      if (header.offset[2]) {
-+              part = &parts[curr_part++];
-+              part->name = "loader";
-+              part->offset = trx->offset + header.offset[i];
++              bcm47xxpart_add_part(&parts[curr_part++], "loader",
++                                   trx->offset + header.offset[i], 0);
 +              i++;
 +      }
 +
 +      if (header.offset[i]) {
-+              part = &parts[curr_part++];
-+              part->name = "linux";
-+              part->offset = trx->offset + header.offset[i];
++              bcm47xxpart_add_part(&parts[curr_part++], "linux",
++                                   trx->offset + header.offset[i], 0);
 +              i++;
 +      }
 +
 +      if (header.offset[i]) {
 +              size_t offset = trx->offset + header.offset[i];
++              const char *name = bcm47xxpart_trx_data_part_name(master,
++                                                                offset);
 +
-+              part = &parts[curr_part++];
-+              part->name = bcm47xxpart_trx_data_part_name(master, offset);
-+              part->offset = offset;
++              bcm47xxpart_add_part(&parts[curr_part++], name, offset, 0);
 +              i++;
 +      }
 +
@@ -90,7 +87,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  static int bcm47xxpart_parse(struct mtd_info *master,
                             struct mtd_partition **pparts,
                             struct mtd_part_parser_data *data)
-@@ -93,9 +157,7 @@ static int bcm47xxpart_parse(struct mtd_
+@@ -93,9 +154,7 @@ static int bcm47xxpart_parse(struct mtd_
        size_t bytes_read;
        uint32_t offset;
        uint32_t blocksize = master->erasesize;
@@ -100,7 +97,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
        int possible_nvram_sizes[] = { 0x8000, 0xF000, 0x10000, };
        int err;
  
-@@ -182,54 +244,14 @@ static int bcm47xxpart_parse(struct mtd_
+@@ -182,54 +241,14 @@ static int bcm47xxpart_parse(struct mtd_
  
                /* TRX */
                if (buf[0x000 / 4] == TRX_MAGIC) {
@@ -157,7 +154,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
                        offset = roundup(offset + trx->length, blocksize);
                        /* Next loop iteration will increase the offset */
                        offset -= blocksize;
-@@ -307,9 +329,17 @@ static int bcm47xxpart_parse(struct mtd_
+@@ -307,9 +326,17 @@ static int bcm47xxpart_parse(struct mtd_
                                       parts[i + 1].offset : master->size;
  
                parts[i].size = next_part_offset - parts[i].offset;
index 1065322..2d97be7 100644 (file)
@@ -24,7 +24,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  #include <linux/module.h>
  #include <linux/kernel.h>
  #include <linux/slab.h>
-@@ -147,6 +148,30 @@ static int bcm47xxpart_parse_trx(struct
+@@ -144,6 +145,30 @@ static int bcm47xxpart_parse_trx(struct
        return curr_part;
  }
  
@@ -55,7 +55,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
  static int bcm47xxpart_parse(struct mtd_info *master,
                             struct mtd_partition **pparts,
                             struct mtd_part_parser_data *data)
-@@ -157,7 +182,8 @@ static int bcm47xxpart_parse(struct mtd_
+@@ -154,7 +179,8 @@ static int bcm47xxpart_parse(struct mtd_
        size_t bytes_read;
        uint32_t offset;
        uint32_t blocksize = master->erasesize;
@@ -65,7 +65,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
        int possible_nvram_sizes[] = { 0x8000, 0xF000, 0x10000, };
        int err;
  
-@@ -246,7 +272,11 @@ static int bcm47xxpart_parse(struct mtd_
+@@ -243,7 +269,11 @@ static int bcm47xxpart_parse(struct mtd_
                if (buf[0x000 / 4] == TRX_MAGIC) {
                        struct trx_header *trx;
  
@@ -78,7 +78,7 @@ Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
                        bcm47xxpart_add_part(&parts[curr_part++], "firmware",
                                             offset, 0);
  
-@@ -332,14 +362,20 @@ static int bcm47xxpart_parse(struct mtd_
+@@ -329,14 +359,20 @@ static int bcm47xxpart_parse(struct mtd_
        }
  
        /* If there was TRX parse it now */
index b778451..379e551 100644 (file)
@@ -48,29 +48,44 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  static const char *bcm47xxpart_trx_data_part_name(struct mtd_info *master,
                                                  size_t offset)
  {
-@@ -113,19 +141,22 @@ static int bcm47xxpart_parse_trx(struct
+@@ -91,6 +119,7 @@ static int bcm47xxpart_parse_trx(struct
+ {
+       struct trx_header header;
+       size_t bytes_read;
++      size_t offset;
+       int curr_part = 0;
+       int i, err;
+@@ -110,21 +139,25 @@ static int bcm47xxpart_parse_trx(struct
+       /* We have LZMA loader if offset[2] points to sth */
        if (header.offset[2]) {
-               part = &parts[curr_part++];
-               part->name = "loader";
--              part->offset = trx->offset + header.offset[i];
-+              part->offset = bcm47xxpart_real_offset(master, trx->offset,
-+                                                     header.offset[i]);
+-              bcm47xxpart_add_part(&parts[curr_part++], "loader",
+-                                   trx->offset + header.offset[i], 0);
++              offset = bcm47xxpart_real_offset(master, trx->offset,
++                                               header.offset[i]);
++              bcm47xxpart_add_part(&parts[curr_part++], "loader", offset, 0);
                i++;
        }
  
        if (header.offset[i]) {
-               part = &parts[curr_part++];
-               part->name = "linux";
--              part->offset = trx->offset + header.offset[i];
-+              part->offset = bcm47xxpart_real_offset(master, trx->offset,
-+                                                     header.offset[i]);
+-              bcm47xxpart_add_part(&parts[curr_part++], "linux",
+-                                   trx->offset + header.offset[i], 0);
++              offset = bcm47xxpart_real_offset(master, trx->offset,
++                                               header.offset[i]);
++              bcm47xxpart_add_part(&parts[curr_part++], "linux", offset, 0);
                i++;
        }
  
        if (header.offset[i]) {
 -              size_t offset = trx->offset + header.offset[i];
-+              size_t offset = bcm47xxpart_real_offset(master, trx->offset,
-+                                                      header.offset[i]);
+-              const char *name = bcm47xxpart_trx_data_part_name(master,
+-                                                                offset);
++              const char *name;
++
++              offset = bcm47xxpart_real_offset(master, trx->offset,
++                                               header.offset[i]);
++              name = bcm47xxpart_trx_data_part_name(master, offset);
  
-               part = &parts[curr_part++];
-               part->name = bcm47xxpart_trx_data_part_name(master, offset);
+               bcm47xxpart_add_part(&parts[curr_part++], name, offset, 0);
+               i++;
index b39ba3f..a19e943 100644 (file)
@@ -24,7 +24,7 @@ Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
  #define ML_MAGIC1                     0x39685a42
  #define ML_MAGIC2                     0x26594131
  #define TRX_MAGIC                     0x30524448
-@@ -298,6 +299,15 @@ static int bcm47xxpart_parse(struct mtd_
+@@ -297,6 +298,15 @@ static int bcm47xxpart_parse(struct mtd_
                                             MTD_WRITEABLE);
                        continue;
                }