05d95484da2ca66557c7d28f41deb7cb946a2db3
[openwrt.git] / target / linux / ramips / patches-3.10 / 0217-pinmux-rt2880.patch
1 Index: linux-3.10.32/arch/mips/ralink/rt288x.c
2 ===================================================================
3 --- linux-3.10.32.orig/arch/mips/ralink/rt288x.c        2014-02-22 20:41:54.000000000 +0000
4 +++ linux-3.10.32/arch/mips/ralink/rt288x.c     2014-03-18 11:18:06.689596876 +0000
5 @@ -17,46 +17,27 @@
6  #include <asm/mipsregs.h>
7  #include <asm/mach-ralink/ralink_regs.h>
8  #include <asm/mach-ralink/rt288x.h>
9 +#include <asm/mach-ralink/pinmux.h>
10  
11  #include "common.h"
12  
13 -static struct ralink_pinmux_grp mode_mux[] = {
14 -       {
15 -               .name = "i2c",
16 -               .mask = RT2880_GPIO_MODE_I2C,
17 -               .gpio_first = 1,
18 -               .gpio_last = 2,
19 -       }, {
20 -               .name = "spi",
21 -               .mask = RT2880_GPIO_MODE_SPI,
22 -               .gpio_first = 3,
23 -               .gpio_last = 6,
24 -       }, {
25 -               .name = "uartlite",
26 -               .mask = RT2880_GPIO_MODE_UART0,
27 -               .gpio_first = 7,
28 -               .gpio_last = 14,
29 -       }, {
30 -               .name = "jtag",
31 -               .mask = RT2880_GPIO_MODE_JTAG,
32 -               .gpio_first = 17,
33 -               .gpio_last = 21,
34 -       }, {
35 -               .name = "mdio",
36 -               .mask = RT2880_GPIO_MODE_MDIO,
37 -               .gpio_first = 22,
38 -               .gpio_last = 23,
39 -       }, {
40 -               .name = "sdram",
41 -               .mask = RT2880_GPIO_MODE_SDRAM,
42 -               .gpio_first = 24,
43 -               .gpio_last = 39,
44 -       }, {
45 -               .name = "pci",
46 -               .mask = RT2880_GPIO_MODE_PCI,
47 -               .gpio_first = 40,
48 -               .gpio_last = 71,
49 -       }, {0}
50 +static struct rt2880_pmx_func i2c_func[] = { FUNC("i2c", 0, 1, 2) };
51 +static struct rt2880_pmx_func spi_func[] = { FUNC("spi", 0, 3, 6) };
52 +static struct rt2880_pmx_func uartlite_func[] = { FUNC("uartlite", 0, 7, 14) };
53 +static struct rt2880_pmx_func jtag_func[] = { FUNC("jtag", 0, 17, 21) };
54 +static struct rt2880_pmx_func mdio_func[] = { FUNC("mdio", 0, 22, 23) };
55 +static struct rt2880_pmx_func sdram_func[] = { FUNC("sdram", 0, 24, 39) };
56 +static struct rt2880_pmx_func pci_func[] = { FUNC("pci", 0, 40, 71) };
57 +
58 +static struct rt2880_pmx_group rt2880_pinmux_data_act[] = {
59 +    GRP("i2c", i2c_func, 1, RT2880_GPIO_MODE_I2C),
60 +    GRP("spi", spi_func, 1, RT2880_GPIO_MODE_SPI),
61 +    GRP("uartlite", uartlite_func, 1, RT2880_GPIO_MODE_UART0),
62 +    GRP("jtag", jtag_func, 1, RT2880_GPIO_MODE_JTAG),
63 +    GRP("mdio", mdio_func, 1, RT2880_GPIO_MODE_MDIO),
64 +    GRP("sdram", sdram_func, 1, RT2880_GPIO_MODE_SDRAM),
65 +    GRP("pci", pci_func, 1, RT2880_GPIO_MODE_PCI),
66 +    { 0 }
67  };
68  
69  static void rt288x_wdt_reset(void)
70 @@ -69,11 +50,6 @@
71         rt_sysc_w32(t, SYSC_REG_CLKCFG);
72  }
73  
74 -struct ralink_pinmux rt_gpio_pinmux = {
75 -       .mode = mode_mux,
76 -       .wdt_reset = rt288x_wdt_reset,
77 -};
78 -
79  void __init ralink_clk_init(void)
80  {
81         unsigned long cpu_rate;
82 @@ -140,4 +116,6 @@
83         soc_info->mem_base = RT2880_SDRAM_BASE;
84         soc_info->mem_size_min = RT2880_MEM_SIZE_MIN;
85         soc_info->mem_size_max = RT2880_MEM_SIZE_MAX;
86 +
87 +        rt2880_pinmux_data = rt2880_pinmux_data_act;
88  }