* [PATCH 4/4] phylib: Add of_phy_attach
@ 2013-11-11 11:08 shh.xie
2013-11-12 12:32 ` Shaohui Xie
0 siblings, 1 reply; 2+ messages in thread
From: shh.xie @ 2013-11-11 11:08 UTC (permalink / raw)
To: linuxppc-dev, linux-kernel; +Cc: Shruti, Shaohui Xie, madalin.bucur
From: Andy Fleming
10G PHYs don't currently support running the state machine, which
is implicitly setup via of_phy_connect(). Therefore, it is necessary
to implement an OF version of phy_attach(), which does everything
except start the state machine.
Signed-off-by: Andy Fleming
Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
---
drivers/of/of_mdio.c | 22 ++++++++++++++++++++--
include/linux/of_mdio.h | 8 ++++++++
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index d5a57a9..a748274 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -221,8 +221,7 @@ EXPORT_SYMBOL(of_phy_connect);
* not call this function from new drivers.
*/
struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
- void (*hndlr)(struct net_device *),
- phy_interface_t iface)
+ void (*hndlr)(struct net_device *), phy_interface_t iface)
{
struct device_node *net_np;
char bus_id[MII_BUS_ID_SIZE + 3];
@@ -247,3 +246,22 @@ struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
return IS_ERR(phy) ? NULL : phy;
}
EXPORT_SYMBOL(of_phy_connect_fixed_link);
+
+/**
+ * of_phy_attach - Attach to a PHY without starting the state machine
+ * @dev: pointer to net_device claiming the phy
+ * @phy_np: Node pointer for the PHY
+ * @flags: flags to pass to the PHY
+ * @iface: PHY data interface type
+ */
+struct phy_device *of_phy_attach(struct net_device *dev,
+ struct device_node *phy_np, u32 flags, phy_interface_t iface)
+{
+ struct phy_device *phy = of_phy_find_device(phy_np);
+
+ if (!phy)
+ return NULL;
+
+ return phy_attach_direct(dev, phy, flags, iface) ? NULL : phy;
+}
+EXPORT_SYMBOL(of_phy_attach);
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h
index 8163107..dcda44d 100644
--- a/include/linux/of_mdio.h
+++ b/include/linux/of_mdio.h
@@ -19,6 +19,8 @@ extern struct phy_device *of_phy_connect(struct net_device *dev,
struct device_node *phy_np,
void (*hndlr)(struct net_device *),
u32 flags, phy_interface_t iface);
+extern struct phy_device *of_phy_attach(struct net_device *dev,
+ struct device_node *phy_np, u32 flags, phy_interface_t iface);
extern struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
void (*hndlr)(struct net_device *),
phy_interface_t iface);
@@ -44,6 +46,12 @@ static inline struct phy_device *of_phy_connect(struct net_device *dev,
return NULL;
}
+static inline struct phy_device *of_phy_attach(struct net_device *dev,
+ struct device_node *phy_np, u32 flags, phy_interface_t iface)
+{
+ return NULL;
+}
+
static inline struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
void (*hndlr)(struct net_device *),
phy_interface_t iface)
--
1.8.4.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH 4/4] phylib: Add of_phy_attach
2013-11-11 11:08 [PATCH 4/4] phylib: Add of_phy_attach shh.xie
@ 2013-11-12 12:32 ` Shaohui Xie
0 siblings, 0 replies; 2+ messages in thread
From: Shaohui Xie @ 2013-11-12 12:32 UTC (permalink / raw)
To: shh.xie@gmail.com, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org
Cc: f.fainelli@gmail.com, netdev@vger.kernel.org, Shruti Kanetkar,
jg1.han@samsung.com, michal.simek@xilinx.com,
peppe.cavallaro@st.com, davem@davemloft.net,
Madalin-Cristian Bucur
Added more people and list.
Best Regards,=20
Shaohui Xie
> -----Original Message-----
> From: shh.xie@gmail.com [mailto:shh.xie@gmail.com]
> Sent: Monday, November 11, 2013 7:08 PM
> To: linuxppc-dev@lists.ozlabs.org; linux-kernel@vger.kernel.org
> Cc: Bucur Madalin-Cristian-B32716; Kanetkar Shruti-B44454; Xie Shaohui-B2=
1989
> Subject: [PATCH 4/4] phylib: Add of_phy_attach
>=20
> From: Andy Fleming
>=20
> 10G PHYs don't currently support running the state machine, which is impl=
icitly
> setup via of_phy_connect(). Therefore, it is necessary to implement an OF
> version of phy_attach(), which does everything except start the state mac=
hine.
>=20
> Signed-off-by: Andy Fleming
> Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
> ---
> drivers/of/of_mdio.c | 22 ++++++++++++++++++++--
> include/linux/of_mdio.h | 8 ++++++++
> 2 files changed, 28 insertions(+), 2 deletions(-)
>=20
> diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index d5a57a9..a=
748274
> 100644
> --- a/drivers/of/of_mdio.c
> +++ b/drivers/of/of_mdio.c
> @@ -221,8 +221,7 @@ EXPORT_SYMBOL(of_phy_connect);
> * not call this function from new drivers.
> */
> struct phy_device *of_phy_connect_fixed_link(struct net_device *dev,
> - void (*hndlr)(struct net_device *),
> - phy_interface_t iface)
> + void (*hndlr)(struct net_device *), phy_interface_t iface)
> {
> struct device_node *net_np;
> char bus_id[MII_BUS_ID_SIZE + 3];
> @@ -247,3 +246,22 @@ struct phy_device *of_phy_connect_fixed_link(struct
> net_device *dev,
> return IS_ERR(phy) ? NULL : phy;
> }
> EXPORT_SYMBOL(of_phy_connect_fixed_link);
> +
> +/**
> + * of_phy_attach - Attach to a PHY without starting the state machine
> + * @dev: pointer to net_device claiming the phy
> + * @phy_np: Node pointer for the PHY
> + * @flags: flags to pass to the PHY
> + * @iface: PHY data interface type
> + */
> +struct phy_device *of_phy_attach(struct net_device *dev,
> + struct device_node *phy_np, u32 flags, phy_interface_t iface) {
> + struct phy_device *phy =3D of_phy_find_device(phy_np);
> +
> + if (!phy)
> + return NULL;
> +
> + return phy_attach_direct(dev, phy, flags, iface) ? NULL : phy; }
> +EXPORT_SYMBOL(of_phy_attach);
> diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h index
> 8163107..dcda44d 100644
> --- a/include/linux/of_mdio.h
> +++ b/include/linux/of_mdio.h
> @@ -19,6 +19,8 @@ extern struct phy_device *of_phy_connect(struct net_dev=
ice
> *dev,
> struct device_node *phy_np,
> void (*hndlr)(struct net_device *),
> u32 flags, phy_interface_t iface);
> +extern struct phy_device *of_phy_attach(struct net_device *dev,
> + struct device_node *phy_np, u32 flags, phy_interface_t iface);
> extern struct phy_device *of_phy_connect_fixed_link(struct net_device *d=
ev,
> void (*hndlr)(struct net_device *),
> phy_interface_t iface);
> @@ -44,6 +46,12 @@ static inline struct phy_device *of_phy_connect(struct
> net_device *dev,
> return NULL;
> }
>=20
> +static inline struct phy_device *of_phy_attach(struct net_device *dev,
> + struct device_node *phy_np, u32 flags, phy_interface_t iface) {
> + return NULL;
> +}
> +
> static inline struct phy_device *of_phy_connect_fixed_link(struct net_de=
vice
> *dev,
> void (*hndlr)(struct net_device
> *),
> phy_interface_t iface)
> --
> 1.8.4.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-11-12 12:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-11 11:08 [PATCH 4/4] phylib: Add of_phy_attach shh.xie
2013-11-12 12:32 ` Shaohui Xie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).