mips: [RFC] adding support for APJET01 ref board

Oleksandr Hnatiuk dev at alexconst.sh
Sat Nov 13 08:30:34 PST 2021


From: Oleksandr Hnatiuk <dev at alexconst.sh>
Signed-off-by: Oleksandr Hnatiuk <dev at alexconst.sh>

Changes in this version of the patch:
- removed nested rootfs partition
- added "compatible" field to the linux partition
- added IMAGE_SIZE field to device description

This patch enables booting the board and running OpenWrt, but lacks any support
for switch / wireless / USB. Posting here just to let future readers know that
some of the issues / questions from my previous emails are resolved. However,
the question regarding describing switch and ethernet ports is still relevant.
The work can be tracked here: gitlab.com/alexconst.sh/openwrt
 or here: forum.openwrt.org/t/adding-openwrt-support-for-asus-rt-ac57u-v2/53281
---

diff --git a/target/linux/ath79/dts/qcn5502_qca_apjet01-16m.dts b/target/linux/ath79/dts/qcn5502_qca_apjet01-16m.dts
new file mode 100644
index 0000000000..9fa31b85d0
--- /dev/null
+++ b/target/linux/ath79/dts/qcn5502_qca_apjet01-16m.dts
@@ -0,0 +1,137 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+#include "qca956x.dtsi"
+
+/ {
+	compatible = "asus,rt-ac59u", "qca,qcn5502", "qca,qca9560";
+	model = "ASUS RT-AC59U";
+
+	aliases {
+		serial0 = &uart;
+	};
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu at 0 {
+			device_type = "cpu";
+			compatible = "mips,mips74Kc";
+			clocks = <&pll ATH79_CLK_CPU>;
+			reg = <0>;
+		};
+	};
+
+	memory at 0 {
+		device_type = "memory";
+		reg = <0x0 0x8000000>;
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		wlan {
+			label = "apjet01:green:wlan";
+			gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+		};
+
+		usb {
+			label = "apjet01:green:usb";
+			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
+		};
+
+		lan at 1 {
+			label = "apjet01:green:lan";
+			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
+		};
+
+		lan at 2 {
+			label = "apjet01:green:lan";
+			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
+		};
+
+		lan at 3 {
+			label = "apjet01:green:lan";
+			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
+		};
+
+		lan at 4 {
+			label = "apjet01:green:lan";
+			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	gpio-keys {
+		compatible = "gpio-keys";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		button at 0 {
+			label = "wps";
+			linux,code = <KEY_WPS_BUTTON>;
+			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
+			debounce-interval = <60>;
+		};
+
+		button at 1 {
+			label = "reset";
+			linux,code = <KEY_RESTART>;
+			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
+			debounce-interval = <60>;
+		};
+	};
+};
+
+&uart {
+	status = "okay";
+};
+
+&gpio {
+	status = "okay";
+};
+
+&spi {
+	status = "okay";
+
+	flash at 0 {
+		compatible = "winbond,w25q128", "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <25000000>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition at 0 {
+				label = "u-boot";
+				reg = <0x000000 0x040000>;
+			};
+
+			partition at 040000 {
+				label = "nvram";
+				reg = <0x040000 0x010000>;
+			};
+
+			partition at 050000 {
+				label = "factory";
+				reg = <0x050000 0x010000>;
+			};
+
+			partition at 060000 {
+				label = "linux";
+				reg = <0x060000 0xf20000>;
+				compatible = "denx,uimage";
+			};
+
+			partition at f80000 {
+				label = "jffs2";
+				reg = <0xf80000 0x080000>;
+			};
+		};
+	};
+};
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index 9d0be2b86b..4fb10ba0a6 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -1963,6 +1963,31 @@ define Device/qca_ap143-16m
 endef
 TARGET_DEVICES += qca_ap143-16m
 
+define Device/qca_apjet01
+  SOC := qcn5502
+  DEVICE_VENDOR := Qualcomm Atheros
+  DEVICE_MODEL := APJET01
+  DEVICE_PACKAGES := kmod-usb2
+  SUPPORTED_DEVICES += apjet01
+  LOADER_TYPE := bin
+  KERNEL := kernel-bin | append-dtb | lzma -d20 | uImage lzma
+  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_apjet01-16m
+  $(Device/qca_apjet01)
+  DEVICE_VARIANT := (16M)
+  IMAGES += factory.bin
+  IMAGE_SIZE := 15488k
+  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_apjet01-16m
+
 define Device/qihoo_c301
   $(Device/seama)
   SOC := ar9344
-- 
2.30.2



More information about the openwrt-devel mailing list