ramips: pinmux fixes
[openwrt/openwrt.git] / target / linux / ramips / patches-3.8 / 0123-MIPS-ralink-fix-uartmux-group-handling.patch
1 From 34a9a634432a95d8ae9af86d41fdaf32fb039c2c Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Wed, 27 Mar 2013 21:10:14 +0100
4 Subject: [PATCH 1/5] MIPS: ralink: fix uartmux group handling
5
6 * don't try get 'ralink,uartmux' porperty if the pinmux.uart is
7 not initialized,
8 * don't touch 'mode' value if mux mask is zero
9
10 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
11 ---
12 arch/mips/ralink/pinmux.c | 12 ++++++++----
13 1 file changed, 8 insertions(+), 4 deletions(-)
14
15 --- a/arch/mips/ralink/pinmux.c
16 +++ b/arch/mips/ralink/pinmux.c
17 @@ -56,15 +56,19 @@ void ralink_pinmux(void)
18 }
19 }
20
21 - of_property_read_string(np, "ralink,uartmux", &uart);
22 + uart = NULL;
23 + if (rt_pinmux.uart)
24 + of_property_read_string(np, "ralink,uartmux", &uart);
25 +
26 if (uart) {
27 int m = ralink_mux_mask(uart, rt_pinmux.uart);
28 - mode |= rt_pinmux.uart_mask << rt_pinmux.uart_shift;
29 +
30 if (m) {
31 - mode &= ~(m << rt_pinmux.uart_shift);
32 + mode &= ~(rt_pinmux.uart_mask << rt_pinmux.uart_shift);
33 + mode |= m << rt_pinmux.uart_shift;
34 pr_debug("pinmux: registered uartmux \"%s\"\n", uart);
35 } else {
36 - pr_debug("pinmux: registered uartmux \"gpio\"\n");
37 + pr_debug("pinmux: unknown uartmux \"%s\"\n", uart);
38 }
39 }
40