]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - drivers/usb/host/ehci-hcd.c
usb: ehci: add weak-aliased function for PORTSC
[people/ms/u-boot.git] / drivers / usb / host / ehci-hcd.c
index 443cc2313465fcc872f21fbca52914a9bf50c2f2..7e8e85c2bb62056aa8f78bd29ce99eb179437eba 100644 (file)
@@ -603,6 +603,17 @@ fail:
        return -1;
 }
 
+__weak uint32_t *ehci_get_portsc_register(struct ehci_hcor *hcor, int port)
+{
+       if (port < 0 || port >= CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS) {
+               /* Printing the message would cause a scan failure! */
+               debug("The request port(%u) is not configured\n", port);
+               return NULL;
+       }
+
+       return (uint32_t *)&hcor->or_portsc[port];
+}
+
 int
 ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
                 int length, struct devrequest *req)
@@ -629,11 +640,9 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
        case USB_REQ_GET_STATUS | ((USB_RT_PORT | USB_DIR_IN) << 8):
        case USB_REQ_SET_FEATURE | ((USB_DIR_OUT | USB_RT_PORT) << 8):
        case USB_REQ_CLEAR_FEATURE | ((USB_DIR_OUT | USB_RT_PORT) << 8):
-               if (!port || port > CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS) {
-                       printf("The request port(%d) is not configured\n", port - 1);
+               status_reg = ehci_get_portsc_register(ctrl->hcor, port - 1);
+               if (!status_reg)
                        return -1;
-               }
-               status_reg = (uint32_t *)&ctrl->hcor->or_portsc[port - 1];
                break;
        default:
                status_reg = NULL;