aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm53xx/patches-4.9/900-mtd-bcm47xxpart-add-device-specific-workarounds.patch
blob: b4a25a39d0922277b63ab8c221ac67565a5e83ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
Subject: [PATCH] mtd: bcm47xxpart: add device specific workarounds
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---

--- a/drivers/mtd/bcm47xxpart.c
+++ b/drivers/mtd/bcm47xxpart.c
@@ -15,6 +15,7 @@
 #include <linux/slab.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
+#include <linux/of.h>
 
 #include <uapi/linux/magic.h>
 
@@ -134,6 +135,36 @@ static int bcm47xxpart_parse(struct mtd_
 			break;
 		}
 
+		/*
+		 * Device specific workarounds (hacks). We should use DT to
+		 * define partitions but we need a working TRX firmware splitter
+		 * first.
+		 */
+		if (of_machine_is_compatible("asus,rt-ac87u") && offset == 0x7ec0000) {
+			/*
+			 * "asus" partition uses JFFS2 which we don't detect and
+			 * we don't want to as this could affect other devices.
+			 */
+			bcm47xxpart_add_part(&parts[curr_part++], "asus", offset, MTD_WRITEABLE);
+			continue;
+		} else  if (of_machine_is_compatible("tplink,archer-c5-v2") && offset == 0xe40000) {
+			/*
+			 * There is a whole set of partitions (not even listed
+			 * by original firmware): "default-mac", "pin",
+			 * "partition-table", etc.
+			 */
+			bcm47xxpart_add_part(&parts[curr_part++], "tplink", offset, MTD_WRITEABLE);
+			continue;
+		} else  if (of_machine_is_compatible("tplink,archer-c9-v1") && offset == 0xe40000) {
+			/*
+			 * There is a whole set of partitions (not even listed
+			 * by original firmware): "default-mac", "pin",
+			 * "partition-table", etc.
+			 */
+			bcm47xxpart_add_part(&parts[curr_part++], "tplink", offset, MTD_WRITEABLE);
+			continue;
+		}
+
 		/* Read beginning of the block */
 		err = mtd_read(master, offset, BCM47XXPART_BYTES_TO_READ,
 			       &bytes_read, (uint8_t *)buf);
span> + compatible = "gpio-leds"; + + 5ghz { + label = "bcm53xx:blue:5ghz"; + gpios = <&chipcommon 13 GPIO_ACTIVE_LOW>; + linux,default-trigger = "none"; + }; + + 2ghz { + label = "bcm53xx:blue:2ghz"; + gpios = <&chipcommon 14 GPIO_ACTIVE_LOW>; + linux,default-trigger = "none"; + }; + + status { + label = "bcm53xx:green:status"; + gpios = <&chipcommon 15 GPIO_ACTIVE_LOW>; + linux,default-trigger = "timer"; + }; + }; + + gpio-keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + + restart { + label = "Reset"; + linux,code = <KEY_RESTART>; + gpios = <&chipcommon 11 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&spi_nor { + status = "okay"; +};