Skip to content

Instantly share code, notes, and snippets.

@libnumafly
Last active March 2, 2024 12:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save libnumafly/aab232d6ad46eb2d911ca77f5f6f6617 to your computer and use it in GitHub Desktop.
Save libnumafly/aab232d6ad46eb2d911ca77f5f6f6617 to your computer and use it in GitHub Desktop.
diff --git a/feeds.conf b/feeds.conf
new file mode 100644
index 00000000..7dca392f
--- /dev/null
+++ b/feeds.conf
@@ -0,0 +1,4 @@
+src-git packages https://github.com/openwrt/packages.git^8e3a1824645f5e73ec44c897ac0755c53fb4a1f8
+src-git luci https://github.com/openwrt/luci.git^7739e9f5b03b830f51d53c384be4baef95054cb3
+src-git routing https://github.com/openwrt/routing.git^83ef3784a9092cfd0a900cc28e2ed4e13671d667
+src-git telephony https://github.com/openwrt/telephony.git^9746ae8f964e18f04b64fbe1956366954ff223f8
diff --git a/target/linux/ath79/dts/qca9557_elecom_wab-s1167-ps.dts b/target/linux/ath79/dts/qca9557_elecom_wab-s1167-ps.dts
new file mode 100644
index 00000000..facead97
--- /dev/null
+++ b/target/linux/ath79/dts/qca9557_elecom_wab-s1167-ps.dts
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "qca955x_elecom_wab.dtsi"
+
+/ {
+ compatible = "elecom,wab-s1167-ps", "qca,qca9557";
+ model = "ELECOM WAB-S1167-PS";
+};
diff --git a/target/linux/ath79/dts/qca9557_elecom_wab-s600-ps.dts b/target/linux/ath79/dts/qca9557_elecom_wab-s600-ps.dts
new file mode 100644
index 00000000..8d4b1d3a
--- /dev/null
+++ b/target/linux/ath79/dts/qca9557_elecom_wab-s600-ps.dts
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "qca955x_elecom_wab.dtsi"
+
+/ {
+ compatible = "elecom,wab-s600-ps", "qca,qca9557";
+ model = "ELECOM WAB-S600-PS";
+};
diff --git a/target/linux/ath79/dts/qca9558_elecom_wab-i1750-ps.dts b/target/linux/ath79/dts/qca9558_elecom_wab-i1750-ps.dts
new file mode 100644
index 00000000..6f157cf9
--- /dev/null
+++ b/target/linux/ath79/dts/qca9558_elecom_wab-i1750-ps.dts
@@ -0,0 +1,69 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "qca955x_elecom_wab.dtsi"
+
+/ {
+ compatible = "elecom,wab-i1750-ps", "qca,qca9558";
+ model = "ELECOM WAB-I1750-PS";
+
+ ahb {
+ apb {
+ /* "SERIAL" port (RJ-45) on the case */
+ uart1: uart@18500000 {
+ compatible = "qca,ar9330-uart";
+ reg = <0x18500000 0x14>;
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&pmx_uart1_in_pins &pmx_uart1_out_pins
+ &jtag_disable_pins>;
+
+ interrupts = <6>;
+ interrupt-parent = <&miscintc>;
+
+ clocks = <&pll ATH79_CLK_UART1>;
+ clock-names = "uart";
+
+ /* QCA955x HS UART is not supported */
+ status = "disabled";
+ };
+ };
+ };
+};
+
+&gpio {
+ uart1-out {
+ gpio-hog;
+ gpios = <0 GPIO_ACTIVE_HIGH>, /* UART1_TD */
+ <2 GPIO_ACTIVE_HIGH>; /* UART1_RTS */
+ output-low;
+ };
+
+ uart1-in {
+ gpio-hog;
+ gpios = <1 GPIO_ACTIVE_HIGH>, /* UART1_RD */
+ <3 GPIO_ACTIVE_HIGH>; /* UART1_CTS */
+ input;
+ };
+};
+
+&pinmux {
+ pmx_uart1_out_pins: uart1-out-pins {
+ /*
+ * mux as uart1 output
+ *
+ * GPIO0: UART1_TD (sel:18)
+ * GPIO2: UART1_RTS (sel:19)
+ */
+ pinctrl-single,bits = <0x0 0x130012 0xff00ff>;
+ };
+
+ pmx_uart1_in_pins: uart1-in-pins {
+ /*
+ * mux as uart1 input
+ *
+ * GPIO1: UART1_RD
+ * GPIO3: UART1_CTS
+ */
+ pinctrl-single,bits = <0x3c 0x3010000 0xffff0000>;
+ };
+};
diff --git a/target/linux/ath79/dts/qca955x_elecom_wab.dtsi b/target/linux/ath79/dts/qca955x_elecom_wab.dtsi
new file mode 100644
index 00000000..f94f5824
--- /dev/null
+++ b/target/linux/ath79/dts/qca955x_elecom_wab.dtsi
@@ -0,0 +1,261 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "qca955x.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+
+/ {
+ aliases {
+ led-boot = &led_status;
+ led-failsafe = &led_status;
+ led-upgrade = &led_status;
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ led-0 {
+ gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+ color = <LED_COLOR_ID_GREEN>;
+ function = LED_FUNCTION_WLAN;
+ function-enumerator = <24>;
+ linux,default-trigger = "phy1tpt";
+ };
+
+ led_status: led-1 {
+ gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
+ color = <LED_COLOR_ID_RED>;
+ function = LED_FUNCTION_STATUS;
+ };
+
+ led-2 {
+ gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+ color = <LED_COLOR_ID_GREEN>;
+ function = LED_FUNCTION_USB;
+ trigger-sources = <&usb_port1>;
+ linux,default-trigger = "usbport";
+ };
+ };
+
+ keys {
+ compatible = "gpio-keys";
+
+ button-wps {
+ label = "wps";
+ gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_WPS_BUTTON>;
+ debounce-interval = <60>;
+ };
+
+ button-reset {
+ label = "reset";
+ gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_RESTART>;
+ debounce-interval = <60>;
+ };
+
+ button-eject {
+ label = "eject";
+ gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_EJECTCD>;
+ debounce-interval = <60>;
+ };
+ };
+
+ beeper {
+ compatible = "gpio-beeper";
+ gpios = <&gpio 4 GPIO_ACTIVE_HIGH>;
+ };
+
+ reg_usb_vbus: regulator {
+ compatible = "regulator-fixed";
+ regulator-name = "usb-vbus";
+ regulator-min-microvolt = <5000000>;
+ regulator-max-microvolt = <5000000>;
+ gpio = <&gpio 11 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ regulator-always-on;
+ };
+
+ watchdog {
+ compatible = "linux,wdt-gpio";
+ gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+ hw_algo = "toggle";
+ hw_margin_ms = <300>;
+ always-running;
+ };
+};
+
+&mdio0 {
+ status = "okay";
+
+ ethphy4: ethernet-phy@4 {
+ compatible = "ethernet-phy-id004d,d072",
+ "ethernet-phy-ieee802.3-c22";
+ reg = <0x4>;
+ eee-broken-100tx;
+ eee-broken-1000t;
+ };
+};
+
+&eth0 {
+ status = "okay";
+
+ phy-handle = <&ethphy4>;
+ phy-mode = "rgmii-rxid";
+ pll-data = <0xae000000 0x80000101 0x80001313>;
+
+ gmac-config {
+ device = <&gmac>;
+
+ rxdv-delay = <3>;
+ rxd-delay = <3>;
+ txen-delay = <0>;
+ txd-delay = <0>;
+ rgmii-enabled = <1>;
+ };
+};
+
+&mdio1 {
+ status = "okay";
+
+ ethphy1: ethernet-phy@1 {
+ compatible = "ethernet-phy-id004d,d074",
+ "ethernet-phy-ieee802.3-c22";
+ reg = <0x1>;
+ at803x-override-sgmii-link-check;
+ };
+};
+
+&eth1 {
+ status = "okay";
+
+ phy-handle = <&ethphy1>;
+ pll-data = <0x03000000 0x00000101 0x00001313>;
+
+ qca955x-sgmii-fixup;
+};
+
+&pcie0 {
+ status = "okay";
+
+ wifi@0,0 {
+ compatible = "qcom,ath10k";
+ reg = <0x0000 0 0 0 0>;
+ nvmem-cells = <&cal_art_5000>;
+ nvmem-cell-names = "calibration";
+ };
+};
+
+&spi {
+ status = "okay";
+
+ flash@0 {
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ spi-max-frequency = <25000000>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "u-boot";
+ reg = <0x0 0x40000>;
+ read-only;
+ };
+
+ partition@40000 {
+ label = "u-boot-env";
+ reg = <0x40000 0x10000>;
+ read-only;
+ };
+
+ partition@50000 {
+ label = "art";
+ reg = <0x50000 0x10000>;
+ read-only;
+
+ nvmem-layout {
+ compatible = "fixed-layout";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ cal_art_1000: calibration@1000 {
+ reg = <0x1000 0x440>;
+ };
+
+ cal_art_5000: calibration@5000 {
+ reg = <0x5000 0x844>;
+ };
+ };
+ };
+
+ partition@60000 {
+ label = "art2";
+ reg = <0x60000 0x10000>;
+ read-only;
+ };
+
+ partition@70000 {
+ compatible = "denx,uimage";
+ label = "firmware";
+ reg = <0x70000 0xe00000>;
+ };
+
+ partition@e70000 {
+ label = "manufacture";
+ reg = <0xe70000 0x100000>;
+ read-only;
+ };
+
+ partition@f70000 {
+ label = "backup";
+ reg = <0xf70000 0x10000>;
+ read-only;
+ };
+
+ partition@f80000 {
+ label = "storage";
+ reg = <0xf80000 0x80000>;
+ read-only;
+ };
+ };
+ };
+};
+
+&uart {
+ status = "okay";
+};
+
+&usb_phy0 {
+ status = "okay";
+};
+
+&usb0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "okay";
+
+ dr_mode = "host";
+ vbus-supply = <&reg_usb_vbus>;
+
+ usb_port1: port@1 {
+ reg = <1>;
+ #trigger-source-cells = <0>;
+ };
+};
+
+&wdt {
+ status = "disabled";
+};
+
+&wmac {
+ status = "okay";
+
+ nvmem-cells = <&cal_art_1000>;
+ nvmem-cell-names = "calibration";
+};
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 0d7396a0..12b0193b 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
@@ -139,6 +139,9 @@ ath79_setup_interfaces()
alfa-network,n5q|\
devolo,dvl1200e|\
devolo,dvl1750e|\
+ elecom,wab-i1750-ps|\
+ elecom,wab-s1167-ps|\
+ elecom,wab-s600-ps|\
engenius,enstationac-v1|\
engenius,ews511ap|\
engenius,ews660ap|\
@@ -679,6 +682,9 @@ ath79_setup_macs()
wan_mac=$(mtd_get_mac_ascii hwconfig "HW.WAN.MAC.Address")
label_mac=$wan_mac
;;
+ elecom,wab-i1750-ps|\
+ elecom,wab-s1167-ps|\
+ elecom,wab-s600-ps|\
engenius,ecb1200|\
engenius,ecb1750)
lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
index 5d74208a..172faa8b 100644
--- a/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
+++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
@@ -35,6 +35,16 @@ case "$board" in
[ "$PHYNBR" -eq 1 ] && \
mtd_get_mac_ascii bdcfg "wlanmac" > /sys${DEVPATH}/macaddress
;;
+ elecom,wab-i1750-ps|\
+ elecom,wab-s1167-ps|\
+ elecom,wab-s600-ps)
+ # set the 5G MAC address (= ethaddr + 1)
+ [ "$PHYNBR" -eq 0 ] && \
+ macaddr_add "$(mtd_get_mac_ascii u-boot-env ethaddr)" 1 > /sys${DEVPATH}/macaddress
+ # set the 2.4G MAC address (= ethaddr)
+ [ "$PHYNBR" -eq 1 ] && \
+ mtd_get_mac_ascii u-boot-env "ethaddr" > /sys${DEVPATH}/macaddress
+ ;;
engenius,epg5000|\
engenius,esr1200|\
engenius,esr1750|\
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index 1a558c30..08daf22f 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -11,6 +11,7 @@ DEVICE_VARS += KERNEL_INITRAMFS_PREFIX DAP_SIGNATURE
DEVICE_VARS += EDIMAX_HEADER_MAGIC EDIMAX_HEADER_MODEL
DEVICE_VARS += OPENMESH_CE_TYPE ZYXEL_MODEL_STRING
DEVICE_VARS += SUPPORTED_TELTONIKA_DEVICES
+DEVICE_VARS += ELECOM_HWID
define Build/addpattern
-$(STAGING_DIR_HOST)/bin/addpattern -B $(ADDPATTERN_ID) \
@@ -1193,6 +1194,40 @@ define Device/dlink_dir-869-a1
endef
TARGET_DEVICES += dlink_dir-869-a1
+define Device/elecom_wab
+ DEVICE_VENDOR := ELECOM
+ IMAGE_SIZE := 14336k
+ IMAGES += factory.bin
+ IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \
+ pad-rootfs | check-size | elx-header $$$$(ELECOM_HWID) 8844A2D168B45A2D
+ DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca988x-ct kmod-gpio-beeper \
+ kmod-usb2 kmod-usb-ledtrig-usbport
+endef
+
+define Device/elecom_wab-i1750-ps
+ $(Device/elecom_wab)
+ SOC := qca9558
+ DEVICE_MODEL := WAB-I1750-PS
+ ELECOM_HWID := 0107000d
+endef
+TARGET_DEVICES += elecom_wab-i1750-ps
+
+define Device/elecom_wab-s1167-ps
+ $(Device/elecom_wab)
+ SOC := qca9557
+ DEVICE_MODEL := WAB-S1167-PS
+ ELECOM_HWID := 0107000c
+endef
+TARGET_DEVICES += elecom_wab-s1167-ps
+
+define Device/elecom_wab-s600-ps
+ $(Device/elecom_wab)
+ SOC := qca9557
+ DEVICE_MODEL := WAB-S600-PS
+ ELECOM_HWID := 01070028
+endef
+TARGET_DEVICES += elecom_wab-s600-ps
+
define Device/elecom_wrc-1750ghbk2-i
SOC := qca9563
DEVICE_VENDOR := ELECOM
@libnumafly
Copy link
Author

libnumafly commented Mar 2, 2024

Note: This code is based on musashino205's pull request on openwrt/openwrt/pull/14706, and some modifications by me.

This patch applies for v23.05.2 tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment