diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/pasemi_mac.c | 28 | ||||
-rw-r--r-- | drivers/net/pasemi_mac.h | 1 |
2 files changed, 4 insertions, 25 deletions
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c index 067caba43656..6ea4539085d5 100644 --- a/drivers/net/pasemi_mac.c +++ b/drivers/net/pasemi_mac.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/dmaengine.h> | 24 | #include <linux/dmaengine.h> |
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | #include <linux/netdevice.h> | 26 | #include <linux/netdevice.h> |
27 | #include <linux/of_mdio.h> | ||
27 | #include <linux/etherdevice.h> | 28 | #include <linux/etherdevice.h> |
28 | #include <asm/dma-mapping.h> | 29 | #include <asm/dma-mapping.h> |
29 | #include <linux/in.h> | 30 | #include <linux/in.h> |
@@ -1086,34 +1087,17 @@ static int pasemi_mac_phy_init(struct net_device *dev) | |||
1086 | struct pasemi_mac *mac = netdev_priv(dev); | 1087 | struct pasemi_mac *mac = netdev_priv(dev); |
1087 | struct device_node *dn, *phy_dn; | 1088 | struct device_node *dn, *phy_dn; |
1088 | struct phy_device *phydev; | 1089 | struct phy_device *phydev; |
1089 | unsigned int phy_id; | ||
1090 | const phandle *ph; | ||
1091 | const unsigned int *prop; | ||
1092 | struct resource r; | ||
1093 | int ret; | ||
1094 | 1090 | ||
1095 | dn = pci_device_to_OF_node(mac->pdev); | 1091 | dn = pci_device_to_OF_node(mac->pdev); |
1096 | ph = of_get_property(dn, "phy-handle", NULL); | 1092 | phy_dn = of_parse_phandle(dn, "phy-handle", 0); |
1097 | if (!ph) | ||
1098 | return -ENODEV; | ||
1099 | phy_dn = of_find_node_by_phandle(*ph); | ||
1100 | |||
1101 | prop = of_get_property(phy_dn, "reg", NULL); | ||
1102 | ret = of_address_to_resource(phy_dn->parent, 0, &r); | ||
1103 | if (ret) | ||
1104 | goto err; | ||
1105 | |||
1106 | phy_id = *prop; | ||
1107 | snprintf(mac->phy_id, sizeof(mac->phy_id), "%x:%02x", | ||
1108 | (int)r.start, phy_id); | ||
1109 | |||
1110 | of_node_put(phy_dn); | 1093 | of_node_put(phy_dn); |
1111 | 1094 | ||
1112 | mac->link = 0; | 1095 | mac->link = 0; |
1113 | mac->speed = 0; | 1096 | mac->speed = 0; |
1114 | mac->duplex = -1; | 1097 | mac->duplex = -1; |
1115 | 1098 | ||
1116 | phydev = phy_connect(dev, mac->phy_id, &pasemi_adjust_link, 0, PHY_INTERFACE_MODE_SGMII); | 1099 | phydev = of_phy_connect(dev, phy_dn, &pasemi_adjust_link, 0, |
1100 | PHY_INTERFACE_MODE_SGMII); | ||
1117 | 1101 | ||
1118 | if (IS_ERR(phydev)) { | 1102 | if (IS_ERR(phydev)) { |
1119 | printk(KERN_ERR "%s: Could not attach to phy\n", dev->name); | 1103 | printk(KERN_ERR "%s: Could not attach to phy\n", dev->name); |
@@ -1123,10 +1107,6 @@ static int pasemi_mac_phy_init(struct net_device *dev) | |||
1123 | mac->phydev = phydev; | 1107 | mac->phydev = phydev; |
1124 | 1108 | ||
1125 | return 0; | 1109 | return 0; |
1126 | |||
1127 | err: | ||
1128 | of_node_put(phy_dn); | ||
1129 | return -ENODEV; | ||
1130 | } | 1110 | } |
1131 | 1111 | ||
1132 | 1112 | ||
diff --git a/drivers/net/pasemi_mac.h b/drivers/net/pasemi_mac.h index 1a115ec60b53..e2f4efa8ad46 100644 --- a/drivers/net/pasemi_mac.h +++ b/drivers/net/pasemi_mac.h | |||
@@ -100,7 +100,6 @@ struct pasemi_mac { | |||
100 | int duplex; | 100 | int duplex; |
101 | 101 | ||
102 | unsigned int msg_enable; | 102 | unsigned int msg_enable; |
103 | char phy_id[BUS_ID_SIZE]; | ||
104 | }; | 103 | }; |
105 | 104 | ||
106 | /* Software status descriptor (ring_info) */ | 105 | /* Software status descriptor (ring_info) */ |