-
Notifications
You must be signed in to change notification settings - Fork 8
/
zsun-sd100.firmware.ath79[v22.03.4].patch
249 lines (244 loc) · 5.82 KB
/
zsun-sd100.firmware.ath79[v22.03.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
237
238
239
240
241
242
243
244
245
246
247
248
249
diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate
index 3836281..1e42ac0 100755
--- a/package/base-files/files/bin/config_generate
+++ b/package/base-files/files/bin/config_generate
@@ -101,8 +101,6 @@ generate_network() {
json_select ..
json_select ..
- [ -n "$device" -o -n "$ports" ] || return
-
# Force bridge for "lan" as it may have other devices (e.g. wireless)
# bridged
[ "$1" = "lan" -a -z "$ports" ] && {
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 49d2a3b..ea4b15f 100644
--- a/package/base-files/files/etc/board.d/99-default_network
+++ b/package/base-files/files/etc/board.d/99-default_network
@@ -8,7 +8,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/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network
index 8f9516b..91f7e91 100644
--- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
@@ -514,6 +514,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/generic/base-files/etc/uci-defaults/95_enable-wifi b/target/linux/ath79/generic/base-files/etc/uci-defaults/95_enable-wifi
new file mode 100644
index 0000000..853b7cf
--- /dev/null
+++ b/target/linux/ath79/generic/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/generic/base-files/etc/rc.button/BTN_0 b/target/linux/ath79/generic/base-files/etc/rc.button/BTN_0
new file mode 100755
index 0000000..ae74e1f
--- /dev/null
+++ b/target/linux/ath79/generic/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..f5084b4
--- /dev/null
+++ b/target/linux/ath79/dts/ar9331_zsun_sd100.dts
@@ -0,0 +1,148 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "ar9331.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+ 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";
+
+ flash@0 {
+ compatible = "jedec,spi-nor";
+ spi-max-frequency = <50000000>;
+ 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;
+ };
+
+ partition@ff0000 {
+ label = "art";
+ reg = <0xff0000 0x010000>;
+ read-only;
+
+ compatible = "nvmem-cells";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ cal_art_1000: cal@1000 {
+ reg = <0x1000 0x440>;
+ };
+
+ macaddr_art_1002: macaddr@1002 {
+ reg = <0x1002 0x6>;
+ };
+ };
+ };
+ };
+};
+
+&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";
+
+ nvmem-cells = <&cal_art_1000>, <&macaddr_art_1002>;
+ nvmem-cell-names = "calibration", "mac-address";
+};
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index 31d296f..99d00d3 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -2692,6 +2692,15 @@ define Device/zbtlink_zbt-wd323
endef
TARGET_DEVICES += zbtlink_zbt-wd323
+define Device/zsun_sd100
+ SOC := ar9331
+ DEVICE_VENDOR := Zsun
+ DEVICE_MODEL := SD100
+ DEVICE_PACKAGES := kmod-usb2 kmod-usb-storage
+ IMAGE_SIZE := 12032k
+endef
+TARGET_DEVICES += zsun_sd100
+
define Device/zyxel_nbg6616
SOC := qca9557
DEVICE_VENDOR := ZyXEL