1
1
openwrt/target/linux/realtek/dts/rtl9313_zyxel_xs1930-aqr813.dtsi
Jonas Jelonek 43562f97e7
realtek: dts: add link index cell to pcs-handle phandles
A SerDes can host multiple PCS links: QSGMII binds four ports to one
SerDes, USXGMII variants up to eight. Today pcs-handle references the
SerDes as a whole, with no way to express which link inside the SerDes
a port wants. The driver gets away with this because it carries its own
port->link bookkeeping and the link slot is implicit in DSA's port
iteration order -- functional, but the wiring information lives nowhere
in DT.

The upcoming fwnode_pcs migration moves PCS lookup to the generic
fwnode provider API, which disambiguates multiple instances per fwnode
via phandle cells. To make that landable as small, code-only commits,
the DT needs to carry the link index ahead of time.

Bump #pcs-cells from 0 to 1 on every SerDes node in the four SoC DTSIs
and append the link cell to every pcs-handle reference across boards
and the SWITCH_PORT_* macros. Cell values match the existing wiring:
0 for single-link SerDes (10GBase-R, SGMII, fiber, single-link
USXGMII), 0..3 per SerDes for QSGMII and USXGMII-QX, 0..7 for the
RTL9311 octal USXGMII layout.

No code reads the new cell yet -- of_parse_phandle_with_args() in the
PCS driver already cooperates with cells = 0 or 1, and the DSA glue
uses of_parse_phandle() which ignores cells entirely. The change is
runtime-neutral on its own; it exists so the follow-up code patches
can be a few lines each instead of dragging a bridge counter into the
driver to invent slot numbers DT could have provided directly.

Link: https://github.com/openwrt/openwrt/pull/23539
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-05-31 12:52:40 +02:00

184 lines
4.0 KiB
Plaintext

// SPDX-License-Identifier: GPL-2.0-or-later
/dts-v1/;
#include "rtl9313_zyxel_xs1930.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>
#include <dt-bindings/mux/mux.h>
#include <dt-bindings/phy/phy.h>
/ {
sfp_gpio_mux: gpio-mux {
compatible = "gpio-mux";
mux-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>,
<&gpio0 14 GPIO_ACTIVE_HIGH>;
#mux-control-cells = <0>;
idle-state = <MUX_IDLE_AS_IS>;
};
sfp1_gpio: sfp-gpio-1 {
compatible = "gpio-line-mux";
gpio-controller;
#gpio-cells = <2>;
mux-controls = <&sfp_gpio_mux>;
muxed-gpio = <&gpio0 19 GPIO_ACTIVE_HIGH>;
gpio-line-names = "SFP1_LOS", "SFP1_MOD_ABS", "SFP1_TX_FAULT";
gpio-line-mux-states = <0>, <1>, <3>;
};
sfp2_gpio: sfp-gpio-2 {
compatible = "gpio-line-mux";
gpio-controller;
#gpio-cells = <2>;
mux-controls = <&sfp_gpio_mux>;
muxed-gpio = <&gpio0 27 GPIO_ACTIVE_HIGH>;
gpio-line-names = "SFP2_LOS", "SFP2_MOD_ABS", "SFP2_TX_FAULT";
gpio-line-mux-states = <0>, <1>, <3>;
};
sfp1: sfp-p1 {
compatible = "sff,sfp";
i2c-bus = <&i2c0>;
los-gpio = <&sfp1_gpio 0 GPIO_ACTIVE_HIGH>;
mod-def0-gpio = <&sfp1_gpio 1 GPIO_ACTIVE_LOW>;
tx-disable-gpio = <&gpio0 5 GPIO_ACTIVE_HIGH>;
tx-fault-gpio = <&sfp1_gpio 2 GPIO_ACTIVE_HIGH>;
};
sfp2: sfp-p2 {
compatible = "sff,sfp";
i2c-bus = <&i2c1>;
los-gpio = <&sfp2_gpio 0 GPIO_ACTIVE_HIGH>;
mod-def0-gpio = <&sfp2_gpio 1 GPIO_ACTIVE_LOW>;
tx-disable-gpio = <&gpio0 11 GPIO_ACTIVE_HIGH>;
tx-fault-gpio = <&sfp2_gpio 2 GPIO_ACTIVE_HIGH>;
};
};
&gpio0 {
pinctrl-names = "default";
pinctrl-0 = <&pinmux_disable_jtag>;
/*
* GPIO 31 is the global reset pin shared by all PHYs across all MDIO
* buses. It is intentionally not declared as reset-gpios on any bus:
* the MDIO driver / phylink only support a reset GPIO per bus, not on
* the parent controller. Attaching it to a single bus would still reset
* the PHYs on the other buses as a side effect, leaving their software
* state out of sync with the hardware and likely breaking them.
*/
phy_reset_hog {
gpio-hog;
gpios = <31 GPIO_ACTIVE_LOW>;
output-low;
line-name = "phy-reset";
};
sfp_enable_hog {
gpio-hog;
gpios = <6 GPIO_ACTIVE_LOW>,
<7 GPIO_ACTIVE_LOW>;
output-high;
line-name = "sfp-enable";
};
};
&i2c_mst1 {
status = "okay";
i2c0: i2c@0 {
reg = <0>;
};
i2c1: i2c@1 {
reg = <1>;
};
i2c2: i2c@2 {
reg = <2>;
lm96000: lm96000@2e {
compatible = "national,lm85";
reg = <0x2e>;
};
};
};
&mdio_bus0 {
/* AQR813 */
PHY_C45(0, 8)
PHY_C45(8, 9)
PHY_C45(16, 10)
PHY_C45(24, 11)
PHY_C45(32, 12)
PHY_C45(40, 13)
PHY_C45(48, 14)
PHY_C45(50, 15)
};
&switch0 {
ethernet-ports {
#address-cells = <1>;
#size-cells = <0>;
/* Copper ports behind AQR813 */
SWITCH_PORT_LED(0, 1, 2, 0, 0, usxgmii)
SWITCH_PORT_LED(8, 2, 3, 0, 0, usxgmii)
SWITCH_PORT_LED(16, 3, 4, 0, 0, usxgmii)
SWITCH_PORT_LED(24, 4, 5, 0, 0, usxgmii)
SWITCH_PORT_LED(32, 5, 6, 0, 0, usxgmii)
SWITCH_PORT_LED(40, 6, 7, 0, 0, usxgmii)
SWITCH_PORT_LED(48, 7, 8, 0, 0, usxgmii)
SWITCH_PORT_LED(50, 8, 9, 0, 0, usxgmii)
/* CPU port */
port@56 {
ethernet = <&ethernet0>;
reg = <56>;
phy-mode = "internal";
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
};
&port0 { managed = "in-band-status"; };
&port8 { managed = "in-band-status"; };
&port16 { managed = "in-band-status"; };
&port24 { managed = "in-band-status"; };
&port32 { managed = "in-band-status"; };
&port40 { managed = "in-band-status"; };
&port48 { managed = "in-band-status"; };
&port50 { managed = "in-band-status"; };
&serdes6 {
rx-polarity = <PHY_POL_INVERT>;
tx-polarity = <PHY_POL_INVERT>;
};
&serdes7 {
rx-polarity = <PHY_POL_INVERT>;
tx-polarity = <PHY_POL_INVERT>;
};
&serdes8 {
rx-polarity = <PHY_POL_INVERT>;
tx-polarity = <PHY_POL_INVERT>;
};
&serdes9 {
rx-polarity = <PHY_POL_INVERT>;
tx-polarity = <PHY_POL_INVERT>;
};
&serdes12 { tx-polarity = <PHY_POL_INVERT>; };
&serdes13 { tx-polarity = <PHY_POL_INVERT>; };