F7D3301/F7D7301, F7D3302/F7D7302, and F7D4301 replace the "HDR0" with a
custom byte sequence (which appears to be a date). Also, they all
appear to support a single "QA" byte sequence. Add all of these to the
partition detection.

Signed-off-by: Cody P Schafer <de...@codyps.com>
---
 .../077-MIPS-BCM47XX-mtd-partition-belkin.patch    | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 
target/linux/brcm47xx/patches-3.10/077-MIPS-BCM47XX-mtd-partition-belkin.patch

diff --git 
a/target/linux/brcm47xx/patches-3.10/077-MIPS-BCM47XX-mtd-partition-belkin.patch
 
b/target/linux/brcm47xx/patches-3.10/077-MIPS-BCM47XX-mtd-partition-belkin.patch
new file mode 100644
index 0000000..18c3117
--- /dev/null
+++ 
b/target/linux/brcm47xx/patches-3.10/077-MIPS-BCM47XX-mtd-partition-belkin.patch
@@ -0,0 +1,42 @@
+Index: linux-3.10.17/drivers/mtd/bcm47xxpart.c
+===================================================================
+--- linux-3.10.17.orig/drivers/mtd/bcm47xxpart.c
++++ linux-3.10.17/drivers/mtd/bcm47xxpart.c
+@@ -33,7 +33,11 @@
+ #define POT_MAGIC2                    0x504f          /* OP */
+ #define ML_MAGIC1                     0x39685a42
+ #define ML_MAGIC2                     0x26594131
+-#define TRX_MAGIC                     0x30524448
++#define TRX_MAGIC                     0x30524448      /* HDR0 */
++#define BELKIN_F7D3301_MAGIC          0x20100322
++#define BELKIN_F7D3302_MAGIC          0x20090928
++#define BELKIN_F7D4302_MAGIC          0x20101006
++#define BELKIN_F7DXXXX_QA_MAGIC       0x12345678
+ #define SQSH_MAGIC                    0x71736873      /* shsq */
+ 
+ struct trx_header {
+@@ -45,6 +48,15 @@ struct trx_header {
+       uint32_t offset[3];
+ } __packed;
+ 
++static bool is_trx_magic(uint32_t magic)
++{
++      return (magic == TRX_MAGIC) ||
++               (magic == BELKIN_F7DXXXX_QA_MAGIC) ||
++              (magic == BELKIN_F7D3301_MAGIC) ||
++              (magic == BELKIN_F7D3302_MAGIC) ||
++              (magic == BELKIN_F7D4302_MAGIC);
++}
++
+ static void bcm47xxpart_add_part(struct mtd_partition *part, char *name,
+                                u64 offset, uint32_t mask_flags)
+ {
+@@ -139,7 +150,7 @@ static int bcm47xxpart_parse(struct mtd_
+               }
+ 
+               /* TRX */
+-              if (buf[0x000 / 4] == TRX_MAGIC) {
++              if (is_trx_magic(buf[0x000 / 4])) {
+                       trx = (struct trx_header *)buf;
+ 
+                       trx_part = curr_part;
-- 
1.8.4.2
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to