diff options
Diffstat (limited to 'arch/mips/ralink/rt305x.c')
-rw-r--r-- | arch/mips/ralink/rt305x.c | 153 |
1 files changed, 68 insertions, 85 deletions
diff --git a/arch/mips/ralink/rt305x.c b/arch/mips/ralink/rt305x.c index bb82a82da9e7..c40776ab67db 100644 --- a/arch/mips/ralink/rt305x.c +++ b/arch/mips/ralink/rt305x.c | |||
@@ -17,90 +17,78 @@ | |||
17 | #include <asm/mipsregs.h> | 17 | #include <asm/mipsregs.h> |
18 | #include <asm/mach-ralink/ralink_regs.h> | 18 | #include <asm/mach-ralink/ralink_regs.h> |
19 | #include <asm/mach-ralink/rt305x.h> | 19 | #include <asm/mach-ralink/rt305x.h> |
20 | #include <asm/mach-ralink/pinmux.h> | ||
20 | 21 | ||
21 | #include "common.h" | 22 | #include "common.h" |
22 | 23 | ||
23 | enum rt305x_soc_type rt305x_soc; | 24 | enum rt305x_soc_type rt305x_soc; |
24 | 25 | ||
25 | static struct ralink_pinmux_grp mode_mux[] = { | 26 | static struct rt2880_pmx_func i2c_func[] = { FUNC("i2c", 0, 1, 2) }; |
26 | { | 27 | static struct rt2880_pmx_func spi_func[] = { FUNC("spi", 0, 3, 4) }; |
27 | .name = "i2c", | 28 | static struct rt2880_pmx_func uartf_func[] = { |
28 | .mask = RT305X_GPIO_MODE_I2C, | 29 | FUNC("uartf", RT305X_GPIO_MODE_UARTF, 7, 8), |
29 | .gpio_first = RT305X_GPIO_I2C_SD, | 30 | FUNC("pcm uartf", RT305X_GPIO_MODE_PCM_UARTF, 7, 8), |
30 | .gpio_last = RT305X_GPIO_I2C_SCLK, | 31 | FUNC("pcm i2s", RT305X_GPIO_MODE_PCM_I2S, 7, 8), |
31 | }, { | 32 | FUNC("i2s uartf", RT305X_GPIO_MODE_I2S_UARTF, 7, 8), |
32 | .name = "spi", | 33 | FUNC("pcm gpio", RT305X_GPIO_MODE_PCM_GPIO, 11, 4), |
33 | .mask = RT305X_GPIO_MODE_SPI, | 34 | FUNC("gpio uartf", RT305X_GPIO_MODE_GPIO_UARTF, 7, 4), |
34 | .gpio_first = RT305X_GPIO_SPI_EN, | 35 | FUNC("gpio i2s", RT305X_GPIO_MODE_GPIO_I2S, 7, 4), |
35 | .gpio_last = RT305X_GPIO_SPI_CLK, | 36 | }; |
36 | }, { | 37 | static struct rt2880_pmx_func uartlite_func[] = { FUNC("uartlite", 0, 15, 2) }; |
37 | .name = "uartlite", | 38 | static struct rt2880_pmx_func jtag_func[] = { FUNC("jtag", 0, 17, 5) }; |
38 | .mask = RT305X_GPIO_MODE_UART1, | 39 | static struct rt2880_pmx_func mdio_func[] = { FUNC("mdio", 0, 22, 2) }; |
39 | .gpio_first = RT305X_GPIO_UART1_TXD, | 40 | static struct rt2880_pmx_func rt5350_led_func[] = { FUNC("led", 0, 22, 5) }; |
40 | .gpio_last = RT305X_GPIO_UART1_RXD, | 41 | static struct rt2880_pmx_func rt5350_cs1_func[] = { |
41 | }, { | 42 | FUNC("spi_cs1", 0, 27, 1), |
42 | .name = "jtag", | 43 | FUNC("wdg_cs1", 1, 27, 1), |
43 | .mask = RT305X_GPIO_MODE_JTAG, | 44 | }; |
44 | .gpio_first = RT305X_GPIO_JTAG_TDO, | 45 | static struct rt2880_pmx_func sdram_func[] = { FUNC("sdram", 0, 24, 16) }; |
45 | .gpio_last = RT305X_GPIO_JTAG_TDI, | 46 | static struct rt2880_pmx_func rt3352_rgmii_func[] = { |
46 | }, { | 47 | FUNC("rgmii", 0, 24, 12) |
47 | .name = "mdio", | 48 | }; |
48 | .mask = RT305X_GPIO_MODE_MDIO, | 49 | static struct rt2880_pmx_func rgmii_func[] = { FUNC("rgmii", 0, 40, 12) }; |
49 | .gpio_first = RT305X_GPIO_MDIO_MDC, | 50 | static struct rt2880_pmx_func rt3352_lna_func[] = { FUNC("lna", 0, 36, 2) }; |
50 | .gpio_last = RT305X_GPIO_MDIO_MDIO, | 51 | static struct rt2880_pmx_func rt3352_pa_func[] = { FUNC("pa", 0, 38, 2) }; |
51 | }, { | 52 | static struct rt2880_pmx_func rt3352_led_func[] = { FUNC("led", 0, 40, 5) }; |
52 | .name = "sdram", | 53 | |
53 | .mask = RT305X_GPIO_MODE_SDRAM, | 54 | static struct rt2880_pmx_group rt3050_pinmux_data[] = { |
54 | .gpio_first = RT305X_GPIO_SDRAM_MD16, | 55 | GRP("i2c", i2c_func, 1, RT305X_GPIO_MODE_I2C), |
55 | .gpio_last = RT305X_GPIO_SDRAM_MD31, | 56 | GRP("spi", spi_func, 1, RT305X_GPIO_MODE_SPI), |
56 | }, { | 57 | GRP("uartf", uartf_func, RT305X_GPIO_MODE_UART0_MASK, |
57 | .name = "rgmii", | 58 | RT305X_GPIO_MODE_UART0_SHIFT), |
58 | .mask = RT305X_GPIO_MODE_RGMII, | 59 | GRP("uartlite", uartlite_func, 1, RT305X_GPIO_MODE_UART1), |
59 | .gpio_first = RT305X_GPIO_GE0_TXD0, | 60 | GRP("jtag", jtag_func, 1, RT305X_GPIO_MODE_JTAG), |
60 | .gpio_last = RT305X_GPIO_GE0_RXCLK, | 61 | GRP("mdio", mdio_func, 1, RT305X_GPIO_MODE_MDIO), |
61 | }, {0} | 62 | GRP("rgmii", rgmii_func, 1, RT305X_GPIO_MODE_RGMII), |
63 | GRP("sdram", sdram_func, 1, RT305X_GPIO_MODE_SDRAM), | ||
64 | { 0 } | ||
62 | }; | 65 | }; |
63 | 66 | ||
64 | static struct ralink_pinmux_grp uart_mux[] = { | 67 | static struct rt2880_pmx_group rt3352_pinmux_data[] = { |
65 | { | 68 | GRP("i2c", i2c_func, 1, RT305X_GPIO_MODE_I2C), |
66 | .name = "uartf", | 69 | GRP("spi", spi_func, 1, RT305X_GPIO_MODE_SPI), |
67 | .mask = RT305X_GPIO_MODE_UARTF, | 70 | GRP("uartf", uartf_func, RT305X_GPIO_MODE_UART0_MASK, |
68 | .gpio_first = RT305X_GPIO_7, | 71 | RT305X_GPIO_MODE_UART0_SHIFT), |
69 | .gpio_last = RT305X_GPIO_14, | 72 | GRP("uartlite", uartlite_func, 1, RT305X_GPIO_MODE_UART1), |
70 | }, { | 73 | GRP("jtag", jtag_func, 1, RT305X_GPIO_MODE_JTAG), |
71 | .name = "pcm uartf", | 74 | GRP("mdio", mdio_func, 1, RT305X_GPIO_MODE_MDIO), |
72 | .mask = RT305X_GPIO_MODE_PCM_UARTF, | 75 | GRP("rgmii", rt3352_rgmii_func, 1, RT305X_GPIO_MODE_RGMII), |
73 | .gpio_first = RT305X_GPIO_7, | 76 | GRP("lna", rt3352_lna_func, 1, RT3352_GPIO_MODE_LNA), |
74 | .gpio_last = RT305X_GPIO_14, | 77 | GRP("pa", rt3352_pa_func, 1, RT3352_GPIO_MODE_PA), |
75 | }, { | 78 | GRP("led", rt3352_led_func, 1, RT5350_GPIO_MODE_PHY_LED), |
76 | .name = "pcm i2s", | 79 | { 0 } |
77 | .mask = RT305X_GPIO_MODE_PCM_I2S, | 80 | }; |
78 | .gpio_first = RT305X_GPIO_7, | 81 | |
79 | .gpio_last = RT305X_GPIO_14, | 82 | static struct rt2880_pmx_group rt5350_pinmux_data[] = { |
80 | }, { | 83 | GRP("i2c", i2c_func, 1, RT305X_GPIO_MODE_I2C), |
81 | .name = "i2s uartf", | 84 | GRP("spi", spi_func, 1, RT305X_GPIO_MODE_SPI), |
82 | .mask = RT305X_GPIO_MODE_I2S_UARTF, | 85 | GRP("uartf", uartf_func, RT305X_GPIO_MODE_UART0_MASK, |
83 | .gpio_first = RT305X_GPIO_7, | 86 | RT305X_GPIO_MODE_UART0_SHIFT), |
84 | .gpio_last = RT305X_GPIO_14, | 87 | GRP("uartlite", uartlite_func, 1, RT305X_GPIO_MODE_UART1), |
85 | }, { | 88 | GRP("jtag", jtag_func, 1, RT305X_GPIO_MODE_JTAG), |
86 | .name = "pcm gpio", | 89 | GRP("led", rt5350_led_func, 1, RT5350_GPIO_MODE_PHY_LED), |
87 | .mask = RT305X_GPIO_MODE_PCM_GPIO, | 90 | GRP("spi_cs1", rt5350_cs1_func, 2, RT5350_GPIO_MODE_SPI_CS1), |
88 | .gpio_first = RT305X_GPIO_10, | 91 | { 0 } |
89 | .gpio_last = RT305X_GPIO_14, | ||
90 | }, { | ||
91 | .name = "gpio uartf", | ||
92 | .mask = RT305X_GPIO_MODE_GPIO_UARTF, | ||
93 | .gpio_first = RT305X_GPIO_7, | ||
94 | .gpio_last = RT305X_GPIO_10, | ||
95 | }, { | ||
96 | .name = "gpio i2s", | ||
97 | .mask = RT305X_GPIO_MODE_GPIO_I2S, | ||
98 | .gpio_first = RT305X_GPIO_7, | ||
99 | .gpio_last = RT305X_GPIO_10, | ||
100 | }, { | ||
101 | .name = "gpio", | ||
102 | .mask = RT305X_GPIO_MODE_GPIO, | ||
103 | }, {0} | ||
104 | }; | 92 | }; |
105 | 93 | ||
106 | static void rt305x_wdt_reset(void) | 94 | static void rt305x_wdt_reset(void) |
@@ -114,14 +102,6 @@ static void rt305x_wdt_reset(void) | |||
114 | rt_sysc_w32(t, SYSC_REG_SYSTEM_CONFIG); | 102 | rt_sysc_w32(t, SYSC_REG_SYSTEM_CONFIG); |
115 | } | 103 | } |
116 | 104 | ||
117 | struct ralink_pinmux rt_gpio_pinmux = { | ||
118 | .mode = mode_mux, | ||
119 | .uart = uart_mux, | ||
120 | .uart_shift = RT305X_GPIO_MODE_UART0_SHIFT, | ||
121 | .uart_mask = RT305X_GPIO_MODE_UART0_MASK, | ||
122 | .wdt_reset = rt305x_wdt_reset, | ||
123 | }; | ||
124 | |||
125 | static unsigned long rt5350_get_mem_size(void) | 105 | static unsigned long rt5350_get_mem_size(void) |
126 | { | 106 | { |
127 | void __iomem *sysc = (void __iomem *) KSEG1ADDR(RT305X_SYSC_BASE); | 107 | void __iomem *sysc = (void __iomem *) KSEG1ADDR(RT305X_SYSC_BASE); |
@@ -290,11 +270,14 @@ void prom_soc_init(struct ralink_soc_info *soc_info) | |||
290 | soc_info->mem_base = RT305X_SDRAM_BASE; | 270 | soc_info->mem_base = RT305X_SDRAM_BASE; |
291 | if (soc_is_rt5350()) { | 271 | if (soc_is_rt5350()) { |
292 | soc_info->mem_size = rt5350_get_mem_size(); | 272 | soc_info->mem_size = rt5350_get_mem_size(); |
273 | rt2880_pinmux_data = rt5350_pinmux_data; | ||
293 | } else if (soc_is_rt305x() || soc_is_rt3350()) { | 274 | } else if (soc_is_rt305x() || soc_is_rt3350()) { |
294 | soc_info->mem_size_min = RT305X_MEM_SIZE_MIN; | 275 | soc_info->mem_size_min = RT305X_MEM_SIZE_MIN; |
295 | soc_info->mem_size_max = RT305X_MEM_SIZE_MAX; | 276 | soc_info->mem_size_max = RT305X_MEM_SIZE_MAX; |
277 | rt2880_pinmux_data = rt3050_pinmux_data; | ||
296 | } else if (soc_is_rt3352()) { | 278 | } else if (soc_is_rt3352()) { |
297 | soc_info->mem_size_min = RT3352_MEM_SIZE_MIN; | 279 | soc_info->mem_size_min = RT3352_MEM_SIZE_MIN; |
298 | soc_info->mem_size_max = RT3352_MEM_SIZE_MAX; | 280 | soc_info->mem_size_max = RT3352_MEM_SIZE_MAX; |
281 | rt2880_pinmux_data = rt3352_pinmux_data; | ||
299 | } | 282 | } |
300 | } | 283 | } |