Message ID | 1594373545-26039-1-git-send-email-luochongjun@gl-inet.com |
---|---|
State | Changes Requested |
Headers | show |
Series | ath79: add support for gl-e750 | expand |
Hi, > -----Original Message----- > From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org] > On Behalf Of Luochongjun > Sent: Freitag, 10. Juli 2020 11:32 > To: openwrt-devel@lists.openwrt.org > Cc: Luochongjun <luochongjun@gl-inet.com> > Subject: [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 firmware: > Since openwrt's kernel already exceeds 2MB, upgrading from the official > version of GL-inet (v3.100) using the sysupgrade command will break the > kernel image. Users who are using version 3.100 can only upgrade via uboot. > The official guidance for GL-inet is as follows: > https://docs.gl-inet.com/en/3/troubleshooting/debrick/ > > In the future, GL-inet will modify the firmware to support the sysupgrade > command, so users will be able to upgrade directly with the sysupgrade > command in future releases. > > 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 | 140 > +++++++++++++++++++++ > target/linux/ath79/image/nand.mk | 19 +++ > .../ath79/nand/base-files/etc/board.d/02_network | 3 + > .../etc/hotplug.d/ieee80211/10-fix-wifi-mac | 8 ++ > 4 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..fc88bbd > --- /dev/null > +++ b/target/linux/ath79/dts/qca9531_glinet_gl-e750.dts > @@ -0,0 +1,140 @@ > +// 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"; > + > + pinctrl-names = "default"; > + pinctrl-0 = <&jtag_disable_pins>; > + > + reset { > + label = "reset"; > + linux,code = <KEY_RESTART>; > + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; > + }; > + > + switch { > + label = "switch"; > + linux,code = <BTN_0>; > + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; > + }; > + }; No LEDs? > + > + gpio-export { > + compatible = "gpio-export"; > + #size-cells = <0>; > + > + gpio_lte_power { > + gpio-export,name = "lte_power"; > + gpio-export,output = <1>; > + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; > + }; > + }; Looks like indent issues here. DTS file should be tabs-only. And remove this empty line here, please. > + > +}; > + > +&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>; > + }; > +}; If there is no USB LED, it is enough to just put: &usb0 { status = "okay"; }; > + > +&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 = <0x0 0x40000>; > + read-only; > + }; > + > + partition@40000 { > + label = "u-boot-env"; > + reg = <0x40000 0x10000>; > + }; > + > + art: partition@50000 { > + label = "art"; > + reg = <0x50000 0x10000>; > + read-only; > + }; > + > + partition@60000 { > + label = "kernel"; > + reg = <0x60000 0x400000>; > + }; > + > + partition@460000 { > + label = "reserved"; > + reg = <0x460000 0xba0000>; > + }; > + Unneeded empty line. > + }; > + }; > + > + 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 = <0x0 0x8000000>; > + }; > + }; > + }; > +}; > + > +ð0 { > + status = "okay"; > + > + mtd-mac-address = <&art 0x0>; > + phy-handle = <&swphy4>; > +}; > + > +&wmac { > + status = "okay"; Add empty line after status. > + mtd-cal-data = <&art 0x1000>; > +}; > diff --git a/target/linux/ath79/image/nand.mk > b/target/linux/ath79/image/nand.mk > index f7fc71d..6c18771 100644 > --- a/target/linux/ath79/image/nand.mk > +++ b/target/linux/ath79/image/nand.mk > @@ -147,6 +147,25 @@ 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 usb-storage is typically not added by default. > + SUPPORTED_DEVICES += gl-e750 > + KERNEL_SIZE := 4096k > + IMAGE_SIZE := 131072k > + PAGESIZE := 2048 > + VID_HDR_OFFSET := 2048 > + BLOCKSIZE := 128k > + IMAGES += factory.img > + IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | \ > + append-ubi | check-kernel-size $$$$(KERNEL_SIZE) > + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata 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 > diff --git a/target/linux/ath79/nand/base-files/etc/board.d/02_network > b/target/linux/ath79/nand/base-files/etc/board.d/02_network > index 84cdfd9..7af6f24 100755 > --- a/target/linux/ath79/nand/base-files/etc/board.d/02_network > +++ b/target/linux/ath79/nand/base-files/etc/board.d/02_network > @@ -20,6 +20,9 @@ ath79_setup_interfaces() > ucidef_add_switch "switch0" \ > "0@eth0" "2:lan:2" "3:lan:1" "1:wan" > ;; > + glinet,gl-e750) > + ucidef_set_interface_lan "eth1" > + ;; Why eth1? If that's caused by ð1 being enabled in device tree, you can try to put the following in DTS: ð1 { compatible = "syscon", "simple-mfd"; }; With this, you might be able to use ucidef_set_interface_lan "eth0" > netgear,wndr3700-v4|\ > netgear,wndr4300|\ > netgear,wndr4300sw|\ > diff --git a/target/linux/ath79/nand/base-files/etc/hotplug.d/ieee80211/10- > fix-wifi-mac b/target/linux/ath79/nand/base- > files/etc/hotplug.d/ieee80211/10-fix-wifi-mac > index 6c61e5d..cd306f8 100644 > --- a/target/linux/ath79/nand/base-files/etc/hotplug.d/ieee80211/10-fix- > wifi-mac > +++ b/target/linux/ath79/nand/base-files/etc/hotplug.d/ieee80211/10-fix- > +++ wifi-mac > @@ -15,4 +15,12 @@ case $board in > [ "$PHYNBR" -eq 1 ] && \ > mtd_get_mac_ascii u-boot-env ethaddr > > /sys${DEVPATH}/macaddress > ;; > + glinet,gl-e750) > + # Set mac address for 5g device > + [ "$PHYNBR" -eq 0 ] && { > + mac=$(mtd_get_mac_binary art 0) > + mac_5g=$(macaddr_add $mac 2) > + echo "$mac_5g" > /sys${DEVPATH}/macaddress > + } > + ;; This should be done properly in generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata instead. What about caldata? Is there a valid address in 0x5006? Best Adrian > esac > -- > 2.7.4 > > > > > > _______________________________________________ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> Thank you for pointing out my problem. > Part of the problem I need to explain. > > No LEDs? > --->Yes, no leds > > Why eth1? > > If that's caused by ð1 being enabled in device tree, you can try to put the following in DTS: > > ð1 { > compatible = "syscon", "simple-mfd"; > }; > > With this, you might be able to use > ucidef_set_interface_lan "eth0" > --->the E750 has only one ethernet port, but this port corresponds to eth1 in the system. I still think if there is only one port, it should be eth0 on the running system. I do not see a point to use eth1 and have a non-working eth0 there. And I assume that putting the above node into DTS should achieve just this. > --->In E750, we only use GMAC0, but in ATH79 target, I had to initialize P4 via GMAC1 connected to the Ethernet switch, the GMAC0 corresponds to eth1 and the GMAC1 corresponds to eth0. > --->I have tried to use GMAC0 to initialize P4 directly, but after initializing P4 in this way, the speed of P4 can only be 100M, not 100M/10M. > > This should be done properly in generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata instead. > --->E750 block using eeprom storage calibration data of 9887, when the driving load, also won't call /etc/hotplug.d/firmware/11-ath10k-caldata. > > What about caldata? Is there a valid address in 0x5006? > ---> Calibration data for the E750 is not stored in flash, therefore, the MAC address is not read from 0x5006. > ---> In the production process of GL router, a basic MAC address will be written at the beginning of ART, and I calculate the MAC address of 5G through this MAC address. Okay, then please consolidate the MAC address setup like the following: > + glinet,gl-e750) > + # Set mac address for 5g device > + [ "$PHYNBR" -eq 0 ] && \ > + macaddr_add $(mtd_get_mac_binary art 0x0) 2) > /sys${DEVPATH}/macaddress > + ;; Despite, I'm always happy about a MAC address overview in the commit message, e.g. like here: https://github.com/openwrt/openwrt/commit/edbc8e5512dccc2e0b6925258e34b3f21d66679c Instead of the last byte from an actual address, you might just include the offset relative to one of the addresses. This will help a lot for understanding the setup when looking at the commit in a few years. Despite, if the device has a "label MAC address" printed on a label/the case somewhere, it would be nice to mention which one it is (i.e. which interface has the same address) in the commit message and to implement it in the code (see https://openwrt.org/docs/guide-developer/mac.address#label_mac_address). Best Adrian
> > What about caldata? Is there a valid address in 0x5006? > > ---> Calibration data for the E750 is not stored in flash, therefore, the MAC > address is not read from 0x5006. > > ---> In the production process of GL router, a basic MAC address will be > written at the beginning of ART, and I calculate the MAC address of 5G > through this MAC address. > > Okay, then please consolidate the MAC address setup like the following: > > > + glinet,gl-e750) > > + # Set mac address for 5g device > > + [ "$PHYNBR" -eq 0 ] && \ > > + macaddr_add $(mtd_get_mac_binary art 0x0) 2) > > /sys${DEVPATH}/macaddress > > + ;; BTW: Would the following DTS statement work for your device _instead_ of the code in 10-fix-wifi-mac: &pcie0 { status = "okay"; wifi@0,0 { compatible = "qcom,ath10k"; reg = <0x0000 0 0 0 0>; mtd-mac-address = <&art 0x0>; mtd-mac-address-increment = <2>; }; }; Best Adrian
> BTW: Would the following DTS statement work for your device _instead_ of the code in 10-fix-wifi-mac: > > &pcie0 { > status = "okay"; > > wifi@0,0 { > compatible = "qcom,ath10k"; > reg = <0x0000 0 0 0 0>; > mtd-mac-address = <&art 0x0>; > mtd-mac-address-increment = <2>; > }; > }; > --->I added the above configuration to the DTS file, and the MAC address was not set correctly, so I will keep the current MAC address setting method. Okay. > > If that's caused by ð1 being enabled in device tree, you can try to put the following in DTS: > > ð1 { > compatible = "syscon", "simple-mfd"; > }; > --->As you said, after I added the above configuration to DTS, the system only generated eth0 and it worked. Okay, fine. Best Adrian
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..fc88bbd --- /dev/null +++ b/target/linux/ath79/dts/qca9531_glinet_gl-e750.dts @@ -0,0 +1,140 @@ +// 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"; + + pinctrl-names = "default"; + pinctrl-0 = <&jtag_disable_pins>; + + reset { + label = "reset"; + linux,code = <KEY_RESTART>; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + }; + + switch { + label = "switch"; + linux,code = <BTN_0>; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-export { + compatible = "gpio-export"; + #size-cells = <0>; + + gpio_lte_power { + gpio-export,name = "lte_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 = <0x0 0x40000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x40000 0x10000>; + }; + + art: partition@50000 { + label = "art"; + reg = <0x50000 0x10000>; + read-only; + }; + + partition@60000 { + label = "kernel"; + reg = <0x60000 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 = <0x0 0x8000000>; + }; + }; + }; +}; + +ð0 { + status = "okay"; + + mtd-mac-address = <&art 0x0>; + phy-handle = <&swphy4>; +}; + +&wmac { + status = "okay"; + mtd-cal-data = <&art 0x1000>; +}; diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index f7fc71d..6c18771 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -147,6 +147,25 @@ 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 + SUPPORTED_DEVICES += gl-e750 + KERNEL_SIZE := 4096k + IMAGE_SIZE := 131072k + PAGESIZE := 2048 + VID_HDR_OFFSET := 2048 + BLOCKSIZE := 128k + IMAGES += factory.img + IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | \ + append-ubi | check-kernel-size $$$$(KERNEL_SIZE) + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +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 diff --git a/target/linux/ath79/nand/base-files/etc/board.d/02_network b/target/linux/ath79/nand/base-files/etc/board.d/02_network index 84cdfd9..7af6f24 100755 --- a/target/linux/ath79/nand/base-files/etc/board.d/02_network +++ b/target/linux/ath79/nand/base-files/etc/board.d/02_network @@ -20,6 +20,9 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth0" "2:lan:2" "3:lan:1" "1:wan" ;; + glinet,gl-e750) + ucidef_set_interface_lan "eth1" + ;; netgear,wndr3700-v4|\ netgear,wndr4300|\ netgear,wndr4300sw|\ diff --git a/target/linux/ath79/nand/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac b/target/linux/ath79/nand/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac index 6c61e5d..cd306f8 100644 --- a/target/linux/ath79/nand/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac +++ b/target/linux/ath79/nand/base-files/etc/hotplug.d/ieee80211/10-fix-wifi-mac @@ -15,4 +15,12 @@ case $board in [ "$PHYNBR" -eq 1 ] && \ mtd_get_mac_ascii u-boot-env ethaddr > /sys${DEVPATH}/macaddress ;; + glinet,gl-e750) + # Set mac address for 5g device + [ "$PHYNBR" -eq 0 ] && { + mac=$(mtd_get_mac_binary art 0) + mac_5g=$(macaddr_add $mac 2) + echo "$mac_5g" > /sys${DEVPATH}/macaddress + } + ;; esac
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 firmware: Since openwrt's kernel already exceeds 2MB, upgrading from the official version of GL-inet (v3.100) using the sysupgrade command will break the kernel image. Users who are using version 3.100 can only upgrade via uboot. The official guidance for GL-inet is as follows: https://docs.gl-inet.com/en/3/troubleshooting/debrick/ In the future, GL-inet will modify the firmware to support the sysupgrade command, so users will be able to upgrade directly with the sysupgrade command in future releases. 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 | 140 +++++++++++++++++++++ target/linux/ath79/image/nand.mk | 19 +++ .../ath79/nand/base-files/etc/board.d/02_network | 3 + .../etc/hotplug.d/ieee80211/10-fix-wifi-mac | 8 ++ 4 files changed, 170 insertions(+) create mode 100644 target/linux/ath79/dts/qca9531_glinet_gl-e750.dts