diff mbox series

[OpenWrt-Devel] ath79: add support for gl-e750

Message ID 1588135106-26552-1-git-send-email-luochongjun@gl-inet.com
State Changes Requested
Headers show
Series [OpenWrt-Devel] ath79: add support for gl-e750 | expand

Commit Message

Luochongjun April 29, 2020, 4:38 a.m. UTC
The gl-e750 is a portable travel router that gives you safe access to
the internet while traveling.

Specifications:
 - SoC: Qualcomm Atheros AR9531 (650MHz)
 - RAM: 128 MB DDR2
 - Flash: 16 MB SPI NOR (W25Q128FVSG) + 128 MB SPI NAND (GD5F1GQ4UFYIG)
 - Ethernet: 10/100: 1xLAN
 - Wireless: QCA9531 2.4GHz (bgn) + QCA9887 5GHz (ac)
 - USB: 1x USB 2.0 port
 - Switch: 1x switch
 - Button: 1x reset button
 - OLED Screen: 128*64 px

Flash instruction:
Support for sysupgrade directive upgrades, as well as luci upgrades.

OLED screen control:
OLED controller is connected to QCA9531 through serial port, and can send
instructions to OLED controller directly through serial port.
Refer to the links below for a list of supported instructions:
https://github.com/gl-inet/GL-E750-MCU-instruction

Signed-off-by: Luochongjun <luochongjun@gl-inet.com>
---
 target/linux/ath79/dts/qca9531_glinet_gl-e750.dts  | 146 +++++++++++++++++++++
 .../generic/base-files/etc/board.d/02_network      |   3 +
 target/linux/ath79/image/nand.mk                   |  21 +++
 3 files changed, 170 insertions(+)
 create mode 100644 target/linux/ath79/dts/qca9531_glinet_gl-e750.dts

Comments

Adrian Schmutzler April 29, 2020, 4:25 p.m. UTC | #1
Hi,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org]
> On Behalf Of Luochongjun
> Sent: Mittwoch, 29. April 2020 06:38
> To: openwrt-devel@lists.openwrt.org
> Cc: Luochongjun <luochongjun@gl-inet.com>
> Subject: [OpenWrt-Devel] [PATCH] ath79: add support for gl-e750
> 
> The gl-e750 is a portable travel router that gives you safe access to the
> internet while traveling.
> 
> Specifications:
>  - SoC: Qualcomm Atheros AR9531 (650MHz)
>  - RAM: 128 MB DDR2
>  - Flash: 16 MB SPI NOR (W25Q128FVSG) + 128 MB SPI NAND
> (GD5F1GQ4UFYIG)
>  - Ethernet: 10/100: 1xLAN
>  - Wireless: QCA9531 2.4GHz (bgn) + QCA9887 5GHz (ac)
>  - USB: 1x USB 2.0 port
>  - Switch: 1x switch
>  - Button: 1x reset button
>  - OLED Screen: 128*64 px
> 
> Flash instruction:
> Support for sysupgrade directive upgrades, as well as luci upgrades.
> 
> OLED screen control:
> OLED controller is connected to QCA9531 through serial port, and can send
> instructions to OLED controller directly through serial port.
> Refer to the links below for a list of supported instructions:
> https://github.com/gl-inet/GL-E750-MCU-instruction
> 
> Signed-off-by: Luochongjun <luochongjun@gl-inet.com>
> ---
>  target/linux/ath79/dts/qca9531_glinet_gl-e750.dts  | 146
> +++++++++++++++++++++
>  .../generic/base-files/etc/board.d/02_network      |   3 +
>  target/linux/ath79/image/nand.mk                   |  21 +++
>  3 files changed, 170 insertions(+)
>  create mode 100644 target/linux/ath79/dts/qca9531_glinet_gl-e750.dts
> 
> diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-e750.dts
> b/target/linux/ath79/dts/qca9531_glinet_gl-e750.dts
> new file mode 100644
> index 0000000..36ba376
> --- /dev/null
> +++ b/target/linux/ath79/dts/qca9531_glinet_gl-e750.dts
> @@ -0,0 +1,146 @@
> +// 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 "qca953x.dtsi"
> +
> +/ {
> +	compatible = "glinet,gl-e750", "qca,qca9531";
> +	model = "GL.iNet GL-E750";
> +
> +	keys {
> +		compatible = "gpio-keys-polled";

Please use gpio-keys and drop poll-interval.

> +
> +		poll-interval = <20>;
> +		pinctrl-names = "default";
> +		pinctrl-0 = <&jtag_disable_pins>;
> +
> +		button0 {

Please name buttons according to their function, i.e. "reset" instead of button0, also below.

> +			label = "reset";
> +			linux,code = <KEY_RESTART>;
> +			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		button1 {
> +			label = "right";

What's that?

> +			linux,code = <BTN_0>;
> +			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
> +		};
> +	};
> +
> +        gpio-export {
> +                compatible = "gpio-export";
> +                #size-cells = <0>;
> +
> +                gpio_lte_power {
> +                        gpio-export,name = "4G POWER";

Not really important, but either use "4g" or "lte" for the name consistently.

> +                        gpio-export,output = <1>;
> +                        gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
> +                };
> +        };
> +
> +};
> +
> +&pcie0 {
> +	status = "okay";
> +};
> +
> +&uart {
> +	status = "okay";
> +};
> +
> +&usb0 {
> +	#address-cells = <1>;
> +	#size-cells = <0>;
> +	status = "okay";
> +
> +	hub_port: port@1 {
> +		reg = <1>;
> +		#trigger-source-cells = <0>;
> +	};
> +};
> +
> +&usb_phy {
> +	status = "okay";
> +};
> +
> +&spi {
> +	status = "okay";
> +	num-cs = <2>;
> +
> +	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 0x040000>;
> +				read-only;
> +			};
> +
> +			partition@40000 {
> +				label = "u-boot-env";
> +				reg = <0x040000 0x010000>;
> +			};
> +
> +			art: partition@50000 {
> +				label = "art";
> +				reg = <0x050000 0x010000>;
> +				read-only;
> +			};
> +
> +			partition@60000 {
> +				label = "kernel";
> +				reg = <0x060000 0x400000>;
> +			};
> +
> +			partition@460000 {
> +				label = "reserved";
> +				reg = <0x460000 0xba0000>;
> +			};

Are you using these partitions or should they be read-only as well (at least the second one)?

> +
> +		};
> +	};
> +
> +	flash@1 {
> +		compatible = "spi-nand";
> +		reg = <1>;
> +		spi-max-frequency = <25000000>;
> +
> +		partitions {
> +			compatible = "fixed-partitions";
> +			#address-cells = <1>;
> +			#size-cells = <1>;
> +
> +			partition@0 {
> +				label = "ubi";
> +				reg = <0x000000 0x8000000>;

Please match the number of digits, so either seven zeros (0x0000000) for the position, or just use one (0x0).

> +			};
> +		};
> +	};
> +};
> +
> +&eth0 {
> +	status = "okay";

Add empty line after status.

> +	mtd-mac-address = <&art 0x0>;
> +	phy-handle = <&swphy4>;
> +};
> +
> +&eth1 {
> +	mtd-mac-address = <&art 0x0>;
> +	mtd-mac-address-increment = <1>;
> +};

This device is a one-port, according to the commit message. So, please set up only eth0 or eth1 here depending on which you need.

> +
> +&wmac {
> +	status = "okay";

Empty line after status.

> +	mtd-cal-data = <&art 0x1000>;
> +	mtd-mac-address = <&art 0x1002>;

mac-address can be dropped here, it's read from the caldata.

> +};
> 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 d7f7eed..1e80c68 100755
> --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
> +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
> @@ -63,6 +63,9 @@ ath79_setup_interfaces()
>  	winchannel,wb2000)
>  		ucidef_set_interface_lan "eth0"
>  		;;
> +	glinet,gl-e750)
> +		ucidef_set_interface_lan "eth1"
> +		;;

One-port, so if set up correctly, there should only be eth0, and you can add this to the corresponding case here.
Despite, please watch for correct alphabetic sorting.

>  	avm,fritz4020|\
>  	pcs,cr3000|\
>  	tplink,archer-c58-v1|\
> diff --git a/target/linux/ath79/image/nand.mk
> b/target/linux/ath79/image/nand.mk
> index 3ccd199..6518f99 100644
> --- a/target/linux/ath79/image/nand.mk
> +++ b/target/linux/ath79/image/nand.mk
> @@ -130,6 +130,27 @@ define Device/glinet_gl-ar750s-nor  endef
> TARGET_DEVICES += glinet_gl-ar750s-nor
> 
> +define Device/glinet_gl-e750
> +  SOC := qca9531
> +  DEVICE_VENDOR := GL.iNet
> +  DEVICE_MODEL := GL-E750
> +  DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9887-ct kmod-
> usb2 \
> +	kmod-usb-storage block-mount
> +  KERNEL_SIZE := 2048k
> +  IMAGE_SIZE := 16000k

131072k ?

> +  PAGESIZE := 2048
> +  VID_HDR_OFFSET := 2048
> +  DEVICE_VARIANT := NOR/NAND

DEVICE_VARIANT is just used for naming the device.
So, it is only required if there are  (or will be) different variants of that device.
If yes, you should also change the device name to glinet_gl-e750-nor-nand everything.
If not, it can be dropped.
If kept, it should be put after DEVICE_MODEL.

> +  BLOCKSIZE := 128k
> +  GL_UBOOT_UBI_OFFSET := 2048k
> +  IMAGES += factory.img
> +  IMAGE/factory.img := append-kernel | pad-to
> $$$$(GL_UBOOT_UBI_OFFSET) | \
> +	append-ubi | check-kernel-size $$$$(GL_UBOOT_UBI_OFFSET)
> +  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
> +  SUPPORTED_DEVICES += glinet,gl-e750

That line can be dropped, it's the default.

Best

Adrian

> +endef
> +TARGET_DEVICES += glinet_gl-e750
> +
>  # fake rootfs is mandatory, pad-offset 129 equals (2 * uimage_header +
> 0xff)  define Device/netgear_ath79_nand
>    DEVICE_VENDOR := NETGEAR
> --
> 2.7.4
> 
> 
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
diff mbox series

Patch

diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-e750.dts b/target/linux/ath79/dts/qca9531_glinet_gl-e750.dts
new file mode 100644
index 0000000..36ba376
--- /dev/null
+++ b/target/linux/ath79/dts/qca9531_glinet_gl-e750.dts
@@ -0,0 +1,146 @@ 
+// 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 "qca953x.dtsi"
+
+/ {
+	compatible = "glinet,gl-e750", "qca,qca9531";
+	model = "GL.iNet GL-E750";
+
+	keys {
+		compatible = "gpio-keys-polled";
+
+		poll-interval = <20>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&jtag_disable_pins>;
+
+		button0 {
+			label = "reset";
+			linux,code = <KEY_RESTART>;
+			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
+		};
+
+		button1 {
+			label = "right";
+			linux,code = <BTN_0>;
+			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+        gpio-export {
+                compatible = "gpio-export";
+                #size-cells = <0>;
+
+                gpio_lte_power {
+                        gpio-export,name = "4G POWER";
+                        gpio-export,output = <1>;
+                        gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
+                };
+        };
+
+};
+
+&pcie0 {
+	status = "okay";
+};
+
+&uart {
+	status = "okay";
+};
+
+&usb0 {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	status = "okay";
+
+	hub_port: port@1 {
+		reg = <1>;
+		#trigger-source-cells = <0>;
+	};
+};
+
+&usb_phy {
+	status = "okay";
+};
+
+&spi {
+	status = "okay";
+	num-cs = <2>;
+
+	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 0x040000>;
+				read-only;
+			};
+
+			partition@40000 {
+				label = "u-boot-env";
+				reg = <0x040000 0x010000>;
+			};
+
+			art: partition@50000 {
+				label = "art";
+				reg = <0x050000 0x010000>;
+				read-only;
+			};
+
+			partition@60000 {
+				label = "kernel";
+				reg = <0x060000 0x400000>;
+			};
+
+			partition@460000 {
+				label = "reserved";
+				reg = <0x460000 0xba0000>;
+			};
+
+		};
+	};
+
+	flash@1 {
+		compatible = "spi-nand";
+		reg = <1>;
+		spi-max-frequency = <25000000>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition@0 {
+				label = "ubi";
+				reg = <0x000000 0x8000000>;
+			};
+		};
+	};
+};
+
+&eth0 {
+	status = "okay";
+	mtd-mac-address = <&art 0x0>;
+	phy-handle = <&swphy4>;
+};
+
+&eth1 {
+	mtd-mac-address = <&art 0x0>;
+	mtd-mac-address-increment = <1>;
+};
+
+&wmac {
+	status = "okay";
+	mtd-cal-data = <&art 0x1000>;
+	mtd-mac-address = <&art 0x1002>;
+};
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 d7f7eed..1e80c68 100755
--- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
@@ -63,6 +63,9 @@  ath79_setup_interfaces()
 	winchannel,wb2000)
 		ucidef_set_interface_lan "eth0"
 		;;
+	glinet,gl-e750)
+		ucidef_set_interface_lan "eth1"
+		;;
 	avm,fritz4020|\
 	pcs,cr3000|\
 	tplink,archer-c58-v1|\
diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk
index 3ccd199..6518f99 100644
--- a/target/linux/ath79/image/nand.mk
+++ b/target/linux/ath79/image/nand.mk
@@ -130,6 +130,27 @@  define Device/glinet_gl-ar750s-nor
 endef
 TARGET_DEVICES += glinet_gl-ar750s-nor
 
+define Device/glinet_gl-e750
+  SOC := qca9531
+  DEVICE_VENDOR := GL.iNet
+  DEVICE_MODEL := GL-E750
+  DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca9887-ct kmod-usb2 \
+	kmod-usb-storage block-mount
+  KERNEL_SIZE := 2048k
+  IMAGE_SIZE := 16000k
+  PAGESIZE := 2048
+  VID_HDR_OFFSET := 2048
+  DEVICE_VARIANT := NOR/NAND
+  BLOCKSIZE := 128k
+  GL_UBOOT_UBI_OFFSET := 2048k
+  IMAGES += factory.img
+  IMAGE/factory.img := append-kernel | pad-to $$$$(GL_UBOOT_UBI_OFFSET) | \
+	append-ubi | check-kernel-size $$$$(GL_UBOOT_UBI_OFFSET)
+  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+  SUPPORTED_DEVICES += glinet,gl-e750
+endef
+TARGET_DEVICES += glinet_gl-e750
+
 # fake rootfs is mandatory, pad-offset 129 equals (2 * uimage_header + 0xff)
 define Device/netgear_ath79_nand
   DEVICE_VENDOR := NETGEAR