diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2019-01-29 10:23:40 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-01-30 09:22:35 +0100 |
commit | b97a31348379f7beed7664a8d4eab491e227c165 (patch) | |
tree | 484fcbd9a7d97738ebb322918d7f75c29c13d722 /drivers/usb/core/phy.c | |
parent | Merge 5.0-rc4 into usb-next (diff) | |
download | linux-dev-b97a31348379f7beed7664a8d4eab491e227c165.tar.xz linux-dev-b97a31348379f7beed7664a8d4eab491e227c165.zip |
usb: core: comply to PHY framework
Current implementation of the USB core does not take into account the
new PHY framework. Correct the situation by adding a call to
phy_set_mode() before phy_power_on().
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core/phy.c')
-rw-r--r-- | drivers/usb/core/phy.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/usb/core/phy.c b/drivers/usb/core/phy.c index 38b2c776c4b4..7580493b867a 100644 --- a/drivers/usb/core/phy.c +++ b/drivers/usb/core/phy.c @@ -123,6 +123,34 @@ int usb_phy_roothub_exit(struct usb_phy_roothub *phy_roothub) } EXPORT_SYMBOL_GPL(usb_phy_roothub_exit); +int usb_phy_roothub_set_mode(struct usb_phy_roothub *phy_roothub, + enum phy_mode mode) +{ + struct usb_phy_roothub *roothub_entry; + struct list_head *head; + int err; + + if (!phy_roothub) + return 0; + + head = &phy_roothub->list; + + list_for_each_entry(roothub_entry, head, list) { + err = phy_set_mode(roothub_entry->phy, mode); + if (err) + goto err_out; + } + + return 0; + +err_out: + list_for_each_entry_continue_reverse(roothub_entry, head, list) + phy_power_off(roothub_entry->phy); + + return err; +} +EXPORT_SYMBOL_GPL(usb_phy_roothub_set_mode); + int usb_phy_roothub_power_on(struct usb_phy_roothub *phy_roothub) { struct usb_phy_roothub *roothub_entry; |