]> git.sur5r.net Git - u-boot/blobdiff - drivers/usb/host/xhci.c
arm: Add explicit include of <asm/mach-types.h>
[u-boot] / drivers / usb / host / xhci.c
index 0b09643e09ea3ee0965e2982be91d15d4d11d640..32011774768fb6ed73550c931c297ee63c5da0f3 100644 (file)
@@ -28,7 +28,7 @@
 #include <watchdog.h>
 #include <asm/cache.h>
 #include <asm/unaligned.h>
-#include <asm-generic/errno.h>
+#include <linux/errno.h>
 #include "xhci.h"
 
 #ifndef CONFIG_USB_MAX_CONTROLLER_COUNT
@@ -199,7 +199,7 @@ int xhci_reset(struct xhci_hcor *hcor)
        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);
@@ -941,10 +941,12 @@ static int _xhci_submit_control_msg(struct usb_device *udev, unsigned long pipe,
        if (usb_pipedevice(pipe) == ctrl->rootdev)
                return xhci_submit_root(udev, pipe, buffer, setup);
 
-       if (setup->request == USB_REQ_SET_ADDRESS)
+       if (setup->request == USB_REQ_SET_ADDRESS &&
+          (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD)
                return xhci_address_device(udev, root_portnr);
 
-       if (setup->request == USB_REQ_SET_CONFIGURATION) {
+       if (setup->request == USB_REQ_SET_CONFIGURATION &&
+          (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) {
                ret = xhci_set_configuration(udev);
                if (ret) {
                        puts("Failed to configure xHCI endpoint\n");
@@ -1064,6 +1066,8 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller)
        struct xhci_ctrl *ctrl;
        int ret;
 
+       *controller = NULL;
+
        if (xhci_hcd_init(index, &hccr, (struct xhci_hcor **)&hcor) != 0)
                return -ENODEV;
 
@@ -1077,7 +1081,12 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller)
 
        ret = xhci_lowlevel_init(ctrl);
 
-       *controller = &xhcic[index];
+       if (ret) {
+               ctrl->hccr = NULL;
+               ctrl->hcor = NULL;
+       } else {
+               *controller = &xhcic[index];
+       }
 
        return ret;
 }
@@ -1093,9 +1102,11 @@ int usb_lowlevel_stop(int index)
 {
        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;
 }
@@ -1110,7 +1121,7 @@ static struct usb_device *get_usb_device(struct udevice *dev)
        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;
 }
@@ -1141,7 +1152,7 @@ static int xhci_submit_control_msg(struct udevice *dev, struct usb_device *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;
                }
        }