Fresh pull from upstream
[librecmc/librecmc.git] / target / linux / ramips / patches-4.4 / 0700-pinctrl-mt7620-mdio-as-refclk.patch
1 --- a/arch/mips/include/asm/mach-ralink/mt7620.h
2 +++ b/arch/mips/include/asm/mach-ralink/mt7620.h
3 @@ -114,9 +114,14 @@
4  #define MT7620_GPIO_MODE_WDT_MASK      0x3
5  #define MT7620_GPIO_MODE_WDT_SHIFT     21
6  
7 +#define MT7620_GPIO_MODE_MDIO          0
8 +#define MT7620_GPIO_MODE_MDIO_REFCLK   1
9 +#define MT7620_GPIO_MODE_MDIO_GPIO     2
10 +#define MT7620_GPIO_MODE_MDIO_MASK     0x3
11 +#define MT7620_GPIO_MODE_MDIO_SHIFT    7
12 +
13  #define MT7620_GPIO_MODE_I2C           0
14  #define MT7620_GPIO_MODE_UART1         5
15 -#define MT7620_GPIO_MODE_MDIO          8
16  #define MT7620_GPIO_MODE_RGMII1                9
17  #define MT7620_GPIO_MODE_RGMII2                10
18  #define MT7620_GPIO_MODE_SPI           11
19 --- a/arch/mips/ralink/mt7620.c
20 +++ b/arch/mips/ralink/mt7620.c
21 @@ -55,7 +55,10 @@ static int dram_type;
22  static struct rt2880_pmx_func i2c_grp[] =  { FUNC("i2c", 0, 1, 2) };
23  static struct rt2880_pmx_func spi_grp[] = { FUNC("spi", 0, 3, 4) };
24  static struct rt2880_pmx_func uartlite_grp[] = { FUNC("uartlite", 0, 15, 2) };
25 -static struct rt2880_pmx_func mdio_grp[] = { FUNC("mdio", 0, 22, 2) };
26 +static struct rt2880_pmx_func mdio_grp[] = {
27 +       FUNC("mdio", MT7620_GPIO_MODE_MDIO, 22, 2),
28 +       FUNC("refclk", MT7620_GPIO_MODE_MDIO_REFCLK, 22, 2),
29 +};
30  static struct rt2880_pmx_func rgmii1_grp[] = { FUNC("rgmii1", 0, 24, 12) };
31  static struct rt2880_pmx_func refclk_grp[] = { FUNC("spi refclk", 0, 37, 3) };
32  static struct rt2880_pmx_func ephy_grp[] = { FUNC("ephy", 0, 40, 5) };
33 @@ -92,7 +95,8 @@ static struct rt2880_pmx_group mt7620a_p
34         GRP("uartlite", uartlite_grp, 1, MT7620_GPIO_MODE_UART1),
35         GRP_G("wdt", wdt_grp, MT7620_GPIO_MODE_WDT_MASK,
36                 MT7620_GPIO_MODE_WDT_GPIO, MT7620_GPIO_MODE_WDT_SHIFT),
37 -       GRP("mdio", mdio_grp, 1, MT7620_GPIO_MODE_MDIO),
38 +       GRP_G("mdio", mdio_grp, MT7620_GPIO_MODE_MDIO_MASK,
39 +               MT7620_GPIO_MODE_MDIO_GPIO, MT7620_GPIO_MODE_MDIO_SHIFT),
40         GRP("rgmii1", rgmii1_grp, 1, MT7620_GPIO_MODE_RGMII1),
41         GRP("spi refclk", refclk_grp, 1, MT7620_GPIO_MODE_SPI_REF_CLK),
42         GRP_G("pcie", pcie_rst_grp, MT7620_GPIO_MODE_PCIE_MASK,