Lines Matching refs:dev
55 struct usb_device *dev; /* USB hub device to scan */ member
82 static int usb_set_hub_depth(struct usb_device *dev, int depth) in usb_set_hub_depth() argument
87 return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), in usb_set_hub_depth()
93 static int usb_get_hub_descriptor(struct usb_device *dev, void *data, int size) in usb_get_hub_descriptor() argument
97 if (usb_hub_is_superspeed(dev)) in usb_get_hub_descriptor()
100 return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), in usb_get_hub_descriptor()
105 static int usb_clear_port_feature(struct usb_device *dev, int port, int feature) in usb_clear_port_feature() argument
107 return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), in usb_clear_port_feature()
112 static int usb_set_port_feature(struct usb_device *dev, int port, int feature) in usb_set_port_feature() argument
114 return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), in usb_set_port_feature()
119 static int usb_get_hub_status(struct usb_device *dev, void *data) in usb_get_hub_status() argument
121 return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), in usb_get_hub_status()
126 int usb_get_port_status(struct usb_device *dev, int port, void *data) in usb_get_port_status() argument
130 ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), in usb_get_port_status()
147 if (!usb_hub_is_root_hub(dev->dev) && usb_hub_is_superspeed(dev)) { in usb_get_port_status()
168 struct usb_device *dev; in usb_hub_power_on() local
172 dev = hub->pusb_dev; in usb_hub_power_on()
175 for (i = 0; i < dev->maxchild; i++) { in usb_hub_power_on()
176 if (usb_hub_is_superspeed(dev)) { in usb_hub_power_on()
177 usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_RESET); in usb_hub_power_on()
178 debug("Reset : port %d returns %lX\n", i + 1, dev->status); in usb_hub_power_on()
180 usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER); in usb_hub_power_on()
181 debug("PowerOn : port %d returns %lX\n", i + 1, dev->status); in usb_hub_power_on()
220 dev->devnum, max(100, (int)pgood_delay), in usb_hub_power_on()
272 static int usb_hub_port_reset(struct usb_device *dev, int port, in usb_hub_port_reset() argument
281 debug("%s: resetting '%s' port %d...\n", __func__, dev->dev->name, in usb_hub_port_reset()
287 err = usb_set_port_feature(dev, port + 1, USB_PORT_FEAT_RESET); in usb_hub_port_reset()
293 if (usb_get_port_status(dev, port + 1, portsts) < 0) { in usb_hub_port_reset()
295 dev->status); in usb_hub_port_reset()
341 usb_clear_port_feature(dev, port + 1, USB_PORT_FEAT_C_RESET); in usb_hub_port_reset()
346 int usb_hub_port_connect_change(struct usb_device *dev, int port) in usb_hub_port_connect_change() argument
353 ret = usb_get_port_status(dev, port + 1, portsts); in usb_hub_port_connect_change()
366 usb_clear_port_feature(dev, port + 1, USB_PORT_FEAT_C_CONNECTION); in usb_hub_port_connect_change()
371 usb_device_has_child_on_port(dev, port)) { in usb_hub_port_connect_change()
379 ret = usb_hub_port_reset(dev, port, &portstatus); in usb_hub_port_connect_change()
411 ret = usb_scan_device(dev->dev, port + 1, speed, &child); in usb_hub_port_connect_change()
415 ret = usb_alloc_new_device(dev->controller, &usb); in usb_hub_port_connect_change()
421 dev->children[port] = usb; in usb_hub_port_connect_change()
423 usb->parent = dev; in usb_hub_port_connect_change()
429 usb_free_device(dev->controller); in usb_hub_port_connect_change()
430 dev->children[port] = NULL; in usb_hub_port_connect_change()
435 usb_clear_port_feature(dev, port + 1, USB_PORT_FEAT_ENABLE); in usb_hub_port_connect_change()
446 struct usb_device *dev; in usb_scan_port() local
451 dev = usb_scan->dev; in usb_scan_port()
462 ret = usb_get_port_status(dev, i + 1, portsts); in usb_scan_port()
467 dev->devnum, i + 1); in usb_scan_port()
491 dev->devnum, i + 1); in usb_scan_port()
502 usb_clear_port_feature(dev, i + 1, USB_PORT_FEAT_C_RESET); in usb_scan_port()
506 usb_hub_is_superspeed(dev)) { in usb_scan_port()
508 usb_clear_port_feature(dev, i + 1, USB_SS_PORT_FEAT_C_BH_RESET); in usb_scan_port()
512 debug("devnum=%d port=%d: USB dev found\n", dev->devnum, i + 1); in usb_scan_port()
514 usb_hub_port_connect_change(dev, i); in usb_scan_port()
518 usb_clear_port_feature(dev, i + 1, USB_PORT_FEAT_C_ENABLE); in usb_scan_port()
526 usb_device_has_child_on_port(dev, i)) { in usb_scan_port()
529 usb_hub_port_connect_change(dev, i); in usb_scan_port()
535 usb_clear_port_feature(dev, i + 1, USB_PORT_FEAT_SUSPEND); in usb_scan_port()
540 usb_clear_port_feature(dev, i + 1, in usb_scan_port()
543 usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER); in usb_scan_port()
608 static struct usb_hub_device *usb_get_hub_device(struct usb_device *dev) in usb_get_hub_device() argument
616 hub = dev_get_uclass_priv(dev->dev); in usb_get_hub_device()
622 static int usb_hub_configure(struct usb_device *dev) in usb_hub_configure() argument
633 hub = usb_get_hub_device(dev); in usb_hub_configure()
636 hub->pusb_dev = dev; in usb_hub_configure()
639 ret = usb_get_hub_descriptor(dev, buffer, 4); in usb_hub_configure()
642 "descriptor, giving up %lX\n", dev->status); in usb_hub_configure()
650 ret = usb_get_hub_descriptor(dev, buffer, length); in usb_hub_configure()
653 "descriptor 2nd giving up %lX\n", dev->status); in usb_hub_configure()
676 dev->maxchild = descriptor->bNbrPorts; in usb_hub_configure()
677 debug("%d ports detected\n", dev->maxchild); in usb_hub_configure()
711 switch (dev->descriptor.bDeviceProtocol) { in usb_hub_configure()
718 ret = usb_set_interface(dev, 0, 1); in usb_hub_configure()
731 dev->descriptor.bDeviceProtocol); in usb_hub_configure()
738 if (dev->descriptor.bDeviceProtocol != 0) { in usb_hub_configure()
766 for (i = 0; i < dev->maxchild; i++) in usb_hub_configure()
777 ret = usb_get_hub_status(dev, buffer); in usb_hub_configure()
780 dev->status); in usb_hub_configure()
801 ret = usb_update_hub_device(dev); in usb_hub_configure()
817 if (usb_hub_is_root_hub(dev->dev)) { in usb_hub_configure()
823 hdev = dev->dev->parent; in usb_hub_configure()
831 if (usb_hub_is_superspeed(dev)) { in usb_hub_configure()
832 debug("set hub (%p) depth to %d\n", dev, depth); in usb_hub_configure()
838 ret = usb_set_hub_depth(dev, depth); in usb_hub_configure()
841 __func__, dev->status); in usb_hub_configure()
855 for (i = 0; i < dev->maxchild; i++) in usb_hub_configure()
865 for (i = 0; i < dev->maxchild; i++) { in usb_hub_configure()
873 usb_scan->dev = dev; in usb_hub_configure()
887 static int usb_hub_check(struct usb_device *dev, int ifnum) in usb_hub_check() argument
892 iface = &dev->config.if_desc[ifnum]; in usb_hub_check()
927 int usb_hub_probe(struct usb_device *dev, int ifnum) in usb_hub_probe() argument
931 ret = usb_hub_check(dev, ifnum); in usb_hub_probe()
934 ret = usb_hub_configure(dev); in usb_hub_probe()
946 static int usb_hub_post_probe(struct udevice *dev) in usb_hub_post_probe() argument
949 return usb_hub_scan(dev); in usb_hub_post_probe()