Opened 5 years ago

Last modified 5 years ago

#13488 new defect

[ramips] [rt5350] led esw polarity reversed

Reported by: Ayyari Owned by: developers
Priority: normal Milestone: Chaos Calmer 15.05
Component: kernel Version: Trunk
Keywords: ramips_esw, ethernet, led, rt5350, ralink Cc:


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);

Attachments (0)

Change History (2)

comment:1 Changed 5 years ago by anonymous

It's only for your board. My d-link dir-320b1 (rt5350 based) use 0x17 polarity value.

comment:2 Changed 5 years ago by anonymous

In patchwork I saw patch for polarity control via swconfig

Add Comment

Modify Ticket

as new .

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.