Skip to content

Realtek: Merge RTL9300 support #3773

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

Closed
wants to merge 13 commits into from
Prev Previous commit
realtek: new device support ZyXEL XGS1210-12
The ZyXEL XGS1210-12 is a 8x1GBit, 2x2.5GBit and 2x10GBit SFP+
switch. The device has the following hardware:
    - RTL9302B SoC
    - Macronix MX25L12833F (16MB flash)
    - Nanja NT5CC64M16GP-1 (128MB DDR3 SDRAM)
    - RTL8231 GPIO extender to control the port LEDs
    - RTL8218D 8x Gigabit PHY
    - 2 RTL8226 2.5 Gigabit PHYs
The 2 SFP+ uplink ports are not supported by the realtek switch driver, yet.
The bi-color and tri-color (for the 2.5 Gig ports) LEDs are driven directly by
the SoC. A reset button is present on the front but not supported.
Behind the air-vents on the right a 3.3V uart header is externally accessible.
Pins are from top to bottom Vcc(3.3V), TX, RX and GND. Serial connection is via
115200 baud.

To install, boot into u-boot, halt via pressing <ESC>, load initramfs via tftp
and boot via bootm.
Installation to flash was not tested.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
  • Loading branch information
Birger Koblitz committed Jan 26, 2021
commit cc3d79962b33237aa5a4b2f6883a1f185f23f70f
121 changes: 121 additions & 0 deletions target/linux/realtek/dts/rtl9302_zyxel_xgs1210-12.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/dts-v1/;

#include "rtl930x.dtsi"

#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>

/ {
compatible = "zyxel,xgs1210-12", "realtek,rtl838x-soc";
model = "Zyxel XGS1210-12 Switch";

// mw.l 0xb8003308 0x00200000 active low toggles PHY reset
chosen {
bootargs = "console=ttyS0,115200";
};
};

&spi0 {
status = "okay";
Copy link
Member

Choose a reason for hiding this comment

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

Add empty line after status.

flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <10000000>;

partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

partition@0 {
label = "u-boot";
reg = <0x0 0xe0000>;
read-only;
};
partition@e0000 {
label = "u-boot-env";
reg = <0xe0000 0x10000>;
read-only;
};
partition@f0000 {
label = "u-boot-env2";
reg = <0xf0000 0x10000>;
read-only;
};
partition@100000 {
label = "jffs";
reg = <0x100000 0x100000>;
};
partition@200000 {
label = "jffs2";
reg = <0x200000 0x100000>;
};
partition@300000 {
label = "firmware";
reg = <0x300000 0xd00000>;
compatible = "denx,uimage";
Copy link
Member

Choose a reason for hiding this comment

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

Installation to flash was not tested.

Not sure about the reason. But since Bjørns "use device tree properties for non-standard uimage parsing" patches are merged, the image splitting should work with the following changes:

compatible = "openwrt,uimage", "denx,uimage";
openwrt,partition-magic = <0x93001210>;

Copy link
Author

Choose a reason for hiding this comment

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

Flashing was not tested because I was not sure to get the flash back into factory configuration. I also want to discourage people who believe this device will already flawlessly run. In contrast to other Realtek switches, u-boot on this device does not properly initialize and patch the 2.5 GBit PHYs and the 10GBit SerDes', the SDK code suggests without proper patching there might be compatibility issues in particular with Marvel chips. For efficient testing I will need to go back and forth for some more time between the original firmware and owrt. I would be happy if someone else wants to add the compatibility properties and try flashing.

Copy link
Member

@adschm adschm Jan 24, 2021

Choose a reason for hiding this comment

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

I'd be happy if we not merge this device support commit then, and keep it open as a separate PR after the rest has been merged. The normal expection is that stuff which is built by buildbots can be expected to work.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, the rest should be good to go i think, I just gave it a spin locally and things appear to be in place

Copy link
Author

Choose a reason for hiding this comment

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

Happy with that, thanks for everyone's support!

};
};
};
};

&ethernet0 {
mdio: mdio-bus {
compatible = "realtek,rtl838x-mdio";
regmap = <&ethernet0>;
#address-cells = <1>;
#size-cells = <0>;

/* External RTL8218D PHY */
EXTERNAL_PHY(0)
EXTERNAL_PHY(1)
EXTERNAL_PHY(2)
EXTERNAL_PHY(3)
EXTERNAL_PHY(4)
EXTERNAL_PHY(5)
EXTERNAL_PHY(6)
EXTERNAL_PHY(7)

/* External RTL8226B PHYs */
phy24: ethernet-phy@24 {
reg = <24>;
compatible = "ethernet-phy-ieee802.3-c45";
};

phy25: ethernet-phy@25 {
reg = <25>;
compatible = "ethernet-phy-ieee802.3-c45";
};
};
};

&switch0 {
ports {
#address-cells = <1>;
#size-cells = <0>;

SWITCH_PORT(0, 1, qsgmii)
SWITCH_PORT(1, 2, qsgmii)
SWITCH_PORT(2, 3, qsgmii)
SWITCH_PORT(3, 4, qsgmii)
SWITCH_PORT(4, 5, qsgmii)
SWITCH_PORT(5, 6, qsgmii)
SWITCH_PORT(6, 7, qsgmii)
SWITCH_PORT(7, 8, qsgmii)

SWITCH_PORT(24, 9, qsgmii)
SWITCH_PORT(25, 10, qsgmii)

/* CPU Port */
port@28 {
ethernet = <&ethernet0>;
reg = <28>;
phy-mode = "internal";
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
};
8 changes: 8 additions & 0 deletions target/linux/realtek/image/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,12 @@ define Device/zyxel_gs1900-8hp-v2
endef
TARGET_DEVICES += zyxel_gs1900-8hp-v2

define Device/zyxel_xgs1210-12
SOC := rtl9302
UIMAGE_MAGIC := 0x93001210
DEVICE_VENDOR := Zyxel
DEVICE_MODEL := XGS1210-12
endef
TARGET_DEVICES += zyxel_xgs1210-12

$(eval $(call BuildImage))