openwrt/target/linux/realtek/dts/macros.dtsi
Manuel Stocker 79a6d2aab2 realtek: support configurable LED interface mode on RTL930x
Add support for changing the LED mode via the device tree.
Currently it always defaults to SERIAL mode. With this change,
one can also use the SINGLE_COLOR_SCAN and BI_COLOR_SCAN modes.

Signed-off-by: Manuel Stocker <mensi@mensi.ch>
Link: https://github.com/openwrt/openwrt/pull/23160
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-05-03 01:32:52 +02:00

93 lines
2.3 KiB
Plaintext

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;
#define STRINGIZE(s) #s
#define LAN_LABEL(p, s) STRINGIZE(p ## s)
#define SWITCH_PORT_LABEL(n) LAN_LABEL(lan, n)
#define PHY_C22(p, n) \
phy##p: ethernet-phy@n { \
reg = <##n>; \
compatible = "ethernet-phy-ieee802.3-c22"; \
};
#define PHY_C22_SFP(p, n, s) \
phy##p: ethernet-phy@n { \
reg = <##n>; \
compatible = "ethernet-phy-ieee802.3-c22"; \
sfp = <&sfp##s>; \
};
#define PHY_C45(p, n) \
phy##p: ethernet-phy@n { \
reg = <##n>; \
compatible = "ethernet-phy-ieee802.3-c45"; \
};
#define PHY_C45_PAIR_ORDER(p, n, po) \
phy##p: ethernet-phy@n { \
reg = <##n>; \
compatible = "ethernet-phy-ieee802.3-c45"; \
enet-phy-pair-order = <##po>; \
};
#define SWITCH_PORT(p, l, m) \
port##p: port@##p { \
reg = <##p>; \
label = SWITCH_PORT_LABEL(l) ; \
phy-handle = <&phy##p>; \
phy-mode = #m ; \
};
#define SWITCH_PORT_SDS(p, l, s, m) \
port##p: port@##p { \
reg = <##p>; \
label = SWITCH_PORT_LABEL(l) ; \
pcs-handle = <&serdes##s>; \
phy-handle = <&phy##p>; \
phy-mode = #m ; \
};
#define SWITCH_PORT_LED(p, l, s, c, m) \
port##p: port@##p { \
reg = <##p>; \
label = SWITCH_PORT_LABEL(l) ; \
led-set = <##c>; \
pcs-handle = <&serdes##s>; \
phy-handle = <&phy##p>; \
phy-mode = #m ; \
};
#define SWITCH_PORT_SFP(p, l, s, c, g) \
port##p: port@##p { \
reg = <##p>; \
label = SWITCH_PORT_LABEL(l) ; \
led-set = <##c>; \
pcs-handle = <&serdes##s>; \
phy-mode = "1000base-x"; \
sfp = <&sfp##g>; \
managed = "in-band-status"; \
};
/* LED Set mode definitions */
#define RTL93XX_LED_SET_NONE (0)
#define RTL93XX_LED_SET_10G (1 << 0)
#define RTL93XX_LED_SET_5G (1 << 1)
#define RTL93XX_LED_SET_2P5G (1 << 3)
#define RTL93XX_LED_SET_1G (1 << 5)
#define RTL93XX_LED_SET_100M (1 << 7)
#define RTL93XX_LED_SET_10M (1 << 8)
#define RTL93XX_LED_SET_LINK (1 << 9)
#define RTL93XX_LED_SET_LINK_BLINK (1 << 10)
#define RTL93XX_LED_SET_ACT (1 << 11)
#define RTL93XX_LED_SET_RX (1 << 12)
#define RTL93XX_LED_SET_TX (1 << 13)
#define RTL93XX_LED_SET_COLLISION (1 << 14)
#define RTL93XX_LED_SET_DUPLEX (1 << 15)
/* LED Interface modes */
#define RTL93XX_LED_MODE_SERIAL 1
#define RTL93XX_LED_MODE_SINGLE_COLOR_SCAN 2
#define RTL93XX_LED_MODE_BI_COLOR_SCAN 3