* [PATCH 5/6] [v4] phylib: Support attaching to generic 10g driver
@ 2014-01-07 2:14 shh.xie
2014-01-07 5:56 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: shh.xie @ 2014-01-07 2:14 UTC (permalink / raw)
To: davem, jg1.han, mugunthanvnm, f.fainelli, netdev, linux-kernel
Cc: Shaohui.Xie, Andy Fleming
From: Andy Fleming <afleming@gmail.com>
phy_attach_direct() may now attach to a generic 10G driver. It can
also be used exactly as phy_connect_direct(), which will be useful
when using of_mdio, as phy_connect (and therefore of_phy_connect)
start the PHY state machine, which is currently irrelevant for 10G
PHYs.
Signed-off-by: Andy Fleming <afleming@gmail.com>
Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
---
resend for v4.
drivers/net/phy/phy_device.c | 20 ++++++++------------
include/linux/phy.h | 2 ++
2 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 439b0d4..6eab488 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -67,9 +67,6 @@ extern void mdio_bus_exit(void);
static LIST_HEAD(phy_fixup_list);
static DEFINE_MUTEX(phy_fixup_lock);
-static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
- u32 flags, phy_interface_t interface);
-
/*
* Creates a new phy_fixup and adds it to the list
* @bus_id: A string which matches phydev->dev.bus_id (or PHY_ANY_ID)
@@ -527,12 +524,12 @@ int phy_init_hw(struct phy_device *phydev)
*
* Description: Called by drivers to attach to a particular PHY
* device. The phy_device is found, and properly hooked up
- * to the phy_driver. If no driver is attached, then the
- * genphy_driver is used. The phy_device is given a ptr to
+ * to the phy_driver. If no driver is attached, then a
+ * generic driver is used. The phy_device is given a ptr to
* the attaching device, and given a callback for link status
* change. The phy_device is returned to the attaching driver.
*/
-static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
+int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
u32 flags, phy_interface_t interface)
{
struct device *d = &phydev->dev;
@@ -541,12 +538,10 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
/* Assume that if there is no driver, that it doesn't
* exist, and we should use the genphy driver. */
if (NULL == d->driver) {
- if (phydev->is_c45) {
- pr_err("No driver for phy %x\n", phydev->phy_id);
- return -ENODEV;
- }
-
- d->driver = &genphy_driver[GENPHY_DRV_1G].driver;
+ if (phydev->is_c45)
+ d->driver = &genphy_driver[GENPHY_DRV_10G].driver;
+ else
+ d->driver = &genphy_driver[GENPHY_DRV_1G].driver;
err = d->driver->probe(d);
if (err >= 0)
@@ -579,6 +574,7 @@ static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
return err;
}
+EXPORT_SYMBOL(phy_attach_direct);
/**
* phy_attach - attach a network device to a particular PHY device
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 1d6d1b9..5ccbac1 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -581,6 +581,8 @@ int phy_init_hw(struct phy_device *phydev);
struct phy_device * phy_attach(struct net_device *dev,
const char *bus_id, phy_interface_t interface);
struct phy_device *phy_find_first(struct mii_bus *bus);
+int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
+ u32 flags, phy_interface_t interface);
int phy_connect_direct(struct net_device *dev, struct phy_device *phydev,
void (*handler)(struct net_device *),
phy_interface_t interface);
--
1.8.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 5/6] [v4] phylib: Support attaching to generic 10g driver
2014-01-07 2:14 [PATCH 5/6] [v4] phylib: Support attaching to generic 10g driver shh.xie
@ 2014-01-07 5:56 ` David Miller
2014-01-07 7:04 ` Shaohui Xie
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2014-01-07 5:56 UTC (permalink / raw)
To: shh.xie
Cc: jg1.han, mugunthanvnm, f.fainelli, netdev, linux-kernel,
Shaohui.Xie, afleming
From: <shh.xie@gmail.com>
Date: Tue, 7 Jan 2014 10:14:25 +0800
> -static int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
> +int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
> u32 flags, phy_interface_t interface)
Since you are changing where the open parenthesis is, you must reindent
the arguments on the second line so that they start exactly at the
first column after that openning parenthesis.
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH 5/6] [v4] phylib: Support attaching to generic 10g driver
2014-01-07 5:56 ` David Miller
@ 2014-01-07 7:04 ` Shaohui Xie
0 siblings, 0 replies; 3+ messages in thread
From: Shaohui Xie @ 2014-01-07 7:04 UTC (permalink / raw)
To: David Miller, shh.xie@gmail.com
Cc: jg1.han@samsung.com, mugunthanvnm@ti.com, f.fainelli@gmail.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
afleming@gmail.com
> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Tuesday, January 07, 2014 1:56 PM
> To: shh.xie@gmail.com
> Cc: jg1.han@samsung.com; mugunthanvnm@ti.com; f.fainelli@gmail.com;
> netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Xie Shaohui-B21989;
> afleming@gmail.com
> Subject: Re: [PATCH 5/6] [v4] phylib: Support attaching to generic 10g
> driver
>
> From: <shh.xie@gmail.com>
> Date: Tue, 7 Jan 2014 10:14:25 +0800
>
> > -static int phy_attach_direct(struct net_device *dev, struct
> > phy_device *phydev,
> > +int phy_attach_direct(struct net_device *dev, struct phy_device
> > +*phydev,
> > u32 flags, phy_interface_t interface)
>
> Since you are changing where the open parenthesis is, you must reindent
> the arguments on the second line so that they start exactly at the first
> column after that openning parenthesis.
>
[S.H] OK. Thank you!
Will fix it in next version.
Best Regards,
Shaohui Xie
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-01-07 7:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-07 2:14 [PATCH 5/6] [v4] phylib: Support attaching to generic 10g driver shh.xie
2014-01-07 5:56 ` David Miller
2014-01-07 7:04 ` Shaohui Xie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox