diff options
author | Andy Fleming <afleming@gmail.com> | 2014-01-10 01:28:11 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-13 17:29:49 -0500 |
commit | 7614aba6a330a6c4937edc24fd4c6a935c1ae703 (patch) | |
tree | b18119276b59537a5a280a0fbe17def8dff3f020 | |
parent | 257184d7cc03519e1ea37b421879767b4194ce8c (diff) |
phylib: Add of_phy_attach
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 <afleming@gmail.com>
Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/of/of_mdio.c | 20 | ||||
-rw-r--r-- | include/linux/of_mdio.h | 10 |
2 files changed, 30 insertions, 0 deletions
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index a43b8523c61e..875b7b6f0d2a 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c | |||
@@ -254,3 +254,23 @@ struct phy_device *of_phy_connect_fixed_link(struct net_device *dev, | |||
254 | return IS_ERR(phy) ? NULL : phy; | 254 | return IS_ERR(phy) ? NULL : phy; |
255 | } | 255 | } |
256 | EXPORT_SYMBOL(of_phy_connect_fixed_link); | 256 | EXPORT_SYMBOL(of_phy_connect_fixed_link); |
257 | |||
258 | /** | ||
259 | * of_phy_attach - Attach to a PHY without starting the state machine | ||
260 | * @dev: pointer to net_device claiming the phy | ||
261 | * @phy_np: Node pointer for the PHY | ||
262 | * @flags: flags to pass to the PHY | ||
263 | * @iface: PHY data interface type | ||
264 | */ | ||
265 | struct phy_device *of_phy_attach(struct net_device *dev, | ||
266 | struct device_node *phy_np, u32 flags, | ||
267 | phy_interface_t iface) | ||
268 | { | ||
269 | struct phy_device *phy = of_phy_find_device(phy_np); | ||
270 | |||
271 | if (!phy) | ||
272 | return NULL; | ||
273 | |||
274 | return phy_attach_direct(dev, phy, flags, iface) ? NULL : phy; | ||
275 | } | ||
276 | EXPORT_SYMBOL(of_phy_attach); | ||
diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h index 8163107b94b4..6fe8464ed767 100644 --- a/include/linux/of_mdio.h +++ b/include/linux/of_mdio.h | |||
@@ -19,6 +19,9 @@ extern struct phy_device *of_phy_connect(struct net_device *dev, | |||
19 | struct device_node *phy_np, | 19 | struct device_node *phy_np, |
20 | void (*hndlr)(struct net_device *), | 20 | void (*hndlr)(struct net_device *), |
21 | u32 flags, phy_interface_t iface); | 21 | u32 flags, phy_interface_t iface); |
22 | struct phy_device *of_phy_attach(struct net_device *dev, | ||
23 | struct device_node *phy_np, u32 flags, | ||
24 | phy_interface_t iface); | ||
22 | extern struct phy_device *of_phy_connect_fixed_link(struct net_device *dev, | 25 | extern struct phy_device *of_phy_connect_fixed_link(struct net_device *dev, |
23 | void (*hndlr)(struct net_device *), | 26 | void (*hndlr)(struct net_device *), |
24 | phy_interface_t iface); | 27 | phy_interface_t iface); |
@@ -44,6 +47,13 @@ static inline struct phy_device *of_phy_connect(struct net_device *dev, | |||
44 | return NULL; | 47 | return NULL; |
45 | } | 48 | } |
46 | 49 | ||
50 | static inline struct phy_device *of_phy_attach(struct net_device *dev, | ||
51 | struct device_node *phy_np, | ||
52 | u32 flags, phy_interface_t iface) | ||
53 | { | ||
54 | return NULL; | ||
55 | } | ||
56 | |||
47 | static inline struct phy_device *of_phy_connect_fixed_link(struct net_device *dev, | 57 | static inline struct phy_device *of_phy_connect_fixed_link(struct net_device *dev, |
48 | void (*hndlr)(struct net_device *), | 58 | void (*hndlr)(struct net_device *), |
49 | phy_interface_t iface) | 59 | phy_interface_t iface) |