kernel: update kernel 4.4 to version 4.4.9
[openwrt/staging/yousong.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 --- 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
13
14 dev_info(eth->dev,
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,
18 phydev->drv->name);
19
20 mac->phy_dev = phydev;
21 @@ -1268,9 +1268,10 @@ static irqreturn_t mtk_handle_irq_rx(int
22 return IRQ_NONE;
23
24 if (status & MTK_RX_DONE_INT) {
25 - if (likely(napi_schedule_prep(&eth->rx_napi)))
26 + if (likely(napi_schedule_prep(&eth->rx_napi))) {
27 + mtk_irq_disable(eth, MTK_RX_DONE_INT);
28 __napi_schedule(&eth->rx_napi);
29 - mtk_irq_disable(eth, MTK_RX_DONE_INT);
30 + }
31 }
32 mtk_w32(eth, status, MTK_QMTK_INT_STATUS);
33
34 @@ -1289,9 +1290,10 @@ static irqreturn_t mtk_handle_irq_tx(int
35 return IRQ_NONE;
36
37 if (status & MTK_TX_DONE_INT) {
38 - if (likely(napi_schedule_prep(&eth->tx_napi)))
39 + if (likely(napi_schedule_prep(&eth->tx_napi))) {
40 + mtk_irq_disable(eth, MTK_TX_DONE_INT);
41 __napi_schedule(&eth->tx_napi);
42 - mtk_irq_disable(eth, MTK_TX_DONE_INT);
43 + }
44 }
45 mtk_w32(eth, status, MTK_QMTK_INT_STATUS);
46
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;
50
51 + netif_carrier_off(dev);
52 netif_tx_disable(dev);
53 phy_stop(mac->phy_dev);
54
55 @@ -1582,11 +1585,13 @@ static int mtk_set_settings(struct net_d
56 {
57 struct mtk_mac *mac = netdev_priv(dev);
58
59 - if (cmd->phy_address != mac->phy_dev->mdio.addr) {
60 - mac->phy_dev = mdiobus_get_phy(mac->hw->mii_bus,
61 - cmd->phy_address);
62 - if (!mac->phy_dev)
63 + if (cmd->phy_address != mac->phy_dev->addr) {
64 + if (mac->hw->mii_bus->phy_map[cmd->phy_address]) {
65 + mac->phy_dev =
66 + mac->hw->mii_bus->phy_map[cmd->phy_address];
67 + } else {
68 return -ENODEV;
69 + }
70 }
71
72 return phy_ethtool_sset(mac->phy_dev, cmd);