[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fa686aa40903182207j292bab31r9683d2323abf32f1@mail.gmail.com>
Date: Wed, 18 Mar 2009 23:07:25 -0600
From: Grant Likely <grant.likely@...retlab.ca>
To: linuxppc-dev@...abs.org, netdev@...r.kernel.org,
afleming@...escale.com, avorontsov@...mvista.com,
davem@...emloft.net, galak@...nel.crashing.org
Subject: Re: [PATCH 8/9] net/pasemi_mac: Rework pasemi_mac driver to use
of_mdio infrastructure
RFC, please don't apply yet.
On Wed, Mar 18, 2009 at 11:00 PM, Grant Likely
<grant.likely@...retlab.ca> wrote:
> From: Grant Likely <grant.likely@...retlab.ca>
>
> This patch simplifies the driver by making use of more common code.
>
> Signed-off-by: Grant Likely <grant.likely@...retlab.ca>
> ---
>
> drivers/net/pasemi_mac.c | 19 +++----------------
> drivers/net/pasemi_mac.h | 1 -
> 2 files changed, 3 insertions(+), 17 deletions(-)
>
>
> diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
> index d0349e7..8c92d1f 100644
> --- a/drivers/net/pasemi_mac.c
> +++ b/drivers/net/pasemi_mac.c
> @@ -1086,34 +1086,21 @@ static int pasemi_mac_phy_init(struct net_device *dev)
> struct pasemi_mac *mac = netdev_priv(dev);
> struct device_node *dn, *phy_dn;
> struct phy_device *phydev;
> - unsigned int phy_id;
> const phandle *ph;
> const unsigned int *prop;
> struct resource r;
> int ret;
>
> dn = pci_device_to_OF_node(mac->pdev);
> - ph = of_get_property(dn, "phy-handle", NULL);
> - if (!ph)
> - return -ENODEV;
> - phy_dn = of_find_node_by_phandle(*ph);
> -
> - prop = of_get_property(phy_dn, "reg", NULL);
> - ret = of_address_to_resource(phy_dn->parent, 0, &r);
> - if (ret)
> - goto err;
> -
> - phy_id = *prop;
> - snprintf(mac->phy_id, sizeof(mac->phy_id), "%x:%02x",
> - (int)r.start, phy_id);
> -
> + phy_dn = of_parse_phandle(dn, "phy-handle", 0);
> of_node_put(phy_dn);
>
> mac->link = 0;
> mac->speed = 0;
> mac->duplex = -1;
>
> - phydev = phy_connect(dev, mac->phy_id, &pasemi_adjust_link, 0, PHY_INTERFACE_MODE_SGMII);
> + phydev = of_phy_connect(dev, phy_dn, &pasemi_adjust_link, 0,
> + PHY_INTERFACE_MODE_SGMII);
>
> if (IS_ERR(phydev)) {
> printk(KERN_ERR "%s: Could not attach to phy\n", dev->name);
> diff --git a/drivers/net/pasemi_mac.h b/drivers/net/pasemi_mac.h
> index 1a115ec..e2f4efa 100644
> --- a/drivers/net/pasemi_mac.h
> +++ b/drivers/net/pasemi_mac.h
> @@ -100,7 +100,6 @@ struct pasemi_mac {
> int duplex;
>
> unsigned int msg_enable;
> - char phy_id[BUS_ID_SIZE];
> };
>
> /* Software status descriptor (ring_info) */
>
>
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists