03.05.2013, 15:40, "Michel Stempin" <[email protected]>:
> The mask m is only null when there is no "ralink,uartmux" property defined in 
> DTS.
>
> When the "ralink,uartmux" property is set to "gpio", m will be equal to 
> RT305X_GPIO_MODE_GPIO, i.e. all bits sets in the uart_mask, thus the proper 
> way to do it is to compare m against the uart_mask for equality.
>
> Signed-off-by: Michel Stempin <[email protected]>
> ---
>
> diff 
> a/target/linux/ramips/patches-3.8/0128-MIPS-ralink-add-pinmux-driver.patch 
> b/target/linux/ramips/patches-3.8/0128-MIPS-ralink-add-pinmux-driver.patch
> --- a/target/linux/ramips/patches-3.8/0128-MIPS-ralink-add-pinmux-driver.patch
> +++ b/target/linux/ramips/patches-3.8/0128-MIPS-ralink-add-pinmux-driver.patch
> @@ -112,7 +112,7 @@ Signed-off-by: John Crispin <[email protected]>
>  +      if (uart) {
>  +              int m = ralink_mux_mask(uart, rt_gpio_pinmux.uart);
>  +              mode |= rt_gpio_pinmux.uart_mask << rt_gpio_pinmux.uart_shift;
> -+              if (m) {
> ++              if (m != rt_gpio_pinmux.uart_mask) {
>  +                      mode &= ~(m << rt_gpio_pinmux.uart_shift);
>  +                      pr_debug("pinmux: registered uartmux \"%s\"\n", uart);
>  +              } else {

I think you are wrong. If m == 0 (uart full) mode you get ... gpio mode again 
:). In all case you really get inversed m mode: 0 -> 7; 1 ->6; 2->5 and so on. 
Only m==7 will work as you want because of if condition. Code:

mode &= ~(rt_gpio_pinmux.uart_mask << rt_gpio_pinmux.uart_shift);
mode |= (m << rt_gpio_pinmux.uart_shift);

works in all case.

---
serge
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to