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 /drivers | |
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 'drivers')
-rwxr-xr-x | drivers/usb/host/ehci-tegra.c | 53 |
1 files changed, 21 insertions, 32 deletions
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index 38f595e43ce9..cc1e51581c8f 100755 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c @@ -365,20 +365,16 @@ static const struct hc_driver tegra_ehci_hc_driver = { .relinquish_port = ehci_relinquish_port, .port_handed_over = ehci_port_handed_over, }; - static int tegra_ehci_probe(struct platform_device *pdev) { - int instance = pdev->id; - NvRmPhysAddr addr; - NvU32 size; - struct tegra_hcd_platform_data *pdata; - struct usb_hcd *hcd; - int e = 0; - int irq; - unsigned int temp; - void *vaddr; - static u64 dummy_mask = DMA_32BIT_MASK; - + int instance = pdev->id; + struct resource *res; + struct tegra_hcd_platform_data *pdata; + struct usb_hcd *hcd; + int e = 0; + int irq; + unsigned int temp; + static u64 dummy_mask = DMA_32BIT_MASK; pdata = (struct tegra_hcd_platform_data *)pdev->dev.platform_data; if (!pdata) { dev_err(&pdev->dev, "Cannot run without platform data\n"); @@ -389,15 +385,11 @@ static int tegra_ehci_probe(struct platform_device *pdev) pdev->dev.dma_mask = &dummy_mask; hcd = usb_create_hcd(&tegra_ehci_hc_driver, &pdev->dev, - dev_name(&pdev->dev)); + dev_name(&pdev->dev)); if (!hcd) { e = -ENOMEM; goto fail; } - pdata->instance = instance; - - pdata->pUsbProperty = NvOdmQueryGetUsbProperty(NvOdmIoModule_Usb, - instance); if (pdata->pUsbProperty->IdPinDetectionType == NvOdmUsbIdPinType_Gpio && (instance == 0 || instance == 1)) { @@ -429,32 +421,29 @@ static int tegra_ehci_probe(struct platform_device *pdev) printk("%s: failed with error (0x%x)\n", __func__, e); goto fail; } - - NvRmModuleGetBaseAddress(s_hRmGlobal, - NVRM_MODULE_ID(NvRmModuleID_Usb2Otg, instance), &addr, &size); - if (addr == 0x0 || size == 0) { - e = -ENODEV; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + e = -ENXIO; goto fail; } - NvRmPhysicalMemMap(addr, size, NVOS_MEM_READ_WRITE, - NvOsMemAttribute_Uncached, (void **)&vaddr); - if (vaddr == NULL) { + hcd->rsrc_start = res->start; + hcd->rsrc_len = resource_size(res); + hcd->regs = ioremap(res->start, resource_size(res)); + if (!hcd->regs) { e = -ENOMEM; goto fail; } - hcd->rsrc_start = addr; - hcd->rsrc_len = size; - hcd->regs = vaddr; /* Set to Host mode by setting bit 0-1 of USB device mode register */ temp = readl(hcd->regs + TEGRA_USB_USBMODE_REG_OFFSET); writel((temp | TEGRA_USB_USBMODE_HOST), (hcd->regs + TEGRA_USB_USBMODE_REG_OFFSET)); - - irq = NvRmGetIrqForLogicalInterrupt(s_hRmGlobal, - NVRM_MODULE_ID(NvRmModuleID_Usb2Otg, instance), 0); - if (irq == 0xffff) + irq = platform_get_irq(pdev, 0); + if (!irq) { + e = -ENODEV; goto fail; + } + set_irq_flags(irq, IRQF_VALID); e = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED); |