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

realtek: add ZyXEL GS1900-24 v1 support #9400

Closed
wants to merge 1 commit into from

Conversation

Hurricos
Copy link
Contributor

@Hurricos Hurricos commented Mar 5, 2022

The ZyXEL GS1900-24 v1 is a 24 port switch with two SFP ports, similar to
the other GS1900 switches.

Specifications

  • Device: ZyXEL GS1900-24 v1

  • SoC: Realtek RTL8382M 500 MHz MIPS 4KEc

  • Flash: 16 MiB

  • RAM: Winbond W9751G8KB-25 64 MiB DDR2 SDRAM

  • Ethernet: 24x 10/100/1000 Mbps, 2x SFP 100/1000 Mbps

  • LEDs:

    • 1 PWR LED (green, not configurable)
    • 1 SYS LED (green, configurable)
    • 24 ethernet port link/activity LEDs (green, SoC controlled)
    • 2 SFP status/activity LEDs (green, SoC controlled)
  • Buttons:

    • 1 "RESET" button on front panel (soft reset)
    • 1 button ('SW1') behind right hex grate (hardwired power-off)
  • Power: 120-240V AC C13

  • UART: Internal populated 10-pin header ('J5') providing RS232;
    connected to SoC UART through a SIPEX 3232EC for voltage
    level shifting.

  • 'J5' RS232 Pinout (dot as pin 1):
    2) SoC RXD
    3) GND
    10) SoC TXD

Serial connection parameters: 115200 8N1.

Installation

OEM upgrade method:

  • Log in to OEM management web interface

  • Navigate to Maintenance > Firmware > Management

  • If "Active Image" has the first option selected, OpenWrt will need to be
    flashed to the "Active" partition. If the second option is selected,
    OpenWrt will need to be flashed to the "Backup" partition.

  • Navigate to Maintenance > Firmware > Upload

  • Upload the openwrt-realtek-rtl838x-zyxel_gs1900-24-v1-initramfs-kernel.bin
    file by your preferred method to the previously determined partition.
    When prompted, select to boot from the newly flashed image, and reboot
    the switch.

  • Once OpenWrt has booted, scp the sysupgrade image to /tmp and flash it:

    sysupgrade /tmp/openwrt-realtek-rtl838x-zyxel_gs1900-24-v1-squashfs-sysupgrade.bin

U-Boot TFTP method:

  • Configure your client with a static 192.168.1.x IP (e.g. 192.168.1.10).

  • Set up a TFTP server on your client and make it serve the initramfs
    image.

  • Connect serial, power up the switch, interrupt U-boot by hitting the
    space bar, and enable the network:

    rtk network on

Since the GS1900-24 v1 is a dual-partition device, you want to keep the
OEM firmware on the backup partition for the time being. OpenWrt can
only be installed in the first partition anyway (hardcoded in the
DTS). To ensure we are set to boot from the first partition, issue the
following commands:

setsys bootpartition 0
savesys

  • Download the image onto the device and boot from it:

    tftpboot 0x81f00000 192.168.1.10:openwrt-realtek-rtl838x-zyxel_gs1900-24-v1-initramfs-kernel.bin
    bootm

  • Once OpenWrt has booted, scp the sysupgrade image to /tmp and flash it:

    sysupgrade /tmp/openwrt-realtek-rtl838x-zyxel_gs1900-24-v1-squashfs-sysupgrade.bin

Signed-off-by: Martin Kennedy hurricos@gmail.com

@Hurricos
Copy link
Contributor Author

Hurricos commented Mar 5, 2022

Pinging @svanheule: Do you think you could take a look at this device port?

@Hurricos
Copy link
Contributor Author

Hurricos commented Mar 5, 2022

Here is a gist of dmesg, for those who are curious:

@hauke hauke added new device pull request with new device target/realtek pull request/issue for realtek target labels Mar 5, 2022
Copy link
Member

@svanheule svanheule left a comment

Choose a reason for hiding this comment

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

Since GitHub doesn't allow me to comment on the commit message (why!?), I've included a verbatim quote with my comments:

The ZyXEL GS1900-24 v1 is a 24 port switch with two SFP ports, similar to
the other GS1900 switches.

Specifications
--------------
* Device:    ZyXEL GS1900-24 v1
* SoC:       Realtek RTL8382M 500 MHz MIPS 4KEc
* Flash:     16 MiB
* RAM:       Winbond W9751G8KB-25 64 MiB DDR2 SDRAM
* Ethernet:  24x 10/100/1000 Mbps, 2x SFP 100/1000 Mbps
* LEDs:
  * 1 PWR LED (green, not configurable)
  * 1 SYS LED (green, configurable)
  * 24 ethernet port link/activity LEDs (green, SoC controlled)
  * 2 SFP status/activity LEDs (green, SoC controlled)

Maybe I've lost track of progress, but do these LEDs function when cold booting OpenWrt?

* Buttons:
  * 1 "RESET" button on front panel (soft reset)
  * 1 button ('SW1') behind right hex grate (hardwired power-off)
* Power:     120-240V AC C13
* UART:      Internal populated 10-pin header ('J5') providing RS232;
             connected to SoC UART through a SIPEX 3232EC for voltage
             level shifting.

* 'J5' RS232 Pinout (dot as pin 1):
  2) SoC RXD
  3) GND
  10) SoC TXD

Serial connection parameters: 115200 8N1.

Installation
------------

OEM upgrade method:

* Log in to OEM management web interface

* Navigate to Maintenance > Firmware > Management

* If "Active Image" has the first option selected, OpenWrt will need to be
  flashed to the "Active" partition. If the second option is selected,
  OpenWrt will need to be flashed to the "Backup" partition.

* Navigate to Maintenance > Firmware > Upload

* Upload the openwrt-realtek-generic-zyxel_gs1900-24-v1-initramfs-kernel.bin
  file by your preferred method to the previously determined partition.
  When prompted, select to boot from the newly flashed image, and reboot
  the switch.

The image name should now be openwrt-realtek-rtl838x-.... Same for the occurrences below.


* Once OpenWrt has booted, scp the sysupgrade image to /tmp and flash it:

  > sysupgrade /tmp/openwrt-realtek-generic-zyxel_gs1900-24-v1-squashfs-sysupgrade.bin

U-Boot TFTP method:

* Configure your client with a static 192.168.1.x IP (e.g. 192.168.1.10).

* Set up a TFTP server on your client and make it serve the initramfs
  image.

* Connect serial, power up the switch, interrupt U-boot by hitting the
  space bar, and enable the network:

  > rtk network on

* Since the GS1900-24 v1 is a dual-partition device, you want to keep the
  OEM firmware on the backup partition for the time being. OpenWrt can
  only boot from the first partition anyway (hardcoded in the DTS). To
  make sure we are manipulating the first partition, issue the following
  commands:

  > setsys bootpartition 0
  > savesys

Like with the OEM method, this selects the first partition as the active one. However, you're not manipulating any (other) flash contents from the bootloader. Could you reword this?

* Download the image onto the device and boot from it:

  > tftpboot 0x81f00000 192.168.1.10:openwrt-realtek-generic-zyxel_gs1900-24-v1-initramfs-kernel.bin
  > bootm

* Once OpenWrt has booted, scp the sysupgrade image to /tmp and flash it:

  > sysupgrade /tmp/openwrt-realtek-generic-zyxel_gs1900-24-v1-squashfs-sysupgrade.bin


/ {
compatible = "zyxel,gs1900-24-v1", "realtek,rtl838x-soc";
model = "ZyXEL GS1900-24 v1 Switch";
Copy link
Member

Choose a reason for hiding this comment

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

Some other devices appear to have "Switch" too (in particular ZyXEL devices), but in general "router" or "access point" is added either. Just [brand] [model] [revision] is sufficient.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe I've lost track of progress, but do these LEDs function when cold booting OpenWrt?

Yes! When I boot the switch and wait for it to finish, then connect to each ethernet port, each LED works.

I will add that I don't have a plain SFP module to test whether the SFP port LEDs work.

The image name should now be openwrt-realtek-rtl838x-.... Same for the occurrences below.

You are correct. Corrected in force-push commit c672429.

Like with the OEM method, this selects the first partition as the active one. However, you're not manipulating any (other) flash contents from the bootloader. Could you reword this?

I have reworded this as of force-push commit c672429. Note that I pulled this comment almost directly from the GS1900-24HPv2 port.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some other devices appear to have "Switch" too (in particular ZyXEL devices), but in general "router" or "access point" is added either. Just [brand] [model] [revision] is sufficient.

Also fixed in force-pushed commit c672429.

SWITCH_PORT(22, 23, qsgmii)
SWITCH_PORT(23, 24, qsgmii)


Copy link
Member

Choose a reason for hiding this comment

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

You should also drop this extra empty line.

Copy link
Contributor Author

@Hurricos Hurricos Mar 6, 2022

Choose a reason for hiding this comment

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

Fixed in force-push commit c672429.

The ZyXEL GS1900-24 v1 is a 24 port switch with two SFP ports, similar to
the other GS1900 switches.

Specifications
--------------
* Device:    ZyXEL GS1900-24 v1
* SoC:       Realtek RTL8382M 500 MHz MIPS 4KEc
* Flash:     16 MiB
* RAM:       Winbond W9751G8KB-25 64 MiB DDR2 SDRAM
* Ethernet:  24x 10/100/1000 Mbps, 2x SFP 100/1000 Mbps
* LEDs:
  * 1 PWR LED (green, not configurable)
  * 1 SYS LED (green, configurable)
  * 24 ethernet port link/activity LEDs (green, SoC controlled)
  * 2 SFP status/activity LEDs (green, SoC controlled)
* Buttons:
  * 1 "RESET" button on front panel (soft reset)
  * 1 button ('SW1') behind right hex grate (hardwired power-off)
* Power:     120-240V AC C13
* UART:      Internal populated 10-pin header ('J5') providing RS232;
             connected to SoC UART through a SIPEX 3232EC for voltage
             level shifting.

* 'J5' RS232 Pinout (dot as pin 1):
  2) SoC RXD
  3) GND
  10) SoC TXD

Serial connection parameters: 115200 8N1.

Installation
------------

OEM upgrade method:

* Log in to OEM management web interface

* Navigate to Maintenance > Firmware > Management

* If "Active Image" has the first option selected, OpenWrt will need to be
  flashed to the "Active" partition. If the second option is selected,
  OpenWrt will need to be flashed to the "Backup" partition.

* Navigate to Maintenance > Firmware > Upload

* Upload the openwrt-realtek-rtl838x-zyxel_gs1900-24-v1-initramfs-kernel.bin
  file by your preferred method to the previously determined partition.
  When prompted, select to boot from the newly flashed image, and reboot
  the switch.

* Once OpenWrt has booted, scp the sysupgrade image to /tmp and flash it:

  > sysupgrade /tmp/openwrt-realtek-rtl838x-zyxel_gs1900-24-v1-squashfs-sysupgrade.bin

U-Boot TFTP method:

* Configure your client with a static 192.168.1.x IP (e.g. 192.168.1.10).

* Set up a TFTP server on your client and make it serve the initramfs
  image.

* Connect serial, power up the switch, interrupt U-boot by hitting the
  space bar, and enable the network:

  > rtk network on

> Since the GS1900-24 v1 is a dual-partition device, you want to keep the
  OEM firmware on the backup partition for the time being. OpenWrt can
  only be installed in the first partition anyway (hardcoded in the
  DTS). To ensure we are set to boot from the first partition, issue the
  following commands:

  > setsys bootpartition 0
  > savesys

* Download the image onto the device and boot from it:

  > tftpboot 0x81f00000 192.168.1.10:openwrt-realtek-rtl838x-zyxel_gs1900-24-v1-initramfs-kernel.bin
  > bootm

* Once OpenWrt has booted, scp the sysupgrade image to /tmp and flash it:

  > sysupgrade /tmp/openwrt-realtek-rtl838x-zyxel_gs1900-24-v1-squashfs-sysupgrade.bin

Signed-off-by: Martin Kennedy <hurricos@gmail.com>
Copy link
Member

@svanheule svanheule left a comment

Choose a reason for hiding this comment

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

Starting to look good to me. It might be good to have an RTL8382 DTSI at some point, so the ports don't have to be redefined every single time.

#include "rtl8380_zyxel_gs1900.dtsi"

/ {
compatible = "zyxel,gs1900-24-v1", "realtek,rtl838x-soc";
Copy link
Member

Choose a reason for hiding this comment

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

Second part should be "realtek,rtl8382-soc"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Starting to look good to me. It might be good to have an RTL8382 DTSI at some point, so the ports don't have to be redefined every single time.

I may do this, actually. I suppose it would need to be part of a different PR?

I pulled the device tree almost entirely from the ZyXEL GS1900-24HP v2 and it worked immediately; I'm also preparing the ZyxEL GS1900-24HP v1 port. The device trees are almost all exactly identical bar the obvious (deleting the poe node for this board, changing the memory, etc.).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

... here's the tree for the GS1900-24HP v1, in case you're curious: https://github.com/hurricos/openwrt/tree/add_gs1900-24hp-v1

Copy link
Member

Choose a reason for hiding this comment

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

I may do this, actually. I suppose it would need to be part of a different PR?

That would probably be the best option, since this kind of refactoring is often a matter of personal taste and can take some time. So let's do this one and the GS1900-24HPv1 first, and then look at how we can tidy things up.

@hauke
Copy link
Member

hauke commented Mar 13, 2022

Thank you for your patch, I applied it to master in d1a8690.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new device pull request with new device target/realtek pull request/issue for realtek target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants