Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ath79: add support for GL.iNet GL-X300B #4246

Closed
wants to merge 1 commit into from

Conversation

johnfzc
Copy link
Contributor

@johnfzc johnfzc commented Jun 8, 2021

The GL-X300B is a industrial 4G LTE router based on the Qualcomm QCA9531 SoC.

Specifications:

  • Qualcomm QCA9531 @ 650 MHz
  • 128 MB of RAM
  • 16 MB of SPI NOR FLASH
  • 2x 10/100 Mbps Ethernet
  • 2.4GHz 802.11b/g/n
  • 1x USB 2.0 (vbus driven by GPIO)
  • 4x LED, driven by GPIO
  • 1x button (reset)
  • 1x mini pci-e slot (vcc driven by GPIO)
  • RS-485 Serial Port (untested)

Flash instructions:

This firmware can be flashed using either sysupgrade from the GL.iNet
firmware or the recovery console as follows:

  • Press and hold the reset button
  • Connect power to the router, wait five seconds
  • Manually configure 192.168.1.2/24 on your computer, connect to 192.168.1.1
  • Upload the firmware image using the web interface

RS-485 serial port is untested and may depend on the following commit in
the GL.iNet repo:

gl-inet@202e83a

MAC addresses as verified by OEM firmware:

vendor OpenWrt address
WAN eth0 label
LAN eth1 label + 1
2g phy0 label + 2

The label MAC address was found in the art partition at 0x0

Based on vendor commit:

gl-inet@16c5708

Signed-off-by: John Marrett johnf@zioncluster.ca

@adschm adschm added target/ath25 pull request/issue for ath25 target target/ath79 pull request/issue for ath79 target and removed target/ath25 pull request/issue for ath25 target labels Jun 9, 2021
@adschm
Copy link
Member

adschm commented Jun 9, 2021

Use the uboot recovery console (hold reset while powering on for five seconds)
to flash the firmware,

Please describe what to do exactly.

target/linux/ath79/dts/qca9531_glinet_gl-x300b.dts Outdated Show resolved Hide resolved
target/linux/ath79/dts/qca9531_glinet_gl-x300b.dtsi Outdated Show resolved Hide resolved
target/linux/ath79/dts/qca9531_glinet_gl-x300b.dtsi Outdated Show resolved Hide resolved
target/linux/ath79/dts/qca9531_glinet_gl-x300b.dtsi Outdated Show resolved Hide resolved
target/linux/ath79/dts/qca9531_glinet_gl-x300b.dtsi Outdated Show resolved Hide resolved
target/linux/ath79/dts/qca9531_glinet_gl-x300b.dtsi Outdated Show resolved Hide resolved
target/linux/ath79/generic/base-files/etc/board.d/01_leds Outdated Show resolved Hide resolved
target/linux/ath79/generic/base-files/etc/board.d/01_leds Outdated Show resolved Hide resolved
target/linux/ath79/image/generic.mk Outdated Show resolved Hide resolved
target/linux/ath79/image/generic.mk Outdated Show resolved Hide resolved
@johnfzc
Copy link
Contributor Author

johnfzc commented Jun 10, 2021

Thank you very much for taking the time to review this, I will push in a commit that addresses most of these issues tomorrow and will identify outstanding questions on my end. This is my first device support commit and I greatly appreciate your detailed review patience. Thanks again.

@johnfzc
Copy link
Contributor Author

johnfzc commented Jun 11, 2021

I believe I've addressed almost all of the issues identified, some feedback was unclear to me, probably because of my lack of experience in this space. I'm eager to address the outstanding issue. Once this is complete I will apply outstanding corrections on #4245 .

Thanks again for your help and patience, really appreciate it.

EDIT: I'm assuming that you will perform a squash commit to merge these changes with the revised commit message included in the PR, if you need me to rework the edits into a single commit in my branch please let me know and I will do so.

@johnfzc
Copy link
Contributor Author

johnfzc commented Jun 17, 2021

@adschm thank you very much for taking the time to review my commit, I've made most of the the changes you have requested however I didn't understand some of the feedback you've provided. Can you please take a look at the updated code and outstanding unresolved comments and clarify them so that I can address them. Thank you again for your time.

Regarding the dtsi and dts files I used a dtsi as support for variants of this device could benefit from it. if you would prefer I can integrate the dtsi into the dts file. I do not plan to work on support myself, at present, beyond these two base images.

I've amended my commit and it now shows as a single change from a git perspective.

I have updated #4245 as well and will continue to do so based on your feedback here.

target/linux/ath79/dts/qca9531_glinet_gl-x300b.dtsi Outdated Show resolved Hide resolved
target/linux/ath79/dts/qca9531_glinet_gl-x300b.dtsi Outdated Show resolved Hide resolved
target/linux/ath79/dts/qca9531_glinet_gl-x300b.dtsi Outdated Show resolved Hide resolved
target/linux/ath79/dts/qca9531_glinet_gl-x300b.dtsi Outdated Show resolved Hide resolved
target/linux/ath79/dts/qca9531_glinet_gl-x300b.dtsi Outdated Show resolved Hide resolved
target/linux/ath79/dts/qca9531_glinet_gl-x300b.dtsi Outdated Show resolved Hide resolved
target/linux/ath79/dts/qca9531_glinet_gl-x300b.dtsi Outdated Show resolved Hide resolved
target/linux/ath79/generic/base-files/etc/board.d/01_leds Outdated Show resolved Hide resolved
target/linux/ath79/generic/base-files/etc/board.d/01_leds Outdated Show resolved Hide resolved
@adschm
Copy link
Member

adschm commented Jun 20, 2021

Please add a MAC address overview to your commit message:
https://openwrt.org/docs/guide-developer/device-support-policies#mac_addresses

@johnfzc johnfzc force-pushed the gl-x300b branch 4 times, most recently from 9fdf4b0 to 4a35d4a Compare June 21, 2021 17:02
@johnfzc
Copy link
Contributor Author

johnfzc commented Jun 21, 2021

I believe that every issue identified in the review is now addressed, I have updated the commit message to include the MAC table and amended the installation process. It is possible to switch to OpenWrt using sysupgrade on this platform.

Please let me know if there are any remaining issues @adschm, thank you for your time.

@johnfzc johnfzc requested a review from adschm June 21, 2021 17:11
@johnfzc
Copy link
Contributor Author

johnfzc commented Jul 7, 2021

I believe that all outstanding issues are fully addressed, I'm confident that the fix I've used for the rs485_pin is the right solution. Can you please reconsider your previous position and complete the review @adschm. Despite the challenges we both faced I assure you my intentions are to resolve all of the outstanding issues and get this device into OpenWrt, I'm far from the only person interested in it.

Copy link
Member

@blocktrron blocktrron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add the switch config to 02_network, even if only CPU + 1 port is used.

target/linux/ath79/dts/qca9531_glinet_gl-x300b.dtsi Outdated Show resolved Hide resolved
target/linux/ath79/generic/base-files/etc/board.d/01_leds Outdated Show resolved Hide resolved
@johnfzc
Copy link
Contributor Author

johnfzc commented Jul 29, 2021

Please also add the switch config to 02_network, even if only CPU + 1 port is used.

I'm not certain how to add this device to 02_network. It appears to be getting some kind of default config that includes a WAN and LAN port, the interfaces are correctly enumerated with this config. I looked to see how this was handled with a similar device, the gl-mifi, but I don't see it or anything else I could use as a reference.

@blocktrron
Copy link
Member

@johnfzc

Can you provide the output of swconfig dev switch0 show?

@johnfzc
Copy link
Contributor Author

johnfzc commented Jul 29, 2021

Here's the swconfig output:

Global attributes:
        enable_vlan: 0
        ar8xxx_mib_poll_interval: 500
        ar8xxx_mib_type: 0
        enable_mirror_rx: 0
        enable_mirror_tx: 0
        mirror_monitor_port: 0
        mirror_source_port: 0
        arl_table: address resolution table
Port 0: MAC 94:83:c4:0c:05:bb
Port 4: MAC 00:e0:4c:bd:26:38

Port 0:
        mib: MIB counters
RxGoodByte  : 890039 (869.1 KiB)
TxByte      : 262963 (256.7 KiB)

        pvid: 0
        link: port:0 link:up speed:1000baseT full-duplex txflow rxflow
Port 1:
        mib: No MIB data
        pvid: 0
        link: port:1 link:down
Port 2:
        mib: No MIB data
        pvid: 0
        link: port:2 link:down
Port 3:
        mib: No MIB data
        pvid: 0
        link: port:3 link:down
Port 4:
        mib: MIB counters
RxGoodByte  : 263873 (257.6 KiB)
TxByte      : 124257 (121.3 KiB)

        pvid: 0
        link: port:4 link:up speed:100baseT full-duplex auto

From a networking perspective the WAN is eth1 and functions correctly, LAN is a bridge on eth0. I believe that eth0 goes through the switch chip to the "LAN" port on the router. I'm not certain exactly how eth1 is working and if it makes use of the switch chip; we don't see a second port active here and there's no VLAN associated with eth1, at least that I see.

@blocktrron
Copy link
Member

See the QCA9531 datasheet on how the switch is connected.

I was asking about the Switch config, as this allows UCI to display link state information. port 4 is the external one while port 0 is connected to the CPU MAC. Can you add the appropriate config section?

The GL-X300B is a industrial 4G LTE router based on the Qualcomm QCA9531 SoC.

Specifications:
 - Qualcomm QCA9531 @ 650 MHz
 - 128 MB of RAM
 - 16 MB of SPI NOR FLASH
 - 2x 10/100 Mbps Ethernet
 - 2.4GHz 802.11b/g/n
 - 1x USB 2.0 (vbus driven by GPIO)
 - 4x LED, driven by GPIO
 - 1x button (reset)
 - 1x mini pci-e slot (vcc driven by GPIO)
 - RS-485 Serial Port (untested)

Flash instructions:

This firmware can be flashed using either sysupgrade from the GL.iNet
firmware or the recovery console as follows:

 - Press and hold the reset button
 - Connect power to the router, wait five seconds
 - Manually configure 192.168.1.2/24 on your computer, connect to 192.168.1.1
 - Upload the firmware image using the web interface

RS-485 serial port is untested and may depend on the following commit in
the GL.iNet repo:

gl-inet@202e83a

MAC addresses as verified by OEM firmware:

vendor   OpenWrt   address
WAN      eth0      label
LAN      eth1      label + 1
2g       phy0      label + 2

The label MAC address was found in the art partition at 0x0

Based on vendor commit:

gl-inet@16c5708

Signed-off-by: John Marrett <johnf@zioncluster.ca>
@johnfzc
Copy link
Contributor Author

johnfzc commented Jul 30, 2021

I believe I added the appropriate configuration to target/linux/ath79/generic/base-files/etc/board.d/02_network, however it doesn't appear to work.

I added:

	glinet,gl-x300b)
		ucidef_set_interface_wan "eth1"
		ucidef_add_switch "switch0" \
			"0@eth0" "4:lan"
		;;

However, when I ssh through the WAN port with the LAN disconnected and boot the device I see the following log messages:

Fri Jul 30 15:54:45 2021 daemon.notice netifd: bridge 'br-lan' link is up
Fri Jul 30 15:54:45 2021 daemon.notice netifd: Interface 'lan' has link connectivity
Fri Jul 30 15:54:45 2021 daemon.notice netifd: Network device 'eth0' link is up
Fri Jul 30 15:54:45 2021 daemon.notice netifd: VLAN 'eth0.1' link is up

This occurs even though port 4 is down:

root@OpenWrt:~# swconfig dev switch0 show
[...]
Port 4:
        mib: No MIB data
        pvid: 1
        link: port:4 link:down

Can you please tell me what I did wrong either with the change or validating it? Thanks very much for your help!

@blocktrron
Copy link
Member

When installing LuCI, can you see the port state at Network --> switch?

@johnfzc
Copy link
Contributor Author

johnfzc commented Jul 31, 2021

Yes, the port state in the luci interface is working correctly.

@blocktrron
Copy link
Member

Merged to my staging tree, thanks!

@blocktrron blocktrron closed this Aug 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs changes target/ath79 pull request/issue for ath79 target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants