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
7 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 23 ++++++++++++++---------
8 1 file changed, 14 insertions(+), 9 deletions(-)
10 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
11 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
12 @@ -207,7 +207,7 @@ static int mtk_phy_connect_node(struct m
15 "connected mac %d to PHY at %s [uid=%08x, driver=%s]\n",
16 - mac->id, phydev_name(phydev), phydev->phy_id,
17 + mac->id, dev_name(&phydev->dev), phydev->phy_id,
20 mac->phy_dev = phydev;
21 @@ -1268,9 +1268,10 @@ static irqreturn_t mtk_handle_irq_rx(int
24 if (status & MTK_RX_DONE_INT) {
25 - if (likely(napi_schedule_prep(ð->rx_napi)))
26 + if (likely(napi_schedule_prep(ð->rx_napi))) {
27 + mtk_irq_disable(eth, MTK_RX_DONE_INT);
28 __napi_schedule(ð->rx_napi);
29 - mtk_irq_disable(eth, MTK_RX_DONE_INT);
32 mtk_w32(eth, status, MTK_QMTK_INT_STATUS);
34 @@ -1289,9 +1290,10 @@ static irqreturn_t mtk_handle_irq_tx(int
37 if (status & MTK_TX_DONE_INT) {
38 - if (likely(napi_schedule_prep(ð->tx_napi)))
39 + if (likely(napi_schedule_prep(ð->tx_napi))) {
40 + mtk_irq_disable(eth, MTK_TX_DONE_INT);
41 __napi_schedule(ð->tx_napi);
42 - mtk_irq_disable(eth, MTK_TX_DONE_INT);
45 mtk_w32(eth, status, MTK_QMTK_INT_STATUS);
47 @@ -1383,6 +1385,7 @@ static int mtk_stop(struct net_device *d
48 struct mtk_mac *mac = netdev_priv(dev);
49 struct mtk_eth *eth = mac->hw;
51 + netif_carrier_off(dev);
52 netif_tx_disable(dev);
53 phy_stop(mac->phy_dev);
55 @@ -1582,11 +1585,13 @@ static int mtk_set_settings(struct net_d
57 struct mtk_mac *mac = netdev_priv(dev);
59 - if (cmd->phy_address != mac->phy_dev->mdio.addr) {
60 - mac->phy_dev = mdiobus_get_phy(mac->hw->mii_bus,
63 + if (cmd->phy_address != mac->phy_dev->addr) {
64 + if (mac->hw->mii_bus->phy_map[cmd->phy_address]) {
66 + mac->hw->mii_bus->phy_map[cmd->phy_address];
72 return phy_ethtool_sset(mac->phy_dev, cmd);