diff options
author | Rama Kandhala <rkandhala@nvidia.com> | 2010-03-01 21:38:06 +0530 |
---|---|---|
committer | Gary King <gking@nvidia.com> | 2010-03-02 14:48:00 -0800 |
commit | 39134556d653e86a6f58c1ecac24e660a7cd1627 (patch) | |
tree | f23f5a9b4412eace47564e4118759a8a662b7c6d /arch/arm/mach-tegra/init_common.c | |
parent | 67ef90803f261db3999f89402b29618c571d7326 (diff) |
tegra usb: Clean up of host initialization
Usb host initialization code clean up for using native calls instead of Rm APIs.
Change-Id: I98af3666f310cf44554f78bcdec47eb860d71f18
Reviewed-on: http://git-master/r/717
Reviewed-by: Pavan Kunapuli <pkunapuli@nvidia.com>
Tested-by: Pavan Kunapuli <pkunapuli@nvidia.com>
Reviewed-by: Gary King <gking@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/init_common.c')
-rwxr-xr-x | arch/arm/mach-tegra/init_common.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/arch/arm/mach-tegra/init_common.c b/arch/arm/mach-tegra/init_common.c index cd6c2e50c175..76a106e79ee1 100755 --- a/arch/arm/mach-tegra/init_common.c +++ b/arch/arm/mach-tegra/init_common.c @@ -580,29 +580,16 @@ static inline int tegra_is_udc(NvU32 mod) static void __init tegra_register_usb_host(void) { NvU32 port_count, i; - port_count = NvRmModuleGetNumInstances(s_hRmGlobal, NvRmModuleID_Usb2Otg); for (i=0; i<port_count; i++) { const NvOdmUsbProperty *p; - struct platform_device *platdev = NULL; + struct resource *res; struct tegra_hcd_platform_data pdata; + struct platform_device *platdev = NULL; - NvU32 mod = NVRM_MODULE_ID(NvRmModuleID_Usb2Otg, i); - NvRmPhysAddr cont_addr; - NvU32 len; - NvU16 irq; - - /* fixme: add ulpi here? */ p = NvOdmQueryGetUsbProperty(NvOdmIoModule_Usb, i); - if (!p || !((p->UsbMode & NvOdmUsbModeType_Host) || - (p->UsbMode & NvOdmUsbModeType_OTG) ) || - (tegra_is_udc(mod) && !(p->UsbMode & NvOdmUsbModeType_OTG))) - continue; - - irq = NvRmGetIrqForLogicalInterrupt(s_hRmGlobal, mod, 0); - NvRmModuleGetBaseAddress(s_hRmGlobal, mod, &cont_addr, &len); - if (irq==0xffff || !(~cont_addr) || !len) + if (!p || (p->UsbMode & NvOdmUsbModeType_Device)) continue; platdev = platform_device_alloc("tegra-ehci", i); @@ -611,9 +598,26 @@ static void __init tegra_register_usb_host(void) goto fail; } + res = kzalloc(sizeof(struct resource)*2, GFP_KERNEL); + if (!res) { + pr_err("unable to allocate resource for tegra-otg\n"); + goto fail; + } + + res[0].flags = IORESOURCE_MEM; + res[0].start = tegra_get_module_inst_base("usbotg", i); + res[0].end = res[0].start + tegra_get_module_inst_size("usbotg", i) - 1; + res[1].flags = IORESOURCE_IRQ; + res[1].start = res[1].end = tegra_get_module_inst_irq("usbotg", i, 0); + + if (platform_device_add_resources(platdev, res, 2)) { + pr_err("unable to add resources to tegra-ehci device\n"); + goto fail; + } memset(&pdata, 0, sizeof(pdata)); pdata.instance = i; + pdata.pUsbProperty = p; if (platform_device_add_data(platdev, &pdata, sizeof(pdata))) { pr_err("unable to add data to tegra-ehci device\n"); @@ -626,7 +630,7 @@ static void __init tegra_register_usb_host(void) } } fail: - ; + ; } #endif |