mips: [RFC] adding support for APJET01 ref board

Oleksandr Hnatiuk dev at alexconst.sh
Wed Nov 10 12:36:46 PST 2021


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

Changes in this version:
- my DTS actually compiles, because of:
- fixed typos
- removed "ALL" partition
- removed `&ref` that doesn't reference anything
- renamed file so that it matches what the build
system is looking for when selecting this board
---

Now I get the following error:

```
/media/hdd/openwrt/staging_dir/host/bin/padjffs2 /media/hdd/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/tmp/openwrt-ath79-generic-qca_apjet01-16m-squashfs-factory.bin  64
padding image to 004b0000
WARNING: Image file /media/hdd/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/tmp/openwrt-ath79-generic-qca_apjet01-16m-squashfs-factory.bin is too big: 4915204 > 0
dd if=/media/hdd/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/tmp/openwrt-ath79-generic-qca_apjet01-16m-squashfs-factory.bin of=/media/hdd/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/tmp/openwrt-ath79-generic-qca_apjet01-16m-squashfs-factory.bin.new bs=14528k conv=sync
dd: failed to open '/media/hdd/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/tmp/openwrt-ath79-generic-qca_apjet01-16m-squashfs-factory.bin': No such file or directory
make[4]: *** [Makefile:101: /media/hdd/openwrt/build_dir/target-mips_24kc_musl/linux-ath79_generic/tmp/openwrt-ath79-generic-qca_apjet01-16m-squashfs-factory.bin] Error 1
make[4]: Leaving directory '/media/hdd/openwrt/target/linux/ath79/image'
```

Not sure why it says zero in '4915204 > 0'. Previous `dd` commands
completed just fine.

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..8947ba9980
--- /dev/null
+++ b/target/linux/ath79/dts/qcn5502_qca_apjet01-16m.dts
@@ -0,0 +1,147 @@
+// 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>;
+			};
+
+			partition at 19ab80 {
+				label = "rootfs";
+				reg = <0x19ab80 0xde5480>;
+			};
+
+			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..2b571a61d8 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -1963,6 +1963,30 @@ 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/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