summaryrefslogtreecommitdiffstats
path: root/master/jmm.patch
blob: 3fefe0947c1d368c698b25309a41662a01659013 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index 0fa260b..fbaee22 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -76,7 +76,8 @@ ramips_board_detect() {
 	*"BR-6475nD")
 		name="br-6475nd"
 		;;
-	*"BR-6478AC-v2")
+	*"BR-6478AC-v2"|\
+	*"BR-6478ACV2")
 		name="br-6478ac-v2"
 		;;
 	*"Broadway")
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index e3bea00..ba1d9fd 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -176,7 +176,8 @@ platform_check_image() {
 		}
 		return 0
 		;;
-	br-6475nd)
+	br-6475nd|\
+	br-6478ac-v2)
 		[ "$magic" != "43535953" ] && {
 			echo "Invalid image type."
 			return 1
diff --git a/target/linux/ramips/dts/BR-6478AC-V2.dts b/target/linux/ramips/dts/BR-6478AC-V2.dts
index ac870cc..ce1054f 100644
--- a/target/linux/ramips/dts/BR-6478AC-V2.dts
+++ b/target/linux/ramips/dts/BR-6478AC-V2.dts
@@ -56,15 +56,36 @@
 		};
 	};
 
+
+	        gpio_export {
+                compatible = "gpio-export";
+                #size-cells = <0>;
+                usb-power {
+                        gpio-export,name="usb-power";
+                        gpio-export,output=<0>;
+                        gpios = <&gpio2 5 0>;  // pin45
+                };
+		};
+
+	
+
+/*
 	usbphy: usbphy {
 		compatible = "mediatek,mt7620-usbphy";
 		#phy-cells = <1>;
 		resets = <&rstctrl 22 &rstctrl 25>;
 		reset-names = "host", "device";
 	};
+*/
 
 };
 
+
+&gpio2 {
+	status = "okay";
+};
+
+
 &spi0 {
 	status = "okay";
 
@@ -164,10 +185,11 @@
 	};
 };
 
-&gsw {
+/* &gsw {
 	mediatek,port4 = "gmac";
 	mediatek,mt7530 = <1>;
 };
+*/
 
 &wmac {
 	ralink,mtd-eeprom = <&factory 0>;
@@ -176,7 +198,7 @@
 &pcie {
 	status = "okay";
 
-	pcie0 {
+	pcie-bridge {
 		mt76@0,0 {
 			reg = <0x0000 0 0 0 0>;
 			device_type = "pci";
diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk
index 9454865..a0edfd8 100644
--- a/target/linux/ramips/image/mt7620.mk
+++ b/target/linux/ramips/image/mt7620.mk
@@ -2,11 +2,16 @@
 # MT7620A Profiles
 #
 
 define Build/tplink-header
 	$(STAGING_DIR_HOST)/bin/mktplinkfw2 -a 0x4 -V "ver. 2.0" -B $(1) \
 		-o $@.new -k $@  && mv $@.new $@
 endef
 
+
+define Build/edimax-header
+	$(STAGING_DIR_HOST)/bin/mkedimaximg -i $@ -o $@.new  -s CSYS $(1)  && mv $@.new $@
+endef
+
 define Build/pad-kernel-ex2700
 	cp $@ $@.tmp && dd if=/dev/zero bs=64 count=1 >> $@.tmp \
 		&& dd if=$@.tmp of=$@.new bs=64k conv=sync && truncate -s -64 $@.new \
@@ -417,19 +428,9 @@ TARGET_DEVICES += tiny-ac
 define Device/br-6478ac-v2
   DTS := BR-6478AC-V2
   DEVICE_TITLE := Edimax BR-6478AC-V2
-  BLOCKSIZE := 4k
-  IMAGES += factory.bin
+  BLOCKSIZE := 65536
   IMAGE_SIZE := 7616k
-  IMAGE/sysupgrade.bin := \
-	append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs | \
-	seama -m "dev=/dev/mtdblock/5" -m "type=firmware" | \
-	pad-rootfs | check-size $$$$(IMAGE_SIZE)
-  IMAGE/factory.bin := \
-	append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \
-	append-rootfs | pad-rootfs -x 64 | \
-	seama -m "dev=/dev/mtdblock/2" -m "type=firmware" | \
-	seama-seal -m "signature=wapn22_dlink.2013gui_dap1320b" | \
-	check-size $$$$(IMAGE_SIZE)
+  IMAGE/sysupgrade.bin := append-kernel | pad-offset $$$$(BLOCKSIZE) 20 | append-rootfs | pad-rootfs -x 20 | check-size $$$$(IMAGE_SIZE) | edimax-header -m RN68 -f 0x70000 -S  0x1100000
   DEVICE_PACKAGES := kmod-mt76
 endef
 TARGET_DEVICES += br-6478ac-v2
diff --git a/target/linux/ramips/patches-4.4/9999-em-br6478acv2.patch b/target/linux/ramips/patches-4.4/9999-em-br6478acv2.patch
new file mode 100644
index 0000000..59c7b5e
--- /dev/null
+++ b/target/linux/ramips/patches-4.4/9999-em-br6478acv2.patch
@@ -0,0 +1,108 @@
+--- a/drivers/mtd/mtdsplit/mtdsplit.c	2017-01-18 03:45:15.345921539 +0000
++++ b/drivers/mtd/mtdsplit/mtdsplit.c	2017-01-18 04:31:27.032704016 +0000
+@@ -95,6 +95,10 @@
+ 		if (type)
+ 			*type = MTDSPLIT_PART_TYPE_JFFS2;
+ 		return 0;
++	} else if (magic == 0x20031985) {
++		if (type)
++			*type = MTDSPLIT_PART_TYPE_JFFS2;
++		return 0;
+ 	} else if (be32_to_cpu(magic) == UBI_EC_MAGIC) {
+ 		if (type)
+ 			*type = MTDSPLIT_PART_TYPE_UBI;
+--- a/drivers/mtd/mtdsplit/mtdsplit_uimage.c	2017-01-13 11:33:11.517379487 +0000
++++ b/drivers/mtd/mtdsplit/mtdsplit_uimage.c	2017-01-18 04:22:42.188040972 +0000
+@@ -53,6 +53,14 @@
+ 	uint8_t		ih_name[IH_NMLEN];	/* Image Name		*/
+ };
+ 
++struct csys_header {
++	uint32_t	cs_magic;
++	uint32_t 	a;
++	uint32_t	b;
++	uint32_t	board_sig;
++	uint32_t 	len;
++};
++
+ static int
+ read_uimage_header(struct mtd_info *mtd, size_t offset, u_char *buf,
+ 		   size_t header_len)
+@@ -127,6 +135,7 @@
+ 		header = (struct uimage_header *)(buf + ret);
+ 
+ 		uimage_size = sizeof(*header) + be32_to_cpu(header->ih_size);
++		uimage_offset= offset + ret;
+ 		if ((offset + uimage_size) > master->size) {
+ 			pr_debug("uImage exceeds MTD device \"%s\"\n",
+ 				 master->name);
+@@ -141,9 +150,8 @@
+ 		goto err_free_buf;
+ 	}
+ 
+-	uimage_offset = offset;
+ 
+-	if (uimage_offset == 0) {
++	if (offset == 0) {
+ 		uimage_part = 0;
+ 		rf_part = 1;
+ 
+@@ -181,8 +189,8 @@
+ 	}
+ 
+ 	parts[uimage_part].name = KERNEL_PART_NAME;
+-	parts[uimage_part].offset = uimage_offset;
+-	parts[uimage_part].size = uimage_size;
++	parts[uimage_part].offset = offset;
++	parts[uimage_part].size = uimage_size+uimage_offset;
+ 
+ 	if (type == MTDSPLIT_PART_TYPE_UBI)
+ 		parts[rf_part].name = UBI_PART_NAME;
+@@ -305,32 +313,41 @@
+  * Edimax
+  **************************************************/
+ 
+-#define FW_EDIMAX_OFFSET	20
+ #define FW_MAGIC_EDIMAX		0x43535953
+ 
+ static ssize_t uimage_find_edimax(u_char *buf, size_t len)
+ {
+ 	struct uimage_header *header;
++	struct csys_header *cheader;
+ 
+-	if (len < FW_EDIMAX_OFFSET + sizeof(*header)) {
++	if (len < sizeof(*cheader) + sizeof(*header)) {
+ 		pr_err("Buffer too small for checking Edimax header\n");
+ 		return -ENOSPC;
+ 	}
+ 
+-	header = (struct uimage_header *)(buf + FW_EDIMAX_OFFSET);
++	cheader = (struct csys_header *)buf;
+ 
+-	switch be32_to_cpu(header->ih_magic) {
++	switch be32_to_cpu(cheader->cs_magic) {
+ 	case FW_MAGIC_EDIMAX:
+ 		break;
+ 	default:
+ 		return -EINVAL;
+ 	}
+ 
++	header = (struct uimage_header *)(buf + sizeof(*cheader));
++
++	switch be32_to_cpu(header->ih_magic) {
++	case IH_MAGIC:
++		break;
++	default:
++		return -EINVAL;
++	}
++
+ 	if (header->ih_os != IH_OS_LINUX ||
+-	    header->ih_type != IH_TYPE_FILESYSTEM)
++	    header->ih_type != IH_TYPE_KERNEL)
+ 		return -EINVAL;
+ 
+-	return FW_EDIMAX_OFFSET;
++	return sizeof(*cheader);
+ }
+ 
+ static int