Lines Matching +full:phy +full:- +full:device
1 // SPDX-License-Identifier: GPL-2.0+
4 * multiple (actual) PHY devices. This is comes handy when initializing
10 #include <linux/device.h>
12 #include <linux/phy/phy.h>
15 #include "phy.h"
18 struct phy *phy; member
22 static int usb_phy_roothub_add_phy(struct device *dev, int index, in usb_phy_roothub_add_phy()
26 struct phy *phy; in usb_phy_roothub_add_phy() local
28 phy = devm_of_phy_get_by_index(dev, dev->of_node, index); in usb_phy_roothub_add_phy()
29 if (IS_ERR(phy)) { in usb_phy_roothub_add_phy()
30 if (PTR_ERR(phy) == -ENODEV) in usb_phy_roothub_add_phy()
33 return PTR_ERR(phy); in usb_phy_roothub_add_phy()
38 return -ENOMEM; in usb_phy_roothub_add_phy()
40 INIT_LIST_HEAD(&roothub_entry->list); in usb_phy_roothub_add_phy()
42 roothub_entry->phy = phy; in usb_phy_roothub_add_phy()
44 list_add_tail(&roothub_entry->list, list); in usb_phy_roothub_add_phy()
49 struct usb_phy_roothub *usb_phy_roothub_alloc(struct device *dev) in usb_phy_roothub_alloc()
57 num_phys = of_count_phandle_with_args(dev->of_node, "phys", in usb_phy_roothub_alloc()
58 "#phy-cells"); in usb_phy_roothub_alloc()
64 return ERR_PTR(-ENOMEM); in usb_phy_roothub_alloc()
66 INIT_LIST_HEAD(&phy_roothub->list); in usb_phy_roothub_alloc()
69 err = usb_phy_roothub_add_phy(dev, i, &phy_roothub->list); in usb_phy_roothub_alloc()
87 head = &phy_roothub->list; in usb_phy_roothub_init()
90 err = phy_init(roothub_entry->phy); in usb_phy_roothub_init()
99 phy_exit(roothub_entry->phy); in usb_phy_roothub_init()
114 head = &phy_roothub->list; in usb_phy_roothub_exit()
117 err = phy_exit(roothub_entry->phy); in usb_phy_roothub_exit()
136 head = &phy_roothub->list; in usb_phy_roothub_set_mode()
139 err = phy_set_mode(roothub_entry->phy, mode); in usb_phy_roothub_set_mode()
148 phy_power_off(roothub_entry->phy); in usb_phy_roothub_set_mode()
163 head = &phy_roothub->list; in usb_phy_roothub_calibrate()
166 err = phy_calibrate(roothub_entry->phy); in usb_phy_roothub_calibrate()
184 head = &phy_roothub->list; in usb_phy_roothub_power_on()
187 err = phy_power_on(roothub_entry->phy); in usb_phy_roothub_power_on()
196 phy_power_off(roothub_entry->phy); in usb_phy_roothub_power_on()
209 list_for_each_entry_reverse(roothub_entry, &phy_roothub->list, list) in usb_phy_roothub_power_off()
210 phy_power_off(roothub_entry->phy); in usb_phy_roothub_power_off()
214 int usb_phy_roothub_suspend(struct device *controller_dev, in usb_phy_roothub_suspend()
219 /* keep the PHYs initialized so the device can wake up the system */ in usb_phy_roothub_suspend()
227 int usb_phy_roothub_resume(struct device *controller_dev, in usb_phy_roothub_resume()
232 /* if the device can't wake up the system _exit was called */ in usb_phy_roothub_resume()