summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2011-06-13 10:58:13 -0700
committerSimon Glass <sjg@chromium.org>2011-08-29 10:39:24 -0700
commit01d1f9a370e1917b772023a2501acebc72ee6ab5 (patch)
tree3061e9d759ebd93ef99e3276b13c93f26ea75001 /drivers
parentf8081a7f4eceb454b55d387d7689933acd9f68c5 (diff)
tegra2: Run-time assignment of USB port numbers
USB ports relied on CONFIG_TEGRA2_USBx macros to select the ordering. This change records the order that the ports are configured and uses that to select ports by number. This properly honors CONFIG_TEGRA2_USBx when not using an FDT. Also removed direct access to the USB peripheral address from the Tegra2 EHCI driver. BUG=chromium-os:11623 TEST=usb start; run usb_boot Change-Id: Ib906ec4483bcd95ff9564411f44dc0a2e48fff8c Reviewed-on: http://gerrit.chromium.org/gerrit/2537 Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Tom Warren <twarren@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/host/ehci-tegra.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 553e0ebf7c..3a48c26cdc 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -36,10 +36,17 @@
*/
int ehci_hcd_init(void)
{
- /* EHCI registers start at offset 0x100. For now support only port 0*/
- hccr = (struct ehci_hccr *)(CONFIG_TEGRA2_USB0 + 0x100);
- hcor = (struct ehci_hcor *)((uint32_t) hccr
- + HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
+ u32 our_hccr, our_hcor;
+
+ /*
+ * Select the first port, as we don't have a way of selecting others
+ * yet
+ */
+ if (tegrausb_start_port(0, &our_hccr, &our_hcor))
+ return -1;
+
+ hccr = (struct ehci_hccr *)our_hccr;
+ hcor = (struct ehci_hcor *)our_hcor;
return 0;
}
@@ -51,9 +58,6 @@ int ehci_hcd_init(void)
int ehci_hcd_stop(void)
{
usb_set_host_mode();
- ehci_writel(&hcor->or_usbcmd, 0);
- udelay(1000);
- ehci_writel(&hcor->or_usbcmd, 2);
- udelay(1000);
+ tegrausb_stop_port();
return 0;
}