diff mbox series

mips: [RFC] adding support for APJET01 ref board

Message ID 49867570.759551.1636821034062@office.mailbox.org
State Changes Requested
Delegated to: Petr Štetiar
Headers show
Series mips: [RFC] adding support for APJET01 ref board | expand

Commit Message

Oleksandr Hnatiuk Nov. 13, 2021, 4:30 p.m. UTC
From: Oleksandr Hnatiuk <dev@alexconst.sh>
Signed-off-by: Oleksandr Hnatiuk <dev@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
---

Comments

John Crispin Nov. 13, 2021, 4:39 p.m. UTC | #1
On 13.11.21 17:30, Oleksandr Hnatiuk wrote:
> From: Oleksandr Hnatiuk <dev@alexconst.sh>
> Signed-off-by: Oleksandr Hnatiuk <dev@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";

this appears to be copy&paste and needs to be fixed. also the patch is 
missing all the relevant changes to base-files/etc/board.d/
	John
> +
> +	aliases {
> +		serial0 = &uart;
> +	};
> +
> +	cpus {
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		cpu@0 {
> +			device_type = "cpu";
> +			compatible = "mips,mips74Kc";
> +			clocks = <&pll ATH79_CLK_CPU>;
> +			reg = <0>;
> +		};
> +	};
> +
> +	memory@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@1 {
> +			label = "apjet01:green:lan";
> +			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		lan@2 {
> +			label = "apjet01:green:lan";
> +			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		lan@3 {
> +			label = "apjet01:green:lan";
> +			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		lan@4 {
> +			label = "apjet01:green:lan";
> +			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
> +		};
> +	};
> +
> +	gpio-keys {
> +		compatible = "gpio-keys";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		button@0 {
> +			label = "wps";
> +			linux,code = <KEY_WPS_BUTTON>;
> +			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
> +			debounce-interval = <60>;
> +		};
> +
> +		button@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@0 {
> +		compatible = "winbond,w25q128", "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 0x040000>;
> +			};
> +
> +			partition@040000 {
> +				label = "nvram";
> +				reg = <0x040000 0x010000>;
> +			};
> +
> +			partition@050000 {
> +				label = "factory";
> +				reg = <0x050000 0x010000>;
> +			};
> +
> +			partition@060000 {
> +				label = "linux";
> +				reg = <0x060000 0xf20000>;
> +				compatible = "denx,uimage";
> +			};
> +
> +			partition@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
>
diff mbox series

Patch

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@0 {
+			device_type = "cpu";
+			compatible = "mips,mips74Kc";
+			clocks = <&pll ATH79_CLK_CPU>;
+			reg = <0>;
+		};
+	};
+
+	memory@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@1 {
+			label = "apjet01:green:lan";
+			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
+		};
+
+		lan@2 {
+			label = "apjet01:green:lan";
+			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
+		};
+
+		lan@3 {
+			label = "apjet01:green:lan";
+			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
+		};
+
+		lan@4 {
+			label = "apjet01:green:lan";
+			gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	gpio-keys {
+		compatible = "gpio-keys";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		button@0 {
+			label = "wps";
+			linux,code = <KEY_WPS_BUTTON>;
+			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
+			debounce-interval = <60>;
+		};
+
+		button@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@0 {
+		compatible = "winbond,w25q128", "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 0x040000>;
+			};
+
+			partition@040000 {
+				label = "nvram";
+				reg = <0x040000 0x010000>;
+			};
+
+			partition@050000 {
+				label = "factory";
+				reg = <0x050000 0x010000>;
+			};
+
+			partition@060000 {
+				label = "linux";
+				reg = <0x060000 0xf20000>;
+				compatible = "denx,uimage";
+			};
+
+			partition@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