2
0
forked from Ivasoft/openwrt

realtek: dsa: support active-high LEDs

The TP-LINK TL-ST1008F has active-high LEDs, so we need a device tree
property to express this.

Signed-off-by: Lorenz Brun <lorenz@brun.one>
[Tidy up code, restrict changes to 5.15]
Signed-off-by: Sander Vanheule <sander@svanheule.net>
This commit is contained in:
Lorenz Brun
2022-12-28 20:54:21 +01:00
committed by Sander Vanheule
parent d84dc5d4d7
commit bec9e79a99
2 changed files with 10 additions and 0 deletions

View File

@@ -21,6 +21,8 @@
#define RTL930X_VLAN_PORT_TAG_STS_CTRL_IGR_P_OTAG_KEEP_MASK GENMASK(1,1)
#define RTL930X_VLAN_PORT_TAG_STS_CTRL_IGR_P_ITAG_KEEP_MASK GENMASK(0,0)
#define RTL930X_LED_GLB_ACTIVE_LOW BIT(22)
extern struct mutex smi_lock;
extern struct rtl83xx_soc_info soc_info;
@@ -2431,6 +2433,12 @@ static void rtl930x_led_init(struct rtl838x_switch_priv *priv)
/* Set LED mode to serial (0x1) */
sw_w32_mask(0x3, 0x1, RTL930X_LED_GLB_CTRL);
/* Set LED active state */
if (of_property_read_bool(node, "active-low"))
sw_w32_mask(RTL930X_LED_GLB_ACTIVE_LOW, 0, RTL930X_LED_GLB_CTRL);
else
sw_w32_mask(0, RTL930X_LED_GLB_ACTIVE_LOW, RTL930X_LED_GLB_CTRL);
/* Set port type masks */
sw_w32(pm, RTL930X_LED_PORT_COPR_MASK_CTRL);
sw_w32(pm, RTL930X_LED_PORT_FIB_MASK_CTRL);