int ret;
/* Halting the Host first */
- debug("// Halt the HC\n");
+ debug("// Halt the HC: %p\n", hcor);
state = xhci_readl(&hcor->or_usbsts) & STS_HALT;
if (!state) {
cmd = xhci_readl(&hcor->or_usbcmd);
struct xhci_ctrl *ctrl;
int ret;
+ *controller = NULL;
+
if (xhci_hcd_init(index, &hccr, (struct xhci_hcor **)&hcor) != 0)
return -ENODEV;
ret = xhci_lowlevel_init(ctrl);
- *controller = &xhcic[index];
+ if (ret) {
+ ctrl->hccr = NULL;
+ ctrl->hcor = NULL;
+ } else {
+ *controller = &xhcic[index];
+ }
return ret;
}
{
struct xhci_ctrl *ctrl = (xhcic + index);
- xhci_lowlevel_stop(ctrl);
- xhci_hcd_stop(index);
- xhci_cleanup(ctrl);
+ if (ctrl->hcor) {
+ xhci_lowlevel_stop(ctrl);
+ xhci_hcd_stop(index);
+ xhci_cleanup(ctrl);
+ }
return 0;
}
if (device_get_uclass_id(dev) == UCLASS_USB)
udev = dev_get_uclass_priv(dev);
else
- udev = dev_get_parentdata(dev);
+ udev = dev_get_parent_priv(dev);
return udev;
}
} else {
while (!is_root_hub(hub->parent))
hub = hub->parent;
- uhop = dev_get_parentdata(hub);
+ uhop = dev_get_parent_priv(hub);
root_portnr = uhop->portnr;
}
}