aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/freescale/fec.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/freescale/fec.c')
-rw-r--r--drivers/net/ethernet/freescale/fec.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
index 069a155d16ed..911d0253dbb2 100644
--- a/drivers/net/ethernet/freescale/fec.c
+++ b/drivers/net/ethernet/freescale/fec.c
@@ -934,24 +934,28 @@ static void fec_enet_adjust_link(struct net_device *ndev)
934 goto spin_unlock; 934 goto spin_unlock;
935 } 935 }
936 936
937 /* Duplex link change */
938 if (phy_dev->link) { 937 if (phy_dev->link) {
939 if (fep->full_duplex != phy_dev->duplex) { 938 if (!fep->link) {
940 fec_restart(ndev, phy_dev->duplex);
941 /* prevent unnecessary second fec_restart() below */
942 fep->link = phy_dev->link; 939 fep->link = phy_dev->link;
943 status_change = 1; 940 status_change = 1;
944 } 941 }
945 }
946 942
947 /* Link on or off change */ 943 if (fep->full_duplex != phy_dev->duplex)
948 if (phy_dev->link != fep->link) { 944 status_change = 1;
949 fep->link = phy_dev->link; 945
950 if (phy_dev->link) 946 if (phy_dev->speed != fep->speed) {
947 fep->speed = phy_dev->speed;
948 status_change = 1;
949 }
950
951 /* if any of the above changed restart the FEC */
952 if (status_change)
951 fec_restart(ndev, phy_dev->duplex); 953 fec_restart(ndev, phy_dev->duplex);
952 else 954 } else {
955 if (fep->link) {
953 fec_stop(ndev); 956 fec_stop(ndev);
954 status_change = 1; 957 status_change = 1;
958 }
955 } 959 }
956 960
957spin_unlock: 961spin_unlock:
@@ -1328,7 +1332,7 @@ static int fec_enet_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
1328static void fec_enet_free_buffers(struct net_device *ndev) 1332static void fec_enet_free_buffers(struct net_device *ndev)
1329{ 1333{
1330 struct fec_enet_private *fep = netdev_priv(ndev); 1334 struct fec_enet_private *fep = netdev_priv(ndev);
1331 int i; 1335 unsigned int i;
1332 struct sk_buff *skb; 1336 struct sk_buff *skb;
1333 struct bufdesc *bdp; 1337 struct bufdesc *bdp;
1334 1338
@@ -1352,7 +1356,7 @@ static void fec_enet_free_buffers(struct net_device *ndev)
1352static int fec_enet_alloc_buffers(struct net_device *ndev) 1356static int fec_enet_alloc_buffers(struct net_device *ndev)
1353{ 1357{
1354 struct fec_enet_private *fep = netdev_priv(ndev); 1358 struct fec_enet_private *fep = netdev_priv(ndev);
1355 int i; 1359 unsigned int i;
1356 struct sk_buff *skb; 1360 struct sk_buff *skb;
1357 struct bufdesc *bdp; 1361 struct bufdesc *bdp;
1358 1362
@@ -1437,6 +1441,7 @@ fec_enet_close(struct net_device *ndev)
1437 struct fec_enet_private *fep = netdev_priv(ndev); 1441 struct fec_enet_private *fep = netdev_priv(ndev);
1438 1442
1439 /* Don't know what to do yet. */ 1443 /* Don't know what to do yet. */
1444 napi_disable(&fep->napi);
1440 fep->opened = 0; 1445 fep->opened = 0;
1441 netif_stop_queue(ndev); 1446 netif_stop_queue(ndev);
1442 fec_stop(ndev); 1447 fec_stop(ndev);
@@ -1593,7 +1598,7 @@ static int fec_enet_init(struct net_device *ndev)
1593 struct fec_enet_private *fep = netdev_priv(ndev); 1598 struct fec_enet_private *fep = netdev_priv(ndev);
1594 struct bufdesc *cbd_base; 1599 struct bufdesc *cbd_base;
1595 struct bufdesc *bdp; 1600 struct bufdesc *bdp;
1596 int i; 1601 unsigned int i;
1597 1602
1598 /* Allocate memory for buffer descriptors. */ 1603 /* Allocate memory for buffer descriptors. */
1599 cbd_base = dma_alloc_coherent(NULL, PAGE_SIZE, &fep->bd_dma, 1604 cbd_base = dma_alloc_coherent(NULL, PAGE_SIZE, &fep->bd_dma,