summaryrefslogtreecommitdiff
path: root/drivers/usb/host/ehci-hcd.c
diff options
context:
space:
mode:
authorKuo-Jung Su <dantesu@faraday-tech.com>2013-05-15 15:29:21 +0800
committerMarek Vasut <marex@denx.de>2013-06-12 22:22:51 +0200
commit1dde1423ad341b5d157ed7ee1f1b136f4ee7dbb4 (patch)
tree91bcd6f226c2e2d54bd39ca680cb95a46340272e /drivers/usb/host/ehci-hcd.c
parent9c6a9d7c8be40f58cf3faf0a4b8d9d33a21ca4f5 (diff)
downloadu-boot-imx-1dde1423ad341b5d157ed7ee1f1b136f4ee7dbb4.zip
u-boot-imx-1dde1423ad341b5d157ed7ee1f1b136f4ee7dbb4.tar.gz
u-boot-imx-1dde1423ad341b5d157ed7ee1f1b136f4ee7dbb4.tar.bz2
usb: ehci: add weak-aliased function for PORTSC
There is at least one non-EHCI compliant controller (i.e. Faraday EHCI) not only leave RESERVED and CONFIGFLAG registers un-implemented but also has their address spaces removed. As an result, the PORTSC register of Faraday EHCI always starts from 0x30 instead of 0x44 in standard EHCI. So that we'll need a weak-aliased function for abstraction. Signed-off-by: Kuo-Jung Su <dantesu@faraday-tech.com> CC: Marek Vasut <marex@denx.de>
Diffstat (limited to 'drivers/usb/host/ehci-hcd.c')
-rw-r--r--drivers/usb/host/ehci-hcd.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 443cc23..7e8e85c 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -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;