f26eaeaccc8d698c70ad7e907ec18bce8a809928
[openwrt/openwrt.git] / target / linux / mediatek / patches-4.4 / 0090-net-mediatek-v4.4-backports.patch
1 From 7d2bdde21bc72eb41878890149f2b9d05fc3af6e Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Mon, 11 Apr 2016 06:00:23 +0200
4 Subject: [PATCH 90/91] net: mediatek: v4.4 backports
5
6 ---
7 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 23 ++++++++++++++---------
8 1 file changed, 14 insertions(+), 9 deletions(-)
9
10 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
11 index bb62b91..5d33053 100644
12 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
13 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
14 @@ -207,7 +207,7 @@ static int mtk_phy_connect_node(struct mtk_eth *eth, struct mtk_mac *mac,
15
16 dev_info(eth->dev,
17 "connected mac %d to PHY at %s [uid=%08x, driver=%s]\n",
18 - mac->id, phydev_name(phydev), phydev->phy_id,
19 + mac->id, dev_name(&phydev->dev), phydev->phy_id,
20 phydev->drv->name);
21
22 mac->phy_dev = phydev;
23 @@ -1268,9 +1268,10 @@ static irqreturn_t mtk_handle_irq_rx(int irq, void *_eth)
24 return IRQ_NONE;
25
26 if (status & MTK_RX_DONE_INT) {
27 - if (likely(napi_schedule_prep(&eth->rx_napi)))
28 + if (likely(napi_schedule_prep(&eth->rx_napi))) {
29 + mtk_irq_disable(eth, MTK_RX_DONE_INT);
30 __napi_schedule(&eth->rx_napi);
31 - mtk_irq_disable(eth, MTK_RX_DONE_INT);
32 + }
33 }
34 mtk_w32(eth, status, MTK_QMTK_INT_STATUS);
35
36 @@ -1289,9 +1290,10 @@ static irqreturn_t mtk_handle_irq_tx(int irq, void *_eth)
37 return IRQ_NONE;
38
39 if (status & MTK_TX_DONE_INT) {
40 - if (likely(napi_schedule_prep(&eth->tx_napi)))
41 + if (likely(napi_schedule_prep(&eth->tx_napi))) {
42 + mtk_irq_disable(eth, MTK_TX_DONE_INT);
43 __napi_schedule(&eth->tx_napi);
44 - mtk_irq_disable(eth, MTK_TX_DONE_INT);
45 + }
46 }
47 mtk_w32(eth, status, MTK_QMTK_INT_STATUS);
48
49 @@ -1383,6 +1385,7 @@ static int mtk_stop(struct net_device *dev)
50 struct mtk_mac *mac = netdev_priv(dev);
51 struct mtk_eth *eth = mac->hw;
52
53 + netif_carrier_off(dev);
54 netif_tx_disable(dev);
55 phy_stop(mac->phy_dev);
56
57 @@ -1582,11 +1585,13 @@ static int mtk_set_settings(struct net_device *dev,
58 {
59 struct mtk_mac *mac = netdev_priv(dev);
60
61 - if (cmd->phy_address != mac->phy_dev->mdio.addr) {
62 - mac->phy_dev = mdiobus_get_phy(mac->hw->mii_bus,
63 - cmd->phy_address);
64 - if (!mac->phy_dev)
65 + if (cmd->phy_address != mac->phy_dev->addr) {
66 + if (mac->hw->mii_bus->phy_map[cmd->phy_address]) {
67 + mac->phy_dev =
68 + mac->hw->mii_bus->phy_map[cmd->phy_address];
69 + } else {
70 return -ENODEV;
71 + }
72 }
73
74 return phy_ethtool_sset(mac->phy_dev, cmd);
75 --
76 1.7.10.4
77