-
Notifications
You must be signed in to change notification settings - Fork 8
/
zsun-sd100.firmware.ath79[v19.07.4].patch
236 lines (232 loc) · 5.46 KB
/
zsun-sd100.firmware.ath79[v19.07.4].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
diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate
index 3bf48d7..a2213fe 100755
--- a/package/base-files/files/bin/config_generate
+++ b/package/base-files/files/bin/config_generate
@@ -70,8 +70,6 @@ generate_network() {
json_select ..
json_select ..
- [ -n "$ifname" ] || return
-
# force bridge for multi-interface devices (and lan)
case "$1:$ifname" in
*\ * | lan:*) type="bridge" ;;
diff --git a/package/base-files/files/etc/board.d/99-default_network b/package/base-files/files/etc/board.d/99-default_network
index d70aa35..a091f3f 100755
--- a/package/base-files/files/etc/board.d/99-default_network
+++ b/package/base-files/files/etc/board.d/99-default_network
@@ -9,7 +9,8 @@ board_config_update
json_is_a network object && exit 0
-ucidef_set_interface_lan 'eth0'
+ucidef_set_interface 'lan'
+[ -d /sys/class/net/eth0 ] && ucidef_set_interface_lan 'eth0'
[ -d /sys/class/net/eth1 ] && ucidef_set_interface_wan 'eth1'
board_config_flush
diff --git a/target/linux/ath79/base-files/etc/board.d/02_network b/target/linux/ath79/base-files/etc/board.d/02_network
index 5dda551..ad757fc 100755
--- a/target/linux/ath79/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/base-files/etc/board.d/02_network
@@ -286,6 +286,8 @@ ath79_setup_interfaces()
ucidef_add_switch "switch0" \
"0@eth0" "3:lan:1" "4:lan:2"
;;
+ zsun,sd100)
+ ;;
*)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
;;
diff --git a/target/linux/ath79/base-files/etc/uci-defaults/95_enable-wifi b/target/linux/ath79/base-files/etc/uci-defaults/95_enable-wifi
new file mode 100644
index 0000000..853b7cf
--- /dev/null
+++ b/target/linux/ath79/base-files/etc/uci-defaults/95_enable-wifi
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+[ ! -z "$(uci -q get network.lan.ifname)" ] && exit 0
+
+uci set wireless.@wifi-device[0].disabled=0
+uci commit wireless
+
+exit 0
diff --git a/target/linux/ath79/base-files/etc/rc.button/BTN_0 b/target/linux/ath79/base-files/etc/rc.button/BTN_0
new file mode 100755
index 0000000..ae74e1f
--- /dev/null
+++ b/target/linux/ath79/base-files/etc/rc.button/BTN_0
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+case "$ACTION" in
+pressed)
+ logger -t sdcard_event "SD Card inserted"
+ echo 1 > /sys/class/gpio/sdreader_reset/value
+ echo 0 > /sys/class/gpio/sdreader_reset/value
+ ;;
+released)
+ logger -t sdcard_event "SD Card removed"
+ echo 1 > /sys/class/gpio/sdreader_reset/value
+ ;;
+esac
+
+return 0
diff --git a/target/linux/ath79/dts/ar9331_zsun_sd100.dts b/target/linux/ath79/dts/ar9331_zsun_sd100.dts
new file mode 100644
index 0000000..0911fc4
--- /dev/null
+++ b/target/linux/ath79/dts/ar9331_zsun_sd100.dts
@@ -0,0 +1,139 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+#include "ar9331.dtsi"
+
+/ {
+ model = "Zsun SD100";
+ compatible = "zsun,sd100", "qca,ar9331";
+
+ aliases {
+ led-boot = &led_status;
+ led-failsafe = &led_status;
+ led-running = &led_status;
+ led-upgrade = &led_status;
+ serial0 = &uart;
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ led_status: status {
+ label = "sd100:green:status";
+ gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
+ default-state = "on";
+ };
+ };
+
+ keys {
+ compatible = "gpio-keys";
+
+ sdcard_event {
+ label = "sdcard_event";
+ linux,code = <BTN_0>;
+ gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ gpio-export {
+ compatible = "gpio-export";
+
+ sdreader_reset {
+ gpio-export,name = "sdreader_reset";
+ gpio-export,output = <1>;
+ gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
+ };
+
+ sdreader_switch {
+ gpio-export,name = "sdreader_switch";
+ gpio-export,output = <0>;
+ gpios = <&gpio 21 GPIO_ACTIVE_HIGH>;
+ };
+ };
+};
+
+&spi {
+ status = "okay";
+
+ num-chipselects = <0>;
+
+ flash@0 {
+ compatible = "jedec,spi-nor";
+ spi-max-frequency = <104000000>;
+ reg = <0>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "u-boot";
+ reg = <0x000000 0x010000>;
+ read-only;
+ };
+
+ partition@10000 {
+ label = "u-boot-env";
+ reg = <0x010000 0x010000>;
+ read-only;
+ };
+
+ partition@20000 {
+ compatible = "denx,uimage";
+ label = "firmware";
+ reg = <0x020000 0xbc0000>;
+ };
+
+ partition@be0000 {
+ label = "recovery";
+ reg = <0xbe0000 0x400000>;
+ read-only;
+ };
+
+ partition@fe0000 {
+ label = "nvram";
+ reg = <0xfe0000 0x010000>;
+ read-only;
+ };
+
+ art: partition@ff0000 {
+ label = "art";
+ reg = <0xff0000 0x010000>;
+ read-only;
+ };
+ };
+ };
+};
+
+&uart {
+ status = "okay";
+};
+
+&gpio {
+ status = "okay";
+};
+
+&usb {
+ status = "okay";
+
+ compatible = "generic-ehci";
+ reg = <0x1b000000 0x1000>;
+
+ has-transaction-translator;
+ caps-offset = <0x100>;
+};
+
+&usb_phy {
+ status = "okay";
+};
+
+&wmac {
+ status = "okay";
+
+ mtd-cal-data = <&art 0x1000>;
+ mtd-mac-address = <&art 0x1002>;
+};
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index 55053be..4f4a36a 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -751,3 +751,11 @@ define Device/zbtlink_zbt-wd323
kmod-usb-serial kmod-usb-serial-cp210x uqmi
endef
TARGET_DEVICES += zbtlink_zbt-wd323
+
+define Device/zsun_sd100
+ ATH_SOC := ar9331
+ DEVICE_TITLE := Zsun SD100
+ DEVICE_PACKAGES := kmod-usb2 kmod-usb-storage
+ IMAGE_SIZE := 12032k
+endef
+TARGET_DEVICES += zsun_sd100