886b22a1ebc263db0641208daccbeaeec18b0038
[openwrt/openwrt.git] / target / linux / bcm53xx / patches-3.18 / 901-mtd-bcm47xxpart-workaround-for-Asus-RT-AC87U-asus-pa.patch
1 From 21500872c1dba33848ddcf6bea97d58772675d36 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
3 Date: Sun, 17 May 2015 14:00:52 +0200
4 Subject: [PATCH] mtd: bcm47xxpart: workaround for Asus RT-AC87U "asus"
5 partition
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
11 ---
12 drivers/mtd/bcm47xxpart.c | 12 ++++++++++++
13 1 file changed, 12 insertions(+)
14
15 diff --git a/drivers/mtd/bcm47xxpart.c b/drivers/mtd/bcm47xxpart.c
16 index 34314f9..d08d329 100644
17 --- a/drivers/mtd/bcm47xxpart.c
18 +++ b/drivers/mtd/bcm47xxpart.c
19 @@ -14,6 +14,7 @@
20 #include <linux/slab.h>
21 #include <linux/mtd/mtd.h>
22 #include <linux/mtd/partitions.h>
23 +#include <linux/of.h>
24
25 #include <uapi/linux/magic.h>
26
27 @@ -135,6 +136,17 @@ static int bcm47xxpart_parse(struct mtd_info *master,
28 break;
29 }
30
31 + /*
32 + * Ugly workaround for Asus RT-AC87U and its "asus" partition.
33 + * It uses JFFS2 which we don't (want to) detect. We should
34 + * probably use DT to define partitions but we need a working
35 + * TRX firmware splitter first.
36 + */
37 + if (of_machine_is_compatible("asus,rt-ac87u") && offset == 0x7ec0000) {
38 + bcm47xxpart_add_part(&parts[curr_part++], "asus", offset, MTD_WRITEABLE);
39 + continue;
40 + }
41 +
42 /* Read beginning of the block */
43 if (mtd_read(master, offset, BCM47XXPART_BYTES_TO_READ,
44 &bytes_read, (uint8_t *)buf) < 0) {
45 --
46 1.8.4.5
47