[openwrt/openwrt] ath79: add support for Qualcomm AP143 reference boards

LEDE Commits lede-commits at lists.infradead.org
Fri Jun 4 16:51:04 PDT 2021


adrian pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/1eb481206dd4173f9e19f83e4b05892cd1035c74

commit 1eb481206dd4173f9e19f83e4b05892cd1035c74
Author: Zoltan HERPAI <wigyori at uid0.hu>
AuthorDate: Mon Aug 3 23:07:21 2020 +0200

    ath79: add support for Qualcomm AP143 reference boards
    
    Specifications:
    
    SoC:    QCA9533
    DRAM:   32Mb DDR1
    Flash:  8/16Mb SPI-NOR
    LAN:    4x 10/100Mbps via AR8229 switch (integrated into SoC)
            on GMII
    WAN:    1x 10/100Mbps via MII
    WLAN:   QCA9530
    USB:    1x 2.0
    UART:   standard QCA UART header
    JTAG:   yes
    Button: 1x WPS, 1x reset
    LEDs:   8x LEDs
    
    A version with 4Mb flash is also available, but due to lack of
    enough space it's not supported.
    
    As the original flash layout does not provide enough space for
    the kernel (1472k), the firmware uses OKLI and concat flash to
    overcome the limitation without changing the boot address of the
    bootloaders.
    
    Installation:
    
    1. Original bootloader
    
      Connect the board to ethernet
      Set up a server with an IP address of 192.168.1.10
      Make the openwrt-ath79-generic-qca_ap143-8m-squashfs-factory.bin
      available via TFTP
    
      tftpboot 0x80060000 openwrt-ath79-generic-qca_ap143-8m-squashfs-factory.bin
      erase 0x9f050000 +$filesize
      cp.b $fileaddr 0x9f050000 $filesize
    
      Reboot the board.
    
    2. pepe2k's u-boot_mod
    
      Connect the board to ethernet
      Set up a server with an IP address of 192.168.1.10
      Make the openwrt-ath79-generic-qca_ap143-8m-squashfs-factory.bin
      available via TFTP, as "firmware.bin"
    
      run fw_upg
    
      Reboot the board.
    
    For the 16M version of the board, please use
    openwrt-ath79-generic-qca_ap143-16m-squashfs-factory.bin
    
    Signed-off-by: Zoltan HERPAI <wigyori at uid0.hu>
    [use fwconcatX names, drop redundant uart status, fix IMAGE_SIZE,
    set up IMAGE/factory.bin without metadata]
    Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
---
 target/linux/ath79/dts/qca9533_qca_ap143-16m.dts   |  49 ++++++++
 target/linux/ath79/dts/qca9533_qca_ap143-8m.dts    |  49 ++++++++
 target/linux/ath79/dts/qca9533_qca_ap143.dtsi      | 125 +++++++++++++++++++++
 .../ath79/generic/base-files/etc/board.d/01_leds   |   8 ++
 .../generic/base-files/etc/board.d/02_network      |   4 +-
 target/linux/ath79/image/Makefile                  |   4 +
 target/linux/ath79/image/generic.mk                |  37 ++++++
 7 files changed, 275 insertions(+), 1 deletion(-)

diff --git a/target/linux/ath79/dts/qca9533_qca_ap143-16m.dts b/target/linux/ath79/dts/qca9533_qca_ap143-16m.dts
new file mode 100644
index 0000000000..31e61de175
--- /dev/null
+++ b/target/linux/ath79/dts/qca9533_qca_ap143-16m.dts
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "qca9533_qca_ap143.dtsi"
+
+/ {
+	model = "Qualcomm Atheros AP143 (16M) reference board";
+	compatible = "qca,ap143-16m", "qca,qca9533";
+
+	virtual_flash {
+		compatible = "mtd-concat";
+		devices = <&fwconcat0 &fwconcat1>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition at 0 {
+				reg = <0x0 0x0>;
+				label = "firmware";
+				compatible = "openwrt,uimage", "denx,uimage";
+				openwrt,ih-magic = <IH_MAGIC_OKLI>;
+			};
+		};
+	};
+};
+
+&partitions {
+	fwconcat0: partition at 50000 {
+		label = "fwconcat0";
+		reg = <0x050000 0xe30000>;
+	};
+
+	partition at e80000 {
+		label = "loader";
+		reg = <0xe80000 0x10000>;
+	};
+
+	fwconcat1: partition at e90000 {
+		label = "fwconcat1";
+		reg = <0xe90000 0x160000>;
+	};
+
+	art: partition at ff0000 {
+		label = "art";
+		reg = <0xff0000 0x010000>;
+		read-only;
+	};
+};
diff --git a/target/linux/ath79/dts/qca9533_qca_ap143-8m.dts b/target/linux/ath79/dts/qca9533_qca_ap143-8m.dts
new file mode 100644
index 0000000000..bdb93420b5
--- /dev/null
+++ b/target/linux/ath79/dts/qca9533_qca_ap143-8m.dts
@@ -0,0 +1,49 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "qca9533_qca_ap143.dtsi"
+
+/ {
+	model = "Qualcomm Atheros AP143 (8M) reference board";
+	compatible = "qca,ap143-8m", "qca,qca9533";
+
+	virtual_flash {
+		compatible = "mtd-concat";
+		devices = <&fwconcat0 &fwconcat1>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition at 0 {
+				reg = <0x0 0x0>;
+				label = "firmware";
+				compatible = "openwrt,uimage", "denx,uimage";
+				openwrt,ih-magic = <IH_MAGIC_OKLI>;
+			};
+		};
+	};
+};
+
+&partitions {
+	fwconcat0: partition at 50000 {
+		label = "fwconcat0";
+		reg = <0x050000 0x630000>;
+	};
+
+	partition at 680000 {
+		label = "loader";
+		reg = <0x680000 0x10000>;
+	};
+
+	fwconcat1: partition at 690000 {
+		label = "fwconcat1";
+		reg = <0x690000 0x160000>;
+	};
+
+	art: partition at 7f0000 {
+		label = "art";
+		reg = <0x7f0000 0x010000>;
+		read-only;
+	};
+};
diff --git a/target/linux/ath79/dts/qca9533_qca_ap143.dtsi b/target/linux/ath79/dts/qca9533_qca_ap143.dtsi
new file mode 100644
index 0000000000..95a24175a5
--- /dev/null
+++ b/target/linux/ath79/dts/qca9533_qca_ap143.dtsi
@@ -0,0 +1,125 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "qca953x.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/mtd/partitions/uimage.h>
+
+/ {
+	aliases {
+		led-boot = &led_wps;
+		led-failsafe = &led_wps;
+		led-running = &led_wps;
+		led-upgrade = &led_wps;
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		wan {
+			label = "green:wan";
+			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
+		};
+
+		wlan {
+			label = "green:wlan";
+			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+			linux,default-trigger = "phy0tpt";
+		};
+
+		lan1 {
+			label = "green:lan1";
+			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
+		};
+
+		lan2 {
+			label = "green:lan2";
+			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+		};
+
+		lan3 {
+			label = "green:lan3";
+			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
+		};
+
+		lan4 {
+			label = "green:lan4";
+			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
+		};
+
+		led_wps: wps {
+			label = "green:wps";
+			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	keys {
+		compatible = "gpio-keys";
+
+		wps {
+			label = "WPS button";
+			linux,code = <KEY_WPS_BUTTON>;
+			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
+			debounce-interval = <60>;
+		};
+	};
+};
+
+&spi {
+	status = "okay";
+
+	flash at 0 {
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <25000000>;
+
+		partitions: partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition at 0 {
+				label = "u-boot";
+				reg = <0x000000 0x040000>;
+				read-only;
+			};
+
+			partition at 40000 {
+				label = "u-boot-env";
+				reg = <0x040000 0x010000>;
+				read-only;
+			};
+		};
+	};
+};
+
+&eth0 {
+	status = "okay";
+
+	mtd-mac-address = <&art 0x0>;
+
+	phy-handle = <&swphy4>;
+};
+
+&eth1 {
+	mtd-mac-address = <&art 0x6>;
+
+	gmac-config {
+		device = <&gmac>;
+	};
+};
+
+&wmac {
+	status = "okay";
+
+	mtd-cal-data = <&art 0x1000>;
+};
+
+&usb0 {
+	status = "okay";
+};
+
+&usb_phy {
+	status = "okay";
+};
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
index 1990353394..8ead3ec0a3 100644
--- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
@@ -260,6 +260,14 @@ pcs,cr3000)
 	ucidef_set_led_switch "lan3" "LAN3" "blue:lan3" "switch0" "0x10"
 	ucidef_set_led_switch "lan4" "LAN4" "blue:lan4" "switch0" "0x02"
 	;;
+qca,ap143-8m|\
+qca,ap143-16m)
+	ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1"
+	ucidef_set_led_switch "lan1" "LAN1" "green:lan1" "switch0" "0x02"
+	ucidef_set_led_switch "lan2" "LAN2" "green:lan2" "switch0" "0x04"
+	ucidef_set_led_switch "lan3" "LAN3" "green:lan3" "switch0" "0x08"
+	ucidef_set_led_switch "lan4" "LAN4" "green:lan4" "switch0" "0x10"
+	;;
 qihoo,c301)
 	ucidef_set_led_wlan "wlan" "WLAN" "green:wlan" "phy0tpt"
 	;;
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 87aaf0bcad..8ea52af67a 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
@@ -192,7 +192,9 @@ ath79_setup_interfaces()
 		ucidef_add_switch "switch0" \
 			"0 at eth0" "1:wan" "2:lan"
 		;;
-	comfast,cf-e560ac)
+	comfast,cf-e560ac|\
+	qca,ap143-8m|\
+	qca,ap143-16m)
 		ucidef_set_interface_wan "eth1"
 		ucidef_add_switch "switch0" \
 			"0 at eth0" "1:lan" "2:lan" "3:lan" "4:lan"
diff --git a/target/linux/ath79/image/Makefile b/target/linux/ath79/image/Makefile
index 3c126f479e..aa8665fbb2 100644
--- a/target/linux/ath79/image/Makefile
+++ b/target/linux/ath79/image/Makefile
@@ -48,6 +48,10 @@ define Build/append-loader-okli
 	cat "$(KDIR)/loader-$(word 1,$(1)).$(LOADER_TYPE)" >> "$@"
 endef
 
+define Build/append-loader-okli-uimage
+	cat "$(KDIR)/loader-$(word 1,$(1)).uImage" >> "$@"
+endef
+
 define Build/relocate-kernel
 	rm -rf $@.relocate
 	$(CP) ../../generic/image/relocate $@.relocate
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index 86aae57266..4d3f455e49 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -1900,6 +1900,43 @@ define Device/plasmacloud_pa300e
 endef
 TARGET_DEVICES += plasmacloud_pa300e
 
+define Device/qca_ap143
+  SOC := qca9533
+  DEVICE_VENDOR := Qualcomm Atheros
+  DEVICE_MODEL := AP143
+  DEVICE_PACKAGES := kmod-usb2
+  SUPPORTED_DEVICES += ap143
+  LOADER_TYPE := bin
+  LOADER_FLASH_OFFS := 0x50000
+  KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49
+  COMPILE := loader-$(1).bin loader-$(1).uImage
+  COMPILE/loader-$(1).bin := loader-okli-compile
+  COMPILE/loader-$(1).uImage := append-loader-okli $(1) | pad-to 64k | lzma | \
+	uImage lzma
+endef
+
+define Device/qca_ap143-8m
+  $(Device/qca_ap143)
+  DEVICE_VARIANT := (8M)
+  IMAGE_SIZE := 7744k
+  IMAGES += factory.bin
+  IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
+	append-rootfs | pad-rootfs | check-size | pad-to 6336k | \
+	append-loader-okli-uimage $(1) | pad-to 64k
+endef
+TARGET_DEVICES += qca_ap143-8m
+
+define Device/qca_ap143-16m
+  $(Device/qca_ap143)
+  DEVICE_VARIANT := (16M)
+  IMAGE_SIZE := 15936k
+  IMAGES += factory.bin
+  IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
+	append-rootfs | pad-rootfs | check-size | pad-to 14528k | \
+	append-loader-okli-uimage $(1) | pad-to 64k
+endef
+TARGET_DEVICES += qca_ap143-16m
+
 define Device/qihoo_c301
   $(Device/seama)
   SOC := ar9344



More information about the lede-commits mailing list