ath79: add support for ALFA Network AP121F
authorRoger Pueyo Centelles <roger.pueyo@guifi.net>
Thu, 4 Jul 2019 12:08:10 +0000 (14:08 +0200)
committerPiotr Dymacz <pepe2k@gmail.com>
Wed, 31 Jul 2019 06:38:01 +0000 (08:38 +0200)
This commit ports support for the ALFA Network AP121F, a pocket-size
router with 1 Ethernet and 2.4 GHz WiFi based on the AR9331 SoC, to the
ath79 target (it was already supported in ar71xx; see commit 0c6165d2
for more details).

Signed-off-by: Roger Pueyo Centelles <roger.pueyo@guifi.net>
[pepe2k@gmail.com: fixed GPIO polarity, included USB support, changed
DTS nodes order, moved WLAN LED trigger define to DTS, made U-Boot env
partition writable]
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
target/linux/ath79/base-files/etc/board.d/01_leds
target/linux/ath79/base-files/etc/board.d/02_network
target/linux/ath79/dts/ar9331_alfa-network_ap121f.dts [new file with mode: 0644]
target/linux/ath79/image/generic.mk

index f3bf43a247d003605980a3880fbc802bf8947c25..d68c1ee9efec59d8692828a86bc5d9f4e69c81af 100755 (executable)
@@ -12,6 +12,9 @@ case "$board" in
        ucidef_set_led_netdev "lan" "LAN" "$boardname:orange:eth0" "eth0"
        ucidef_set_led_switch "wan" "WAN" "$boardname:orange:eth1" "switch0" "0x04"
        ;;
+alfa-network,ap121f)
+       ucidef_set_led_netdev "lan" "LAN" "$boardname:green:lan" "eth0"
+       ;;
 avm,fritz300e)
        ucidef_set_led_netdev "lan" "LAN" "$boardname:green:lan" "eth0"
        ucidef_set_rssimon "wlan0" "200000" "1"
index 41ceb12ee5e7815d74b672277ef965bf7ecbb4ba..beac4660d25c11b73332515d69148d25ea7f80d8 100755 (executable)
@@ -11,6 +11,7 @@ ath79_setup_interfaces()
        case "$board" in
        adtran,bsap1800-v2|\
        adtran,bsap1840|\
+       alfa-network,ap121f|\
        aruba,ap-105|\
        avm,fritz300e|\
        devolo,dvl1200i|\
diff --git a/target/linux/ath79/dts/ar9331_alfa-network_ap121f.dts b/target/linux/ath79/dts/ar9331_alfa-network_ap121f.dts
new file mode 100644 (file)
index 0000000..82e6f74
--- /dev/null
@@ -0,0 +1,134 @@
+// 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 = "ALFA Network AP121F";
+       compatible = "alfa-network,ap121f", "qca,ar9331";
+
+       aliases {
+               label-mac-device = &wmac;
+               led-boot = &vpn;
+               led-failsafe = &vpn;
+               led-upgrade = &vpn;
+               serial0 = &uart;
+       };
+
+       keys {
+               compatible = "gpio-keys";
+
+               reset {
+                       label = "reset";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+               };
+
+               switch {
+                       label = "switch";
+                       linux,code = <BTN_0>;
+                       gpios = <&gpio 21 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               lan {
+                       label = "ap121f:green:lan";
+                       gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
+               };
+
+               vpn: vpn {
+                       label = "ap121f:green:vpn";
+                       gpios = <&gpio 27 GPIO_ACTIVE_LOW>;
+               };
+
+               wlan {
+                       label = "ap121f:green:wlan";
+                       gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "phy0tpt";
+               };
+       };
+};
+
+&eth0 {
+       status = "okay";
+       mtd-mac-address = <&art 0x0>;
+
+       gmac-config {
+               device = <&gmac>;
+               switch-phy-addr-swap = <0>;
+               switch-phy-swap = <0>;
+       };
+};
+
+&eth1 {
+       status = "okay";
+       compatible = "syscon", "simple-mfd";
+};
+
+&gpio {
+       status = "okay";
+};
+
+&spi {
+       status = "okay";
+       num-cs = <1>;
+
+       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 = <0x000000 0x030000>;
+                               read-only;
+                       };
+
+                       partition@30000 {
+                               label = "u-boot-env";
+                               reg = <0x030000 0x010000>;
+                       };
+
+                       art: partition@40000 {
+                               label = "art";
+                               reg = <0x040000 0x010000>;
+                               read-only;
+                       };
+
+                       partition@50000 {
+                               compatible = "denx,uimage";
+                               label = "firmware";
+                               reg = <0x050000 0xfb0000>;
+                       };
+               };
+       };
+};
+
+&uart {
+       status = "okay";
+};
+
+&usb {
+       status = "okay";
+       dr_mode = "host";
+};
+
+&usb_phy {
+       status = "okay";
+};
+
+&wmac {
+       status = "okay";
+       mtd-cal-data = <&art 0x1000>;
+};
index c5807f2c78e4073d8eea12ab29b65e26eda28f26..42e4271e0cdfac17244f9b45dd1b93d214696a2c 100644 (file)
@@ -111,6 +111,16 @@ define Device/adtran_bsap1840
 endef
 TARGET_DEVICES += adtran_bsap1840
 
+define Device/alfa-network_ap121f
+  ATH_SOC := ar9331
+  DEVICE_VENDOR := ALFA Network
+  DEVICE_MODEL := AP121F
+  DEVICE_PACKAGES := kmod-usb2 kmod-usb-chipidea2 kmod-usb-storage -swconfig
+  IMAGE_SIZE := 16064k
+  SUPPORTED_DEVICES += ap121f
+endef
+TARGET_DEVICES += alfa-network_ap121f
+
 define Device/aruba_ap-105
   ATH_SOC := ar7161
   DEVICE_VENDOR := Aruba