-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathopenwrt_hame_mpr-a1.patch
298 lines (295 loc) · 10.6 KB
/
openwrt_hame_mpr-a1.patch
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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
Index: target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig
===================================================================
--- target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig (revision 35629)
+++ target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig (working copy)
@@ -129,6 +129,11 @@
select RALINK_DEV_GPIO_BUTTONS
select RALINK_DEV_GPIO_LEDS
+config RT305X_MACH_MPR_A1
+ bool "HAME MPR-A1 board support"
+ select RALINK_DEV_GPIO_BUTTONS
+ select RALINK_DEV_GPIO_LEDS
+
config RT305X_MACH_WR512_3GN
bool "SH-WR512NU/WS-WR512N1-like 3GN router"
select RALINK_DEV_GPIO_BUTTONS
Index: target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile
===================================================================
--- target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile (revision 35629)
+++ target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile (working copy)
@@ -31,6 +31,7 @@
obj-$(CONFIG_RT305X_MACH_FREESTATION5) += mach-freestation5.o
obj-$(CONFIG_RT305X_MACH_HW550_3G) += mach-hw550-3g.o
obj-$(CONFIG_RT305X_MACH_MOFI3500_3GN) += mach-mofi3500-3gn.o
+obj-$(CONFIG_RT305X_MACH_MPR_A1) += mach-mpr-a1.o
obj-$(CONFIG_RT305X_MACH_NBG_419N) += mach-nbg-419n.o
obj-$(CONFIG_RT305X_MACH_NW718) += mach-nw718.o
obj-$(CONFIG_RT305X_MACH_OMNI_EMB) += mach-omni-emb.o
Index: target/linux/ramips/files/arch/mips/ralink/rt305x/mach-mpr-a1.c
===================================================================
--- target/linux/ramips/files/arch/mips/ralink/rt305x/mach-mpr-a1.c (revision 0)
+++ target/linux/ramips/files/arch/mips/ralink/rt305x/mach-mpr-a1.c (working copy)
@@ -0,0 +1,108 @@
+/*
+ * HAME MPR-A1 board support by Michel Stempin <[email protected]>
+ * Based on previous work by arpunk, arteq, Heffer & p1vo from OpenWrt forum.
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/flash.h>
+#include <linux/gpio.h>
+
+#include <asm/mach-ralink/machine.h>
+#include <asm/mach-ralink/dev-gpio-buttons.h>
+#include <asm/mach-ralink/dev-gpio-leds.h>
+#include <asm/mach-ralink/rt305x.h>
+#include <asm/mach-ralink/rt305x_regs.h>
+
+#include "devices.h"
+
+#define MPR_A1_GPIO_BUTTON_RESET 0
+#define MPR_A1_GPIO_USB_POWER 7
+#define MPR_A1_GPIO_ROOT_HUB_POWER 12
+#define MPR_A1_GPIO_LED_POWER 17
+#define MPR_A1_GPIO_LED_SYSTEM 20
+
+#define MPR_A1_KEYS_POLL_INTERVAL 20
+#define MPR_A1_KEYS_DEBOUNCE_INTERVAL (3 * MPR_A1_KEYS_POLL_INTERVAL)
+
+const struct flash_platform_data mpr_a1_flash = {
+ .type = "pm25lq032",
+};
+
+struct spi_board_info mpr_a1_spi_slave_info[] __initdata = {
+ {
+ .modalias = "m25p80",
+ .platform_data = &mpr_a1_flash,
+ .irq = -1,
+ .max_speed_hz = 10000000,
+ .bus_num = 0,
+ .chip_select = 0,
+ }
+};
+
+static struct gpio_led mpr_a1_leds_gpio[] __initdata = {
+ {
+ .name = "mpr-a1:blue:system",
+ .gpio = MPR_A1_GPIO_LED_SYSTEM,
+ .active_low = 1,
+ },
+ {
+ .name = "mpr-a1:red:power",
+ .gpio = MPR_A1_GPIO_LED_POWER,
+ .active_low = 1,
+ .default_state = LEDS_GPIO_DEFSTATE_ON,
+ }
+};
+
+static struct gpio_keys_button mpr_a1_gpio_buttons[] __initdata = {
+ {
+ .desc = "reset",
+ .type = EV_KEY,
+ .code = KEY_RESTART,
+ .debounce_interval = MPR_A1_KEYS_DEBOUNCE_INTERVAL,
+ .gpio = MPR_A1_GPIO_BUTTON_RESET,
+ .active_low = 1,
+ }
+};
+
+static void __init mpr_a1_init(void)
+{
+ // JTAG is required for LED control
+ rt305x_gpio_init((RT305X_GPIO_MODE_GPIO <<
+ RT305X_GPIO_MODE_UART0_SHIFT) |
+ RT305X_GPIO_MODE_JTAG);
+
+ rt305x_register_spi(mpr_a1_spi_slave_info,
+ ARRAY_SIZE(mpr_a1_spi_slave_info));
+
+ ramips_register_gpio_leds(-1, ARRAY_SIZE(mpr_a1_leds_gpio),
+ mpr_a1_leds_gpio);
+
+ ramips_register_gpio_buttons(-1, MPR_A1_KEYS_POLL_INTERVAL,
+ ARRAY_SIZE(mpr_a1_gpio_buttons),
+ mpr_a1_gpio_buttons);
+
+ rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW;
+ rt305x_register_ethernet();
+
+ rt305x_register_wifi();
+
+ rt305x_register_wdt();
+
+ gpio_request_one(MPR_A1_GPIO_USB_POWER,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "USB power");
+ gpio_request_one(MPR_A1_GPIO_ROOT_HUB_POWER,
+ GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+ "USB root hub power");
+ rt305x_register_usb();
+}
+
+MIPS_MACHINE(RAMIPS_MACH_MPR_A1, "MPR-A1", "HAME MPR-A1",
+ mpr_a1_init);
Index: target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h
===================================================================
--- target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h (revision 35629)
+++ target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h (working copy)
@@ -84,4 +84,5 @@
/* RT5350 based machines */
RAMIPS_MACH_AIR3GII, /* AirLive Air3GII */
+ RAMIPS_MACH_MPR_A1 /* HAME MPR-A1 */
};
Index: target/linux/ramips/rt305x/profiles/hame.mk
===================================================================
--- target/linux/ramips/rt305x/profiles/hame.mk (revision 0)
+++ target/linux/ramips/rt305x/profiles/hame.mk (working copy)
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2012 Michel Stempin <[email protected]>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/MPR_A1
+ NAME:=HAME MPR-A1
+ PACKAGES:=kmod-usb-core kmod-usb2 kmod-ledtrig-netdev kmod-ledtrig-timer
+endef
+
+define Profile/MPR_A1/Description
+ Package set for HAME MPR-A1 board
+endef
+
+$(eval $(call Profile,MPR_A1))
Index: target/linux/ramips/rt305x/config-3.7
===================================================================
--- target/linux/ramips/rt305x/config-3.7 (revision 35629)
+++ target/linux/ramips/rt305x/config-3.7 (working copy)
@@ -121,6 +121,7 @@
CONFIG_RT305X_MACH_FREESTATION5=y
CONFIG_RT305X_MACH_HW550_3G=y
CONFIG_RT305X_MACH_MOFI3500_3GN=y
+CONFIG_RT305X_MACH_MPR_A1=y
CONFIG_RT305X_MACH_MZKW300NH2=y
CONFIG_RT305X_MACH_NBG_419N=y
CONFIG_RT305X_MACH_NW718=y
Index: target/linux/ramips/base-files/lib/preinit/06_set_iface_mac
===================================================================
--- target/linux/ramips/base-files/lib/preinit/06_set_iface_mac (revision 35629)
+++ target/linux/ramips/base-files/lib/preinit/06_set_iface_mac (working copy)
@@ -22,6 +22,7 @@
dir-620-a1 |\
esr-9753 |\
freestation5 |\
+ mpr-a1 | \
nw718 |\
psr-680w |\
rt-n56u |\
Index: target/linux/ramips/base-files/lib/ramips.sh
===================================================================
--- target/linux/ramips/base-files/lib/ramips.sh (revision 35629)
+++ target/linux/ramips/base-files/lib/ramips.sh (working copy)
@@ -94,6 +94,9 @@
*"MoFi Network MOFI3500-3GN")
name="mofi3500-3gn"
;;
+ *"MPR-A1")
+ name="mpr-a1"
+ ;;
*"NBG-419N")
name="nbg-419n"
;;
Index: target/linux/ramips/base-files/lib/upgrade/platform.sh
===================================================================
--- target/linux/ramips/base-files/lib/upgrade/platform.sh (revision 35629)
+++ target/linux/ramips/base-files/lib/upgrade/platform.sh (working copy)
@@ -36,6 +36,7 @@
freestation5 | \
hw550-3g | \
mofi3500-3gn | \
+ mpr-a1 | \
mzk-w300nh2 | \
nbg-419n | \
nw718 | \
Index: target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
===================================================================
--- target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom (revision 35629)
+++ target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom (working copy)
@@ -71,6 +71,7 @@
freestation5 | \
hw550-3g | \
mofi3500-3gn | \
+ mpr-a1 | \
pwh2004 | \
nbg-419n | \
nw718 | \
Index: target/linux/ramips/base-files/etc/uci-defaults/01_leds
===================================================================
--- target/linux/ramips/base-files/etc/uci-defaults/01_leds (revision 35629)
+++ target/linux/ramips/base-files/etc/uci-defaults/01_leds (working copy)
@@ -81,6 +81,9 @@
mzk-w300nh2)
set_wifi_led "mzkw300nh2:amber:wlan"
;;
+ mpr-a1)
+ set_wifi_led "mpr-a1:blue:system"
+ ;;
nw718)
set_usb_led "nw718:amber:usb"
;;
Index: target/linux/ramips/base-files/etc/uci-defaults/02_network
===================================================================
--- target/linux/ramips/base-files/etc/uci-defaults/02_network (revision 35629)
+++ target/linux/ramips/base-files/etc/uci-defaults/02_network (working copy)
@@ -153,6 +153,7 @@
br6425 | \
broadway | \
f5d8235-v1 | \
+ mpr-a1 | \
mzk-w300nh2 | \
nw718 | \
psr-680w | \
Index: target/linux/ramips/base-files/etc/diag.sh
===================================================================
--- target/linux/ramips/base-files/etc/diag.sh (revision 35629)
+++ target/linux/ramips/base-files/etc/diag.sh (working copy)
@@ -73,6 +73,9 @@
mofi3500-3gn)
status_led="mofi3500-3gn:green:status"
;;
+ mpr-a1)
+ status_led="mpr-a1:red:power"
+ ;;
nbg-419n)
status_led="nbg-419n:green:power"
;;
Index: target/linux/ramips/image/Makefile
===================================================================
--- target/linux/ramips/image/Makefile (revision 35629)
+++ target/linux/ramips/image/Makefile (working copy)
@@ -555,6 +555,10 @@
$(call Image/Build/Template/$(fs_squash)/$(1),GENERIC_8M,mofi3500-3gn,MOFI3500-3GN,ttyS1,57600,phys)
endef
+define Image/Build/Profile/MPR_A1
+ $(call Image/Build/Template/$(fs_squash)/$(1),GENERIC_4M,mpr-a1,MPR-A1,ttyS1,57600,spi)
+endef
+
define Image/Build/Profile/NBG419N
$(call Image/Build/Template/$(fs_squash)/$(1),GENERIC_4M,nbg-419n,NBG-419N,ttyS1,57600,phys)
endef
@@ -669,6 +673,7 @@
$(call Image/Build/Profile/FREESTATION5,$(1))
$(call Image/Build/Profile/HW5503G,$(1))
$(call Image/Build/Profile/MOFI35003GN,$(1))
+ $(call Image/Build/Profile/MPR_A1,$(1))
$(call Image/Build/Profile/MZKW3000NH2,$(1))
$(call Image/Build/Profile/NBG419N,$(1))
$(call Image/Build/Profile/NW718,$(1))