1
1
openwrt/target/linux/realtek/dts/rtl9301_d-link_dgs-1250-28x.dts
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

312 lines
7.0 KiB
Plaintext

// 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 <dt-bindings/leds/common.h>
#include "rtl930x.dtsi"
/ {
compatible = "d-link,dgs-1250-28x", "realtek,rtl9301-soc";
model = "D-Link DGS-1250-28X";
aliases {
label-mac-device = &ethernet0;
led-boot = &led_power;
led-failsafe = &led_console;
led-running = &led_power;
led-upgrade = &led_console;
};
memory@0 {
device_type = "memory";
reg = <0x00000000 0x10000000>;
};
fan: gpio-fan {
compatible = "gpio-fan";
gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>;
alarm-gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
/* simple on/off values as LM75 alert pin steers fan high/low speed */
gpio-fan,speed-map = <0 0>, <1 1>;
#cooling-cells = <2>;
};
i2c-gpio-shared {
compatible = "i2c-gpio-shared";
scl-gpios = <&gpio0 14 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
#address-cells = <1>;
#size-cells = <0>;
i2c0: i2c@0 {
sda-gpios = <&gpio0 17 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
i2c-gpio,delay-us = <5>;
};
i2c1: i2c@1 {
sda-gpios = <&gpio0 18 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
i2c-gpio,delay-us = <5>;
};
i2c2: i2c@2 {
sda-gpios = <&gpio0 19 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
i2c-gpio,delay-us = <5>;
};
i2c3: i2c@3 {
sda-gpios = <&gpio0 20 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
i2c-gpio,delay-us = <5>;
};
};
i2c4: i2c-gpio-4 {
compatible = "i2c-gpio";
sda-gpios = <&gpio0 15 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
scl-gpios = <&gpio0 13 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
i2c-gpio,delay-us = <5>;
#address-cells = <1>;
#size-cells = <0>;
gpio1: gpio-expander@20 {
compatible = "nxp,pca9555";
reg = <0x20>;
gpio-controller;
#gpio-cells = <2>;
};
temperature_sensor: temperature-sensor@48 {
compatible = "microchip,tcn75";
reg = <0x48>;
#thermal-sensor-cells = <0>;
ti,alert-polarity-active-high;
};
eeprom@50 {
compatible = "atmel,24c02";
reg = <0x50>;
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
mac_address: mac-address@10 {
reg = <0x10 0x6>;
};
};
};
};
keys {
compatible = "gpio-keys";
reset {
label = "reset";
gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
};
led_set {
compatible = "realtek,rtl9300-leds";
active-low;
/*
* 1G Ports LED0 (green): 1G/LINK/ACT
* 1G Ports LED1 (orange): 10M/100M/LINK/ACT
*/
led_set0 = <(RTL93XX_LED_SET_1G | RTL93XX_LED_SET_LINK | RTL93XX_LED_SET_ACT)
(RTL93XX_LED_SET_10M | RTL93XX_LED_SET_100M |
RTL93XX_LED_SET_LINK | RTL93XX_LED_SET_ACT)>;
/*
* 10G Ports LED0 (green): 10G/LINK/ACT
* 10G Ports LED1 (orange): 10M/100M/1G/2.5G/5G/LINK/ACT
*/
led_set1 = <(RTL93XX_LED_SET_10G | RTL93XX_LED_SET_LINK | RTL93XX_LED_SET_ACT)
(RTL93XX_LED_SET_10M | RTL93XX_LED_SET_100M | RTL93XX_LED_SET_1G |
RTL93XX_LED_SET_2P5G | RTL93XX_LED_SET_5G |
RTL93XX_LED_SET_LINK | RTL93XX_LED_SET_ACT)>;
};
leds: leds {
pinctrl-names = "default";
pinctrl-0 = <&pinmux_disable_sys_led>;
compatible = "gpio-leds";
led_power: led-0 {
function = LED_FUNCTION_POWER;
color = <LED_COLOR_ID_GREEN>;
gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
};
led_console: led-1 {
function = LED_FUNCTION_STATUS;
color = <LED_COLOR_ID_GREEN>;
gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
};
led_fault: led-2 {
function = LED_FUNCTION_FAULT;
color = <LED_COLOR_ID_RED>;
gpios = <&gpio0 2 GPIO_ACTIVE_LOW>;
};
};
sfp0: sfp-p24 {
compatible = "sff,sfp";
i2c-bus = <&i2c0>;
mod-def0-gpio = <&gpio1 0 GPIO_ACTIVE_LOW>;
tx-disable-gpio = <&gpio1 1 GPIO_ACTIVE_HIGH>;
tx-fault-gpio = <&gpio1 2 GPIO_ACTIVE_HIGH>;
los-gpio = <&gpio1 3 GPIO_ACTIVE_HIGH>;
};
sfp1: sfp-p25 {
compatible = "sff,sfp";
i2c-bus = <&i2c1>;
mod-def0-gpio = <&gpio1 4 GPIO_ACTIVE_LOW>;
tx-disable-gpio = <&gpio1 5 GPIO_ACTIVE_HIGH>;
tx-fault-gpio = <&gpio1 6 GPIO_ACTIVE_HIGH>;
los-gpio = <&gpio1 7 GPIO_ACTIVE_HIGH>;
};
sfp2: sfp-p26 {
compatible = "sff,sfp";
i2c-bus = <&i2c2>;
mod-def0-gpio = <&gpio1 8 GPIO_ACTIVE_LOW>;
tx-disable-gpio = <&gpio1 9 GPIO_ACTIVE_HIGH>;
tx-fault-gpio = <&gpio1 10 GPIO_ACTIVE_HIGH>;
los-gpio = <&gpio1 11 GPIO_ACTIVE_HIGH>;
};
sfp3: sfp-p27 {
compatible = "sff,sfp";
i2c-bus = <&i2c3>;
mod-def0-gpio = <&gpio1 12 GPIO_ACTIVE_LOW>;
tx-disable-gpio = <&gpio1 13 GPIO_ACTIVE_HIGH>;
tx-fault-gpio = <&gpio1 14 GPIO_ACTIVE_HIGH>;
los-gpio = <&gpio1 15 GPIO_ACTIVE_HIGH>;
};
};
&spi0 {
status = "okay";
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 0x100000>;
read-only;
};
partition@100000 {
label = "u-boot-env";
reg = <0x100000 0x80000>;
};
partition@180000 {
label = "u-boot-env2";
reg = <0x180000 0x80000>;
};
partition@200000 {
label = "firmware";
compatible = "openwrt,uimage";
reg = <0x200000 0x3e00000>;
};
};
};
};
&mdio_bus0 {
PHY_C22(0, 0)
PHY_C22(1, 1)
PHY_C22(2, 2)
PHY_C22(3, 3)
PHY_C22(4, 4)
PHY_C22(5, 5)
PHY_C22(6, 6)
PHY_C22(7, 7)
};
&mdio_bus1 {
PHY_C22(8, 8)
PHY_C22(9, 9)
PHY_C22(10, 10)
PHY_C22(11, 11)
PHY_C22(12, 12)
PHY_C22(13, 13)
PHY_C22(14, 14)
PHY_C22(15, 15)
};
&mdio_bus2 {
PHY_C22(16, 16)
PHY_C22(17, 17)
PHY_C22(18, 18)
PHY_C22(19, 19)
PHY_C22(20, 20)
PHY_C22(21, 21)
PHY_C22(22, 22)
PHY_C22(23, 23)
};
&switch0 {
ethernet-ports {
#address-cells = <1>;
#size-cells = <0>;
SWITCH_PORT_LED(0, 1, 0, 0, 0, qsgmii)
SWITCH_PORT_LED(1, 2, 0, 1, 0, qsgmii)
SWITCH_PORT_LED(2, 3, 0, 2, 0, qsgmii)
SWITCH_PORT_LED(3, 4, 0, 3, 0, qsgmii)
SWITCH_PORT_LED(4, 5, 1, 0, 0, qsgmii)
SWITCH_PORT_LED(5, 6, 1, 1, 0, qsgmii)
SWITCH_PORT_LED(6, 7, 1, 2, 0, qsgmii)
SWITCH_PORT_LED(7, 8, 1, 3, 0, qsgmii)
SWITCH_PORT_LED(8, 9, 2, 0, 0, usxgmii)
SWITCH_PORT_LED(9, 10, 2, 1, 0, usxgmii)
SWITCH_PORT_LED(10, 11, 2, 2, 0, usxgmii)
SWITCH_PORT_LED(11, 12, 2, 3, 0, usxgmii)
SWITCH_PORT_LED(12, 13, 2, 4, 0, usxgmii)
SWITCH_PORT_LED(13, 14, 2, 5, 0, usxgmii)
SWITCH_PORT_LED(14, 15, 2, 6, 0, usxgmii)
SWITCH_PORT_LED(15, 16, 2, 7, 0, usxgmii)
SWITCH_PORT_LED(16, 17, 3, 0, 0, usxgmii)
SWITCH_PORT_LED(17, 18, 3, 1, 0, usxgmii)
SWITCH_PORT_LED(18, 19, 3, 2, 0, usxgmii)
SWITCH_PORT_LED(19, 20, 3, 3, 0, usxgmii)
SWITCH_PORT_LED(20, 21, 3, 4, 0, usxgmii)
SWITCH_PORT_LED(21, 22, 3, 5, 0, usxgmii)
SWITCH_PORT_LED(22, 23, 3, 6, 0, usxgmii)
SWITCH_PORT_LED(23, 24, 3, 7, 0, usxgmii)
SWITCH_PORT_SFP(24, 25, 4, 1, 0)
SWITCH_PORT_SFP(25, 26, 6, 1, 1)
SWITCH_PORT_SFP(26, 27, 8, 1, 2)
SWITCH_PORT_SFP(27, 28, 9, 1, 3)
port@28 {
reg = <28>;
ethernet = <&ethernet0>;
phy-mode = "internal";
fixed-link {
speed = <1000>;
full-duplex;
};
};
};
};
&ethernet0 {
nvmem-cells = <&mac_address>;
nvmem-cell-names = "mac-address";
};