ramips: minor tweak to the lks7688 baord name
[openwrt/openwrt.git] / target / linux / ramips / patches-3.18 / 0300-mt7628_fixes.patch
1 --- a/arch/mips/ralink/mt7620.c
2 +++ b/arch/mips/ralink/mt7620.c
3 @@ -182,27 +182,43 @@ static struct rt2880_pmx_func gpio_grp_m
4 FUNC("gpio", 0, 11, 1),
5 };
6
7 -#define MT7628_GPIO_MODE_MASK 0x3
8 -
9 -#define MT7628_GPIO_MODE_PWM1 30
10 -#define MT7628_GPIO_MODE_PWM0 28
11 -#define MT7628_GPIO_MODE_UART2 26
12 -#define MT7628_GPIO_MODE_UART1 24
13 -#define MT7628_GPIO_MODE_I2C 20
14 -#define MT7628_GPIO_MODE_REFCLK 18
15 -#define MT7628_GPIO_MODE_PERST 16
16 -#define MT7628_GPIO_MODE_WDT 14
17 -#define MT7628_GPIO_MODE_SPI 12
18 -#define MT7628_GPIO_MODE_SDMODE 10
19 -#define MT7628_GPIO_MODE_UART0 8
20 -#define MT7628_GPIO_MODE_I2S 6
21 -#define MT7628_GPIO_MODE_CS1 4
22 -#define MT7628_GPIO_MODE_SPIS 2
23 -#define MT7628_GPIO_MODE_GPIO 0
24 +static struct rt2880_pmx_func wled_kn_grp_mt7628[] = {
25 + FUNC("rsvd", 3, 35, 1),
26 + FUNC("rsvd", 2, 35, 1),
27 + FUNC("gpio", 1, 35, 1),
28 + FUNC("wled_kn", 0, 35, 1),
29 +};
30 +
31 +static struct rt2880_pmx_func wled_an_grp_mt7628[] = {
32 + FUNC("rsvd", 3, 35, 1),
33 + FUNC("rsvd", 2, 35, 1),
34 + FUNC("gpio", 1, 35, 1),
35 + FUNC("wled_an", 0, 35, 1),
36 +};
37 +
38 +#define MT7628_GPIO_MODE_MASK 0x3
39 +
40 +#define MT7628_GPIO_MODE_WLED_KN 48
41 +#define MT7628_GPIO_MODE_WLED_AN 32
42 +#define MT7628_GPIO_MODE_PWM1 30
43 +#define MT7628_GPIO_MODE_PWM0 28
44 +#define MT7628_GPIO_MODE_UART2 26
45 +#define MT7628_GPIO_MODE_UART1 24
46 +#define MT7628_GPIO_MODE_I2C 20
47 +#define MT7628_GPIO_MODE_REFCLK 18
48 +#define MT7628_GPIO_MODE_PERST 16
49 +#define MT7628_GPIO_MODE_WDT 14
50 +#define MT7628_GPIO_MODE_SPI 12
51 +#define MT7628_GPIO_MODE_SDMODE 10
52 +#define MT7628_GPIO_MODE_UART0 8
53 +#define MT7628_GPIO_MODE_I2S 6
54 +#define MT7628_GPIO_MODE_CS1 4
55 +#define MT7628_GPIO_MODE_SPIS 2
56 +#define MT7628_GPIO_MODE_GPIO 0
57
58 static struct rt2880_pmx_group mt7628an_pinmux_data[] = {
59 - GRP_G("pmw1", pwm1_grp_mt7628, MT7628_GPIO_MODE_MASK, 1, MT7628_GPIO_MODE_PWM1),
60 - GRP_G("pmw0", pwm0_grp_mt7628, MT7628_GPIO_MODE_MASK, 1, MT7628_GPIO_MODE_PWM0),
61 + GRP_G("pwm1", pwm1_grp_mt7628, MT7628_GPIO_MODE_MASK, 1, MT7628_GPIO_MODE_PWM1),
62 + GRP_G("pwm0", pwm0_grp_mt7628, MT7628_GPIO_MODE_MASK, 1, MT7628_GPIO_MODE_PWM0),
63 GRP_G("uart2", uart2_grp_mt7628, MT7628_GPIO_MODE_MASK, 1, MT7628_GPIO_MODE_UART2),
64 GRP_G("uart1", uart1_grp_mt7628, MT7628_GPIO_MODE_MASK, 1, MT7628_GPIO_MODE_UART1),
65 GRP_G("i2c", i2c_grp_mt7628, MT7628_GPIO_MODE_MASK, 1, MT7628_GPIO_MODE_I2C),
66 @@ -216,6 +232,8 @@ static struct rt2880_pmx_group mt7628an_
67 GRP_G("spi cs1", spi_cs1_grp_mt7628, MT7628_GPIO_MODE_MASK, 1, MT7628_GPIO_MODE_CS1),
68 GRP_G("spis", spis_grp_mt7628, MT7628_GPIO_MODE_MASK, 1, MT7628_GPIO_MODE_SPIS),
69 GRP_G("gpio", gpio_grp_mt7628, MT7628_GPIO_MODE_MASK, 1, MT7628_GPIO_MODE_GPIO),
70 + GRP_G("wled_an", wled_an_grp_mt7628, MT7628_GPIO_MODE_MASK, 1, MT7628_GPIO_MODE_WLED_AN),
71 + GRP_G("wled_kn", wled_kn_grp_mt7628, MT7628_GPIO_MODE_MASK, 1, MT7628_GPIO_MODE_WLED_KN),
72 { 0 }
73 };
74
75 @@ -529,7 +547,11 @@ void prom_soc_init(struct ralink_soc_inf
76 (rev & CHIP_REV_ECO_MASK));
77
78 cfg0 = __raw_readl(sysc + SYSC_REG_SYSTEM_CONFIG0);
79 - dram_type = (cfg0 >> SYSCFG0_DRAM_TYPE_SHIFT) & SYSCFG0_DRAM_TYPE_MASK;
80 +
81 + if (ralink_soc == MT762X_SOC_MT7628AN)
82 + dram_type = ((cfg0&0x00000001) == 0x00000001)?SYSCFG0_DRAM_TYPE_DDR1_MT7628:SYSCFG0_DRAM_TYPE_DDR2_MT7628;
83 + else
84 + dram_type = (cfg0 >> SYSCFG0_DRAM_TYPE_SHIFT) & SYSCFG0_DRAM_TYPE_MASK;
85
86 soc_info->mem_base = MT7620_DRAM_BASE;
87 if (ralink_soc == MT762X_SOC_MT7628AN)