1 From d9cddd0b4062e66f350297b4b855ef4db3a1c16b Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Tue, 15 Nov 2011 14:52:21 +0100
4 Subject: [PATCH 20/70] NET: MIPS: lantiq: non existing phy was not handled
7 The code blindly assumed that that a PHY device was present causing a BadVA.
8 In addition the driver should not fail to load incase no PHY was found.
9 Instead we print the following line and continue with no attached PHY.
11 etop: mdio probe failed
13 Signed-off-by: John Crispin <blogic@openwrt.org>
14 Cc: netdev@vger.kernel.org
16 drivers/net/ethernet/lantiq_etop.c | 14 ++++++++------
17 1 files changed, 8 insertions(+), 6 deletions(-)
19 diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
20 index d3d4931..9fd6779 100644
21 --- a/drivers/net/ethernet/lantiq_etop.c
22 +++ b/drivers/net/ethernet/lantiq_etop.c
23 @@ -612,7 +612,8 @@ ltq_etop_open(struct net_device *dev)
24 ltq_dma_open(&ch->dma);
25 napi_enable(&ch->napi);
27 - phy_start(priv->phydev);
29 + phy_start(priv->phydev);
30 netif_tx_start_all_queues(dev);
33 @@ -624,7 +625,8 @@ ltq_etop_stop(struct net_device *dev)
36 netif_tx_stop_all_queues(dev);
37 - phy_stop(priv->phydev);
39 + phy_stop(priv->phydev);
40 for (i = 0; i < MAX_DMA_CHAN; i++) {
41 struct ltq_etop_chan *ch = &priv->ch[i];
43 @@ -770,9 +772,10 @@ ltq_etop_init(struct net_device *dev)
46 ltq_etop_set_multicast_list(dev);
47 - err = ltq_etop_mdio_init(dev);
50 + if (!ltq_etop_mdio_init(dev))
51 + dev->ethtool_ops = <q_etop_ethtool_ops;
53 + pr_warn("etop: mdio probe failed\n");;
57 @@ -868,7 +871,6 @@ ltq_etop_probe(struct platform_device *pdev)
58 dev = alloc_etherdev_mq(sizeof(struct ltq_etop_priv), 4);
59 strcpy(dev->name, "eth%d");
60 dev->netdev_ops = <q_eth_netdev_ops;
61 - dev->ethtool_ops = <q_etop_ethtool_ops;
62 priv = netdev_priv(dev);
64 priv->pldata = dev_get_platdata(&pdev->dev);