2a46de0165309315fa4a047734921a925be421fe
[openwrt/svn-archive/archive.git] / target / linux / kirkwood / patches-3.10 / 0021-net-mv643xx_eth-use-of_phy_connect-if-phy_node-prese.patch
1 From 04417da7ac6d1a2a38d4406d899ab92bf6e488e1 Mon Sep 17 00:00:00 2001
2 From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
3 Date: Wed, 29 May 2013 21:32:46 +0200
4 Subject: [PATCH 21/29] net: mv643xx_eth: use of_phy_connect if phy_node
5 present
6
7 This connects to a phy node passed to the port device instead of probing
8 the phy by phy_addr.
9
10 Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
11 ---
12 drivers/net/ethernet/marvell/mv643xx_eth.c | 25 ++++++++++++++++++-------
13 1 file changed, 18 insertions(+), 7 deletions(-)
14
15 diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
16 index 0a8c064..946033b 100644
17 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c
18 +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
19 @@ -60,6 +60,7 @@
20 #include <linux/types.h>
21 #include <linux/slab.h>
22 #include <linux/clk.h>
23 +#include <linux/of_mdio.h>
24
25 static char mv643xx_eth_driver_name[] = "mv643xx_eth";
26 static char mv643xx_eth_driver_version[] = "1.4";
27 @@ -2715,17 +2716,27 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
28 netif_set_real_num_tx_queues(dev, mp->txq_count);
29 netif_set_real_num_rx_queues(dev, mp->rxq_count);
30
31 - if (pd->phy_addr != MV643XX_ETH_PHY_NONE) {
32 + err = 0;
33 + if (pd->phy_node) {
34 + mp->phy = of_phy_connect(mp->dev, pd->phy_node,
35 + mv643xx_eth_adjust_link, 0,
36 + PHY_INTERFACE_MODE_GMII);
37 + if (!mp->phy)
38 + err = -ENODEV;
39 + } else if (pd->phy_addr != MV643XX_ETH_PHY_NONE) {
40 mp->phy = phy_scan(mp, pd->phy_addr);
41
42 - if (IS_ERR(mp->phy)) {
43 + if (IS_ERR(mp->phy))
44 err = PTR_ERR(mp->phy);
45 - if (err == -ENODEV)
46 - err = -EPROBE_DEFER;
47 - goto out;
48 - }
49 - phy_init(mp, pd->speed, pd->duplex);
50 + else
51 + phy_init(mp, pd->speed, pd->duplex);
52 }
53 + if (err == -ENODEV) {
54 + err = -EPROBE_DEFER;
55 + goto out;
56 + }
57 + if (err)
58 + goto out;
59
60 SET_ETHTOOL_OPS(dev, &mv643xx_eth_ethtool_ops);
61
62 --
63 1.8.4.rc1
64