I noticed that the LEDs esw with the SoC rt5350 have reversed polarity.!

to correct the polatirà leds, I made this change to the file ramips_esw.c

--- a/drivers/net/ethernet/ramips/ramips_esw.c
+++ b/drivers/net/ethernet/ramips/ramips_esw.c
@@ -48,6 +48,7 @@
 #define RT305X_ESW_REG_P3PC            0xf4
 #define RT305X_ESW_REG_P4PC            0xf8
 #define RT305X_ESW_REG_P5PC            0xfc
+#define RT305X_EWS_REG_LED_POLARITY     0x168

 #define RT305X_ESW_LED_LINK            0
 #define RT305X_ESW_LED_100M            1
@@ -450,6 +451,12 @@ rt305x_esw_hw_init(struct rt305x_esw *es
                rt305x_esw_wr(esw, esw->pdata->reg_initval_fpa2,
RT305X_ESW_REG_FPA2);
        rt305x_esw_wr(esw, 0x00000000, RT305X_ESW_REG_FPA);

+       /* Invert polarity led on rt5350 */
+       if (soc_is_rt5350()) {
+               rt305x_esw_wr(esw, 0x1F, RT305X_EWS_REG_LED_POLARITY);
+        }
+
+
        /* Force Link/Activity on ports */
        rt305x_esw_wr(esw, 0x00000005, RT305X_ESW_REG_P0LED);
        rt305x_esw_wr(esw, 0x00000005, RT305X_ESW_REG_P1LED);

Ayyari
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to