diff options
author | Gary King <gking@nvidia.com> | 2009-12-21 20:44:44 -0800 |
---|---|---|
committer | Gary King <gking@nvidia.com> | 2009-12-21 20:44:44 -0800 |
commit | 3ac40349c04de4fa645cfc2f1054ed2e7cdf254c (patch) | |
tree | ff789c26538feaa31cfb79fdb370b1701ca50aa4 /arch/arm/mach-tegra/init_common.c | |
parent | 9906366d955a8f43661eb5d44af8638d52c750b1 (diff) |
tegra: fix EHCI and UDC registration
previous UDC check would fail if UDC was not on controller 0, causing EHCI
registration to fail.
EHCI registration had cut-and-paste leftovers from UDC registration, which
overwrote platdev with a second registration of tegra-udc, rather than
tegra-ehci.
Diffstat (limited to 'arch/arm/mach-tegra/init_common.c')
-rw-r--r-- | arch/arm/mach-tegra/init_common.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/arch/arm/mach-tegra/init_common.c b/arch/arm/mach-tegra/init_common.c index 1da5f0f1de08..33c13b035a13 100644 --- a/arch/arm/mach-tegra/init_common.c +++ b/arch/arm/mach-tegra/init_common.c @@ -443,6 +443,7 @@ static inline unsigned long tegra_get_phy_base(void) #endif static u64 tegra_udc_dma_mask = DMA_32BIT_MASK; +static NvU32 tegra_udc_module_id = 0; static void __init tegra_register_usb_gadget(void) { @@ -506,6 +507,7 @@ static void __init tegra_register_usb_gadget(void) goto fail; } + tegra_udc_module_id = mod; platdev->dev.coherent_dma_mask = ~0; platdev->dev.dma_mask = &tegra_udc_dma_mask; } @@ -516,14 +518,9 @@ fail: * with device capabilities is registered as tegra-udc, the rest (if Host is also' * specified for the ports) are registered as tegra-ehci */ -static inline int tegra_is_udc(const NvOdmUsbProperty *p) +static inline int tegra_is_udc(NvU32 mod) { - static int dev_found = 0; - int prev = dev_found; - - dev_found |= (p->UsbMode & NvOdmUsbModeType_Device); - - return (p->UsbMode & NvOdmUsbModeType_Device) && !prev; + return (mod==tegra_udc_module_id); } #endif /* CONFIG_USB_TEGRA */ @@ -548,26 +545,21 @@ static void __init tegra_register_usb_host(void) /* fixme: add ulpi here? */ p = NvOdmQueryGetUsbProperty(NvOdmIoModule_Usb, i); - if (!p || !(p->UsbMode & NvOdmUsbModeType_Host) || tegra_is_udc(p)) + if (!p || !(p->UsbMode & NvOdmUsbModeType_Host) || tegra_is_udc(mod)) continue; - platdev = platform_device_alloc("tegra-ehci", i); - if (!platdev) { - pr_err("unable to allocate device for tegra-ehci\n"); - goto fail; - } - irq = NvRmGetIrqForLogicalInterrupt(s_hRmGlobal, mod, 0); NvRmModuleGetBaseAddress(s_hRmGlobal, mod, &cont_addr, &len); if (irq==0xffff || !(~cont_addr) || !len) continue; - platdev = platform_device_alloc("tegra-udc", i); + platdev = platform_device_alloc("tegra-ehci", i); if (!platdev) { - pr_err("unable to allocate platform device for tegra-udc\n"); + pr_err("unable to allocate device for tegra-ehci\n"); goto fail; } + memset(&pdata, 0, sizeof(pdata)); pdata.instance = i; |