Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 132557
b: refs/heads/master
c: 61fa9dc
h: refs/heads/master
i:
  132555: 05809b0
v: v3
  • Loading branch information
Anton Vorontsov authored and David S. Miller committed Mar 23, 2009
1 parent d8a68ea commit 543e885
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 27 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e3162d381fc359ebe5c98a3e216888a7cb200051
refs/heads/master: 61fa9dcf9329cb92c220f7b656410fbe5e72f933
34 changes: 10 additions & 24 deletions trunk/drivers/net/ucc_geth.c
Original file line number Diff line number Diff line change
Expand Up @@ -1536,32 +1536,15 @@ static void adjust_link(struct net_device *dev)
static int init_phy(struct net_device *dev)
{
struct ucc_geth_private *priv = netdev_priv(dev);
struct device_node *np = priv->node;
struct device_node *phy, *mdio;
const phandle *ph;
char bus_name[MII_BUS_ID_SIZE];
const unsigned int *id;
struct ucc_geth_info *ug_info = priv->ug_info;
struct phy_device *phydev;
char phy_id[BUS_ID_SIZE];

priv->oldlink = 0;
priv->oldspeed = 0;
priv->oldduplex = -1;

ph = of_get_property(np, "phy-handle", NULL);
phy = of_find_node_by_phandle(*ph);
mdio = of_get_parent(phy);

id = of_get_property(phy, "reg", NULL);

of_node_put(phy);
of_node_put(mdio);

uec_mdio_bus_name(bus_name, mdio);
snprintf(phy_id, sizeof(phy_id), "%s:%02x",
bus_name, *id);

phydev = phy_connect(dev, phy_id, &adjust_link, 0, priv->phy_interface);
phydev = phy_connect(dev, ug_info->phy_bus_id, &adjust_link, 0,
priv->phy_interface);

if (IS_ERR(phydev)) {
printk("%s: Could not attach to PHY\n", dev->name);
Expand Down Expand Up @@ -3629,10 +3612,12 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
ug_info->uf_info.irq = irq_of_parse_and_map(np, 0);
fixed_link = of_get_property(np, "fixed-link", NULL);
if (fixed_link) {
snprintf(ug_info->mdio_bus, MII_BUS_ID_SIZE, "0");
ug_info->phy_address = fixed_link[0];
snprintf(ug_info->phy_bus_id, sizeof(ug_info->phy_bus_id),
PHY_ID_FMT, "0", fixed_link[0]);
phy = NULL;
} else {
char bus_name[MII_BUS_ID_SIZE];

ph = of_get_property(np, "phy-handle", NULL);
phy = of_find_node_by_phandle(*ph);

Expand All @@ -3643,7 +3628,6 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
prop = of_get_property(phy, "reg", NULL);
if (prop == NULL)
return -1;
ug_info->phy_address = *prop;

/* Set the bus id */
mdio = of_get_parent(phy);
Expand All @@ -3657,7 +3641,9 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
if (err)
return -1;

snprintf(ug_info->mdio_bus, MII_BUS_ID_SIZE, "%x", res.start);
uec_mdio_bus_name(bus_name, mdio);
snprintf(ug_info->phy_bus_id, sizeof(ug_info->phy_bus_id),
"%s:%02x", bus_name, *prop);
}

/* get the phy interface type, or default to MII */
Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/net/ucc_geth.h
Original file line number Diff line number Diff line change
Expand Up @@ -1091,8 +1091,7 @@ struct ucc_geth_info {
u32 eventRegMask;
u16 pausePeriod;
u16 extensionField;
u8 phy_address;
char mdio_bus[MII_BUS_ID_SIZE];
char phy_bus_id[BUS_ID_SIZE];
u8 weightfactor[NUM_TX_QUEUES];
u8 interruptcoalescingmaxvalue[NUM_RX_QUEUES];
u8 l2qt[UCC_GETH_VLAN_PRIORITY_MAX];
Expand Down

0 comments on commit 543e885

Please sign in to comment.