Le 09/05/2013 10:06, Lixus a écrit :
> 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
Your solution is the same as Vasily:
<http://patchwork.openwrt.org/patch/3537/>
But actually, it depends: all the LEDs, including the wmac- and esw-controlled
LEDs may be turned on by sourcing current to them (if their cathode is tied to
GND), or by sinking current from them (if their anode is tied to VCC),
resulting in active-high or active-low LEDs, thus depending on the way they are
connected onto the board.
So you can't just invert the polarity like above and expect it to work for all
RT5350-based board.
I am working on a patch that stores a "ralink,led-polarity" property into the
esw section of the DTS file (3.8 kernel only), so this can be set up according
to each individual board.
For < 3.8, I suggest you to put your added lines to the corresponding board
support mach-*.c file instead.
This is the same problem for wmac-attached LEDs, I will soon provide a patch
for this one to this list.
-Michel
>
>
> _______________________________________________
> openwrt-devel mailing list
> [email protected]
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel