static void s5pv210_stop_ohc(void) { #if defined(CONFIG_SAMSUNG_PHONE_SVNET) || defined(CONFIG_SAMSUNG_LTE) || defined(CONFIG_UMTS_LINK_HSIC) /* only ehci controls phy on/off */ #else usb_host_phy_off(); #endif }
static void s5pv210_stop_ehc(void) { usb_host_phy_off(); #ifdef CONFIG_SAMSUNG_PHONE_SVNET mc_control_active_state(0); #endif }
static int ohci_hcd_s5pv210_runtime_suspend(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct usb_hcd *hcd = platform_get_drvdata(pdev); struct ohci_hcd *ohci = hcd_to_ohci(hcd); unsigned long flags; int rc = 0; /* Root hub was already suspended. Disable irq emission and * mark HW unaccessible, bail out if RH has been resumed. Use * the spinlock to properly synchronize with possible pending * RH suspend or resume activity. * * This is still racy as hcd->state is manipulated outside of * any locks =P But that will be a different fix. */ spin_lock_irqsave(&ohci->lock, flags); if (hcd->state != HC_STATE_SUSPENDED) { rc = -EINVAL; goto bail; } ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); (void)ohci_readl(ohci, &ohci->regs->intrdisable); clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); #if defined(CONFIG_SAMSUNG_PHONE_SVNET) || defined(CONFIG_SAMSUNG_LTE) || defined(CONFIG_UMTS_LINK_HSIC) #else printk(KERN_DEBUG "USB_PM ohci rt susp\n"); usb_host_phy_off(); #endif bail: spin_unlock_irqrestore(&ohci->lock, flags); return rc; }
static int ehci_hcd_s5pv210_drv_probe(struct platform_device *pdev) { struct usb_hcd *hcd = NULL; struct ehci_hcd *ehci = NULL; int retval = 0; if (usb_disabled()) return -ENODEV; usb_host_phy_off(); if (pdev->resource[1].flags != IORESOURCE_IRQ) { dev_err(&pdev->dev, "resource[1] is not IORESOURCE_IRQ.\n"); return -ENODEV; } hcd = usb_create_hcd(&ehci_s5pv210_hc_driver, &pdev->dev, "s5pv210"); if (!hcd) { dev_err(&pdev->dev, "usb_create_hcd failed!\n"); return -ENODEV; } hcd->rsrc_start = pdev->resource[0].start; hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1; if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { dev_err(&pdev->dev, "request_mem_region failed!\n"); retval = -EBUSY; goto err1; } usb_clk = clk_get(&pdev->dev, "usbhost"); if (IS_ERR(usb_clk)) { dev_err(&pdev->dev, "cannot get usb-host clock\n"); retval = -ENODEV; goto err2; } s5pv210_start_ehc(); hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); if (!hcd->regs) { dev_err(&pdev->dev, "ioremap failed!\n"); retval = -ENOMEM; goto err2; } ehci = hcd_to_ehci(hcd); ehci->caps = hcd->regs; ehci->regs = hcd->regs + HC_LENGTH(readl(&ehci->caps->hc_capbase)); /* cache this readonly data; minimize chip reads */ ehci->hcs_params = readl(&ehci->caps->hcs_params); writel(0x00600040, hcd->regs + 0x94); retval = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_DISABLED | IRQF_SHARED); if (retval == 0) { platform_set_drvdata(pdev, hcd); return retval; } s5pv210_stop_ehc(); iounmap(hcd->regs); err2: release_mem_region(hcd->rsrc_start, hcd->rsrc_len); err1: clk_put(usb_clk); usb_put_hcd(hcd); return retval; }
static void s5pv210_stop_ehc(void) { usb_host_phy_off(); clk_disable(usb_clk); }