ramips: add support for Buffalo WCR-1166DS
[openwrt/openwrt.git] / target / linux / ramips / patches-4.4 / 0400-mtd-mtdsplit-add-support-for-custom-trx-magic-for-Buffalo-WCR-1166DS.patch
1 --- a/drivers/mtd/mtdsplit/mtdsplit_trx.c
2 +++ b/drivers/mtd/mtdsplit/mtdsplit_trx.c
3 @@ -13,6 +13,7 @@
4 #include <linux/module.h>
5 #include <linux/init.h>
6 #include <linux/kernel.h>
7 +#include <linux/of.h>
8 #include <linux/slab.h>
9 #include <linux/mtd/mtd.h>
10 #include <linux/mtd/partitions.h>
11 @@ -20,7 +21,8 @@
12
13 #include "mtdsplit.h"
14
15 -#define TRX_MAGIC 0x30524448 /* "HDR0" */
16 +#define TRX_MAGIC 0x30524448 /* "HDR0" */
17 +#define TRX_MAGIC_BUFFALO 0x746f435c
18
19 struct trx_header {
20 __le32 magic;
21 @@ -82,7 +84,8 @@ mtdsplit_parse_trx(struct mtd_info *mast
22 if (ret)
23 continue;
24
25 - if (hdr.magic != cpu_to_le32(TRX_MAGIC)) {
26 + if (hdr.magic != cpu_to_le32(TRX_MAGIC) &&
27 + !(of_machine_is_compatible("buffalo,wcr-1166ds") && hdr.magic == cpu_to_le32(TRX_MAGIC_BUFFALO))) {
28 pr_debug("no valid trx header found in \"%s\" at offset %llx\n",
29 master->name, (unsigned long long) offset);
30 continue;