summaryrefslogtreecommitdiffstats
path: root/drivers/phy
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-09-29 11:40:30 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2016-09-29 14:00:33 +0200
commit081554dca90cdc59d6ca64f83125e741078ea0d9 (patch)
tree6fb98a17ebce86a84c8b54a5baf8c409ee6f2c81 /drivers/phy
parent850557842f01ecb47b00ecb43b3bc3c8f1bb826f (diff)
downloadbarebox-081554dca90cdc59d6ca64f83125e741078ea0d9.tar.gz
phy: Introduce to_usbphy conversion function
The generic phy support layer has the necessary list handling and phy retrieval functions, so we should reuse them for usb phys. This adds a phy_to_usbphy() conversion function which drivers can implement which attach to the generic phy layer and are really usb phys. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/phy')
-rw-r--r--drivers/phy/phy-core.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index 7c1f3d4..1b6a9f7 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -15,6 +15,7 @@
#include <common.h>
#include <malloc.h>
#include <linux/phy/phy.h>
+#include <usb/phy.h>
static LIST_HEAD(phy_provider_list);
static int phy_ida;
@@ -201,6 +202,17 @@ int phy_power_off(struct phy *phy)
return 0;
}
+struct usb_phy *phy_to_usbphy(struct phy *phy)
+{
+ if (!phy)
+ return NULL;
+
+ if (!phy->ops->to_usbphy)
+ return ERR_PTR(-EINVAL);
+
+ return phy->ops->to_usbphy(phy);
+}
+
static struct phy_provider *of_phy_provider_lookup(struct device_node *node)
{
struct phy_provider *phy_provider;