Kaynağa Gözat

realtek: rtl931x: Add support for active-low LEDs

RTL930x received support for specifying active low/high LEDs in commit
bec9e79a99ad ("realtek: dsa: support active-high LEDs"). But this was
completely forgotten on RTL931x.

Signed-off-by: Sven Eckelmann <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/20300
Signed-off-by: Hauke Mehrtens <[email protected]>
Sven Eckelmann 6 ay önce
ebeveyn
işleme
38d35f413d

+ 2 - 0
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.h

@@ -582,6 +582,8 @@ typedef enum {
 #define RTL931X_LED_PORT_FIB_MASK_CTRL		(0x065c)
 #define RTL931X_LED_PORT_COMBO_MASK_CTRL	(0x0664)
 
+#define RTL931X_LED_GLB_ACTIVE_LOW BIT(21)
+
 #define MAX_VLANS 4096
 #define MAX_LAGS 16
 #define MAX_PRIOS 8

+ 5 - 0
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c

@@ -1538,6 +1538,11 @@ static void rtldsa_931x_led_init(struct rtl838x_switch_priv *priv)
 	/* Set LED mode to serial (0x1) */
 	sw_w32_mask(0x3, 0x1, RTL931X_LED_GLB_CTRL);
 
+	if (of_property_read_bool(node, "active-low"))
+		sw_w32_mask(RTL931X_LED_GLB_ACTIVE_LOW, 0, RTL931X_LED_GLB_CTRL);
+	else
+		sw_w32_mask(0, RTL931X_LED_GLB_ACTIVE_LOW, RTL931X_LED_GLB_CTRL);
+
 	rtl839x_set_port_reg_le(pm_copper, RTL931X_LED_PORT_COPR_MASK_CTRL);
 	rtl839x_set_port_reg_le(pm_fiber, RTL931X_LED_PORT_FIB_MASK_CTRL);
 	rtl839x_set_port_reg_le(pm_copper | pm_fiber, RTL931X_LED_PORT_COMBO_MASK_CTRL);