From: Grant Likely <grant.likely@secretlab.ca>
To: linuxppc-dev@ozlabs.org, netdev@vger.kernel.org,
afleming@freescale.com, avorontsov@ru.mvista.com,
davem@davemloft.net, galak@kernel.crashing.org
Subject: [PATCH 8/9] net/pasemi_mac: Rework pasemi_mac driver to use of_mdio infrastructure
Date: Wed, 18 Mar 2009 23:00:55 -0600 [thread overview]
Message-ID: <20090319050055.11320.62033.stgit@localhost.localdomain> (raw)
In-Reply-To: <20090319050015.11320.61641.stgit@localhost.localdomain>
From: Grant Likely <grant.likely@secretlab.ca>
This patch simplifies the driver by making use of more common code.
Signed-off-by: Grant Likely <grant.likely@secretlab.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) */
next prev parent reply other threads:[~2009-03-19 5:00 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-19 5:00 [PATCH 1/9] of: add of_parse_phandle() helper for parsing phandle properties Grant Likely
2009-03-19 5:00 ` [PATCH 2/9] phylib: rework to prepare for OF registration of PHYs Grant Likely
2009-03-19 5:05 ` Grant Likely
2009-03-19 5:05 ` Grant Likely
2009-03-19 5:00 ` [PATCH 3/9] phylib: add *_direct() variants of phy_connect and phy_attach functions Grant Likely
2009-03-19 5:05 ` Grant Likely
2009-03-19 5:05 ` Grant Likely
2009-03-19 5:00 ` [PATCH 4/9] openfirmware: Add OF phylib support code Grant Likely
2009-03-19 5:06 ` Grant Likely
2009-03-19 5:06 ` Grant Likely
2009-03-19 5:00 ` [PATCH 5/9] net: make mpc5200 fec driver use of_mdio infrastructure Grant Likely
2009-03-19 5:06 ` Grant Likely
2009-03-19 5:06 ` Grant Likely
2009-03-19 5:00 ` [PATCH 6/9] net/gianfar: Rework gianfar driver to use OF PHY/MDIO helper functions Grant Likely
2009-03-19 5:07 ` Grant Likely
2009-03-19 5:07 ` Grant Likely
2009-03-19 5:00 ` [PATCH 7/9] net/ucc_geth: Rework ucc_geth " Grant Likely
2009-03-19 5:07 ` Grant Likely
2009-03-19 5:07 ` Grant Likely
2009-03-19 5:00 ` Grant Likely [this message]
2009-03-19 5:07 ` [PATCH 8/9] net/pasemi_mac: Rework pasemi_mac driver to use of_mdio infrastructure Grant Likely
2009-03-19 5:07 ` Grant Likely
2009-03-19 5:01 ` [PATCH 9/9] net/fs_enet: Rework fs_enet " Grant Likely
2009-03-19 5:07 ` Grant Likely
2009-03-19 5:07 ` Grant Likely
2009-03-19 5:42 ` David Miller
2009-03-19 5:42 ` David Miller
2009-03-19 6:11 ` Grant Likely
2009-03-19 6:11 ` Grant Likely
2009-03-19 5:05 ` [PATCH 1/9] of: add of_parse_phandle() helper for parsing phandle properties Grant Likely
2009-03-19 5:05 ` Grant Likely
2009-03-19 5:07 ` Michael Ellerman
2009-03-19 5:07 ` Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090319050055.11320.62033.stgit@localhost.localdomain \
--to=grant.likely@secretlab.ca \
--cc=afleming@freescale.com \
--cc=avorontsov@ru.mvista.com \
--cc=davem@davemloft.net \
--cc=galak@kernel.crashing.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.