ramips: fix the number of uarts for MT7688
[openwrt/staging/yousong.git] / target / linux / mediatek / patches-4.4 / 0079-net-next-mediatek-add-fixed-phy-support.patch
1 From 09f0b50ae838bd6e2bbf0aa22de9f352122297de Mon Sep 17 00:00:00 2001
2 From: John Crispin <john@phrozen.org>
3 Date: Fri, 22 Apr 2016 11:06:03 +0200
4 Subject: [PATCH 079/102] net-next: mediatek: add fixed-phy support
5
6 The MT7623 SoC has a builtin gigabit switch. If we want to use it, GMAC1
7 needs to be configured using a fixed link speed and flow control settings.
8 The easiest way to do this is to used the fixed-phy driver, allowing us to
9 reuse the existing mdio polling code to setup the MAC.
10
11 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
12 Signed-off-by: John Crispin <john@phrozen.org>
13 ---
14 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 ++++++
15 1 file changed, 6 insertions(+)
16
17 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
18 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
19 @@ -229,6 +229,9 @@ static int mtk_phy_connect(struct mtk_ma
20 u32 val, ge_mode;
21
22 np = of_parse_phandle(mac->of_node, "phy-handle", 0);
23 + if (!np && of_phy_is_fixed_link(mac->of_node))
24 + if (!of_phy_register_fixed_link(mac->of_node))
25 + np = of_node_get(mac->of_node);
26 if (!np)
27 return -ENODEV;
28
29 @@ -257,6 +260,9 @@ static int mtk_phy_connect(struct mtk_ma
30 mac->phy_dev->autoneg = AUTONEG_ENABLE;
31 mac->phy_dev->speed = 0;
32 mac->phy_dev->duplex = 0;
33 + if (of_phy_is_fixed_link(mac->of_node))
34 + mac->phy_dev->supported |= SUPPORTED_Pause |
35 + SUPPORTED_Asym_Pause;
36 mac->phy_dev->supported &= PHY_GBIT_FEATURES | SUPPORTED_Pause |
37 SUPPORTED_Asym_Pause;
38 mac->phy_dev->advertising = mac->phy_dev->supported |