예제 #1
0
static int tegra_ehci_bus_suspend(struct usb_hcd *hcd)
{
	struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller);
	int err = 0;
	EHCI_DBG("%s() BEGIN\n", __func__);

#ifdef CONFIG_TEGRA_EHCI_BOOST_CPU_FREQ
	tegra->boost_requested = false;
	if (tegra->boost_enable
	    && pm_qos_request_active(&tegra->boost_cpu_freq_req))
		pm_qos_update_request(&tegra->boost_cpu_freq_req,
			PM_QOS_DEFAULT_VALUE);
	tegra->cpu_boost_in_work = false;
#endif

	mutex_lock(&tegra->sync_lock);
	tegra->bus_suspended_fail = false;
	err = ehci_bus_suspend(hcd);
	if (err)
		tegra->bus_suspended_fail = true;
	else
		usb_phy_set_suspend(get_usb_phy(tegra->phy), 1);
	mutex_unlock(&tegra->sync_lock);
	EHCI_DBG("%s() END\n", __func__);

	return err;
}
static int ehci_omap_bus_suspend(struct usb_hcd *hcd)
{
	struct device *dev = hcd->self.controller;
	struct ehci_hcd_omap_platform_data  *pdata;
	struct omap_hwmod	*oh;
	struct clk *clk;
	int ret = 0;
	int i;

	dev_dbg(dev, "ehci_omap_bus_suspend\n");

	ret = ehci_bus_suspend(hcd);

	if (ret != 0) {
		dev_dbg(dev, "ehci_omap_bus_suspend failed %d\n", ret);
		return ret;
	}

	oh = omap_hwmod_lookup(USBHS_EHCI_HWMODNAME);

	omap_hwmod_enable_ioring_wakeup(oh);

	if (dev->parent)
		pm_runtime_put_sync(dev->parent);

	/* At the end, disable any external transceiver clocks */
	pdata = dev->platform_data;
	for (i = 0 ; i < OMAP3_HS_USB_PORTS ; i++) {
		clk = pdata->transceiver_clk[i];
		if (clk)
			clk_disable(clk);
	}

	return ret;
}
예제 #3
0
static int omap_ehci_bus_suspend(struct usb_hcd *hcd)
{
	struct ehci_hcd_omap *omap;
	unsigned long flags;
	int ret = 0;
	u32 reg;

	omap = ((struct  ehci_hcd *)
		((char *)hcd_to_ehci(hcd)))->omap_p;
	spin_lock_irqsave(&sus_res_lock, flags);
	ret = ehci_bus_suspend(hcd);

	if(!omap->suspended){
		omap_writel(OHCI_HC_CTRL_SUSPEND, OHCI_HC_CONTROL);
		mdelay(8); /* MSTANDBY assertion is delayed by ~8ms */
		reg = ehci_omap_readl(omap->uhh_base, OMAP_UHH_SYSCONFIG);
		reg &= ~(3 << 12);
		reg &= ~(3 << 3);
		ehci_omap_writel(omap->uhh_base, OMAP_UHH_SYSCONFIG, reg);
		clk_disable(omap->usbhost_fck);
		clk_disable(omap->usbhost_fs_fck);
		reg = ehci_omap_readl(omap->tll_base, OMAP_TLL_SHARED_CONF);
		reg &=~(1);
		ehci_omap_writel(omap->tll_base, OMAP_TLL_SHARED_CONF, reg);
		omap->suspended = 1;
		clk_disable(omap->usbtll_fck);
	}

	spin_unlock_irqrestore(&sus_res_lock, flags);
	return 0;
}
예제 #4
0
static int ehci_fsl_bus_suspend(struct usb_hcd *hcd)
{
	int ret = 0;
	struct fsl_usb2_platform_data *pdata;

	pdata = hcd->self.controller->platform_data;
	printk(KERN_DEBUG "%s, %s\n", __func__, pdata->name);

	/* the host is already at low power mode */
	if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) {
		return 0;
	}

	ret = ehci_bus_suspend(hcd);
	if (ret != 0)
		return ret;

	if (pdata->platform_suspend)
		pdata->platform_suspend(pdata);

	usb_host_set_wakeup(hcd->self.controller, true);
	fsl_usb_lowpower_mode(pdata, true);
	fsl_usb_clk_gate(hcd->self.controller->platform_data, false);
	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);

	return ret;
}
예제 #5
0
static int ehci_omap_bus_suspend(struct usb_hcd *hcd)
{
	int ret;

	printk(KERN_DEBUG " omap_bus_suspend\n");	
	ret = ehci_bus_suspend(hcd);
	return ret;
}
예제 #6
0
int s5p_ehci_bus_suspend(struct usb_hcd *hcd)
{
	int ret;
	ret = ehci_bus_suspend(hcd);

	/* Decrease pm_count that was increased at s5p_ehci_resume func. */
	pm_runtime_put_noidle(hcd->self.controller);

	return ret;
}
예제 #7
0
static int ehci_brcm_suspend(struct usb_hcd *hcd)
{
	int ret;

	ret = ehci_bus_suspend(hcd);
	ehci_prepare_ports_for_controller_suspend(hcd_to_ehci(hcd), false);
	brcm_usb_suspend(hcd);

	return ret;
}
예제 #8
0
static int usb_ehci_bus_suspend(struct usb_hcd *hcd)
{
	int ret = 0;

	ret = ehci_bus_suspend(hcd);

	omap_ehci_bus_suspend(gb_omap->dev);

	return ret;
}
static int
stm_ehci_bus_suspend(struct usb_hcd *hcd)
{
	ehci_bus_suspend(hcd);
/*
 * force the root hub to be resetted on resume!
 * re-enumerates everything during a standby, mem and hibernation...
 */
	usb_root_hub_lost_power(hcd->self.root_hub);
	return 0;
}
예제 #10
0
static int ehci_msm_bus_suspend(struct usb_hcd *hcd)
{
	int ret;

	ret = ehci_bus_suspend(hcd);
	if (ret) {
		pr_err("ehci_bus suspend faield\n");
		return ret;
	}

	return usb_lpm_enter(hcd);
}
예제 #11
0
static int tegra_ehci_bus_suspend(struct usb_hcd *hcd)
{
	struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller);
	int error_status = 0;

	error_status = ehci_bus_suspend(hcd);
	if (!error_status && tegra->power_down_on_bus_suspend) {
		tegra_usb_suspend(hcd);
		tegra->bus_suspended = 1;
	}

	return error_status;
}
static int ehci_hsic_bus_suspend(struct usb_hcd *hcd)
{
	struct msm_hsic_hcd *mehci = hcd_to_hsic(hcd);

	if (!(readl_relaxed(USB_PORTSC) & PORT_PE)) {
		dbg_log_event(NULL, "RH suspend attempt failed", 0);
		dev_dbg(mehci->dev, "%s:port is not enabled skip suspend\n",
				__func__);
		return -EAGAIN;
	}

	dbg_log_event(NULL, "Suspend RH", 0);
	return ehci_bus_suspend(hcd);
}
예제 #13
0
static int ehci_omap_bus_suspend(struct usb_hcd *hcd)
{
	struct device *dev = hcd->self.controller;
	struct uhhtll_apis *uhhtllp = dev->platform_data;
	int ret = 0;

	ret = ehci_bus_suspend(hcd);

	if (ret != 0)
		dev_dbg(dev, "ehci_bus_suspend failed %d\n", ret);

	if (!ret && uhhtllp && uhhtllp->suspend)
		ret = uhhtllp->suspend(OMAP_EHCI);

	return ret;
}
static int tegra_ehci_bus_suspend(struct usb_hcd *hcd)
{
	struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller);
	int err = 0;
	EHCI_DBG("%s() BEGIN\n", __func__);
	mutex_lock(&tegra->sync_lock);
	tegra->bus_suspended_fail = false;
	err = ehci_bus_suspend(hcd);
	if (err)
		tegra->bus_suspended_fail = true;
	else
		usb_phy_set_suspend(get_usb_phy(tegra->phy), 1);
	mutex_unlock(&tegra->sync_lock);
	EHCI_DBG("%s() END\n", __func__);

	return err;
}
예제 #15
0
static int ehci_msm_bus_suspend(struct usb_hcd *hcd)
{
	int ret;
	struct msmusb_hcd *mhcd = hcd_to_mhcd(hcd);

	ret = ehci_bus_suspend(hcd);
	if (ret) {
		pr_err("ehci_bus suspend faield\n");
		return ret;
	}
	if (PHY_TYPE(mhcd->pdata->phy_info) == USB_PHY_INTEGRATED)
		ret = otg_set_suspend(mhcd->xceiv, 1);
	else
		ret = usb_lpm_enter(hcd);

	wake_unlock(&mhcd->wlock);
	return ret;
}
예제 #16
0
static int ehci_msm_bus_suspend(struct usb_hcd *hcd)
{
    int ret;
    struct msmusb_hcd *mhcd = hcd_to_mhcd(hcd);
    struct device *dev = hcd->self.controller;

    ret = ehci_bus_suspend(hcd);
    if (ret) {
        pr_err("ehci_bus suspend faield\n");
        return ret;
    }
    if (PHY_TYPE(mhcd->pdata->phy_info) == USB_PHY_INTEGRATED)
        ret = usb_phy_set_suspend(mhcd->xceiv, 1);
    else
        ret = usb_lpm_enter(hcd);

    pm_runtime_put_noidle(dev);
    pm_runtime_suspend(dev);
    wake_unlock(&mhcd->wlock);
    return ret;
}
예제 #17
0
static int tegra_ehci_bus_suspend(struct usb_hcd *hcd)
{
	struct ehci_hcd *ehci = hcd_to_ehci(hcd);
	struct tegra_hcd_platform_data *pdata;
	int error_status = 0;

	/* initialize the platform data pointer */
	pdata = hcd->self.controller->platform_data;

#ifdef CONFIG_USB_OTG_UTILS
	if (pdata->otg_mode && ehci->transceiver) {
		if (ehci->transceiver->state != OTG_STATE_A_HOST) {
			/* we are not in host mode, return */
			return 0;
		} else {
			ehci->transceiver->state = OTG_STATE_A_SUSPEND;
			ehci->host_reinited = 0;
		}
	}
#endif

	if (!pdata->otg_mode && pdata->id_detect==ID_PIN_CABLE_ID) {
		u32 status;
		/* check for ID pin status */
		status = readl(hcd->regs + TEGRA_USB_PHY_WAKEUP_REG_OFFSET);
		/* If Id pin is high means host is not connected return */
		if (status & TEGRA_USB_ID_PIN_STATUS) {
			return 0;
		}
	}

	if (ehci->host_resumed) {
		error_status = ehci_bus_suspend(hcd);
		//if (!error_status)
			//tegra_ehci_power_down(hcd);
	}

	return error_status;
}
예제 #18
0
static int ehci_omap_bus_suspend(struct usb_hcd *hcd)
{
	struct usb_bus *bus = hcd_to_bus(hcd);
	int ret;

#ifdef CONFIG_LOGIC_OMAP3530_USB3320_HACK
	struct ehci_hcd_omap *omap = platform_get_drvdata(to_platform_device(
						    hcd->self.controller));
	struct ehci_hcd *ehci = omap->ehci;
	int ports = HCS_N_PORTS (omap->ehci->hcs_params);
	int i;
	
	// Manually suspend the ports HERE.  We want to be able to switch to
	// GPIO lines before it shuts down the controller entirely;
	// Otherwise, it'll wake up the PHY again.
	for(i=0;i<ports;++i)
	{
	    u32 __iomem *status_reg = &omap->ehci->regs->port_status[i];
	    u32 temp = ehci_readl(omap->ehci, status_reg);
	    
	    if((temp & PORT_PE) == 0 || (temp & PORT_RESET) != 0)
		continue;

	    ehci_writel(omap->ehci, temp | PORT_SUSPEND, status_reg);
	    set_bit(i, &ehci->suspended_ports);
	}
	
	msleep(1);
	
	usb3320_hack_install();
#endif

	ret = ehci_bus_suspend(hcd);

	ehci_omap_dev_suspend(bus->controller);

	return ret;
}
예제 #19
0
파일: ehci-arc.c 프로젝트: pocketbook/801
static int ehci_fsl_bus_suspend(struct usb_hcd *hcd)
{
	int ret = 0;
	struct fsl_usb2_platform_data *pdata;
	u32 tmp, portsc;
	struct ehci_hcd *ehci = hcd_to_ehci(hcd);

	pdata = hcd->self.controller->platform_data;
	printk(KERN_DEBUG "%s, %s\n", __func__, pdata->name);

	/* the host is already at low power mode */
	if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) {
		return 0;
	}

	portsc = ehci_readl(ehci, &ehci->regs->port_status[0]);
	ret = ehci_bus_suspend(hcd);
	if (ret != 0)
		return ret;

	if (portsc & PORT_CCS) {
		printk(KERN_DEBUG "there is a device on the port\n");
		tmp = ehci_readl(ehci, &ehci->regs->command);
		tmp |= CMD_RUN;
		ehci_writel(ehci, tmp, &ehci->regs->command);
	}

	if (pdata->platform_suspend)
		pdata->platform_suspend(pdata);

	usb_host_set_wakeup(hcd->self.controller, true);
	fsl_usb_lowpower_mode(pdata, true);
	fsl_usb_clk_gate(hcd->self.controller->platform_data, false);
	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);

	return ret;
}
예제 #20
0
static int tegra_ehci_bus_suspend(struct usb_hcd *hcd)
{
	struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller);
	struct ehci_hcd *ehci = hcd_to_ehci(hcd);
	int err = 0;

	EHCI_DBG("%s() BEGIN\n", __func__);
	pr_info("%s::resetdone = %ld:tegra->port_resuming =%d\n", __func__, ehci->reset_done[0], tegra->port_resuming);
	mutex_lock(&tegra->sync_lock);
	tegra->bus_suspended_fail = false;
	err = ehci_bus_suspend(hcd);
	if (err) {
		if(tegra->port_resuming)
			pr_info("%s: bus_suspended aborted because of resume. err=(%d):resetdone = %ld:tegra->port_resuming =%d\n", __func__, err, ehci->reset_done[0], tegra->port_resuming);
		else
			pr_info("%s: bus_suspended_fail err=(%d):resetdone = %ld\n", __func__, err, ehci->reset_done[0]);
		tegra->bus_suspended_fail = true;
	}
	else
		tegra_usb_phy_suspend(tegra->phy);
	mutex_unlock(&tegra->sync_lock);
	EHCI_DBG("%s() END\n", __func__);
	return err;
}
예제 #21
0
static int omap_ehci_bus_suspend(struct usb_hcd *hcd)
{
	return ehci_bus_suspend(hcd);
}
예제 #22
0
static int ehci_omap_bus_suspend(struct usb_hcd *hcd)
{
	int ret;
	u32 status;
	u32 sysconfig;
	unsigned long flags;
	struct ehci_hcd *ehci;
	struct ehci_hcd_omap_platform_data *pdata;
	struct ehci_hcd_omap *omap = dev_get_drvdata(hcd->self.controller);

	dev_dbg(hcd->self.controller, "%s %ld %lu\n", __func__,
		in_interrupt(), jiffies);
	ehci = hcd_to_ehci(hcd);
	pdata = omap->dev->dev.platform_data;

	/* mask interrupt 77 to avoid race condition with ehci_irq */
	/* omap_writel(0x2000, 0x482000CC); */
	disable_irq(hcd->irq);

	ret = ehci_bus_suspend(hcd);
	if (ret) {
		enable_irq(hcd->irq);
		return ret;
	}

	/* Put UHH in SmartStandby mode */
	sysconfig = ehci_omap_readl(omap->uhh_base, OMAP_UHH_SYSCONFIG);
	sysconfig &= ~OMAP_UHH_SYSCONFIG_MIDLEMODE_MASK;
	sysconfig |= OMAP_UHH_SYSCONFIG_MIDLEMODE;
	ehci_omap_writel(omap->uhh_base, OMAP_UHH_SYSCONFIG, sysconfig);

	spin_lock_irqsave(&usb_clocks_lock, flags);
	if (test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) {
		if (pdata->usbhost_standby_status)
			ret = pdata->usbhost_standby_status();
		if (ret == 0) {
			printk(KERN_ERR "ehci: suspend failed!\n");
			ret = -EBUSY;
			goto end;
		} else
			ret = 0;
		status = ehci_readl(ehci, &ehci->regs->status);
		if (status & INTR_MASK) {
			printk(KERN_ERR "ehci: pending irq, resume!\n");
			ret = -EBUSY;
			goto end;
		}
		ehci_omap_writel(omap->tll_base, OMAP_TLL_SHARED_CONF,
			ehci_omap_readl(omap->tll_base, OMAP_TLL_SHARED_CONF) &
			~(1));
		/* Enable the interrupt so that the remote-wakeup
		 * can be detected */
		ehci_omap_writel(omap->tll_base, OMAP_USBTLL_IRQSTATUS, 7);
		ehci_omap_writel(omap->tll_base, OMAP_USBTLL_IRQENABLE, 1);

		/* Put UHH in ForceIdle mode */
		sysconfig = ehci_omap_readl(omap->uhh_base, OMAP_UHH_SYSCONFIG);
		sysconfig &= ~OMAP_UHH_SYSCONFIG_SIDLEMODE_MASK;
		ehci_omap_writel(omap->uhh_base, OMAP_UHH_SYSCONFIG, sysconfig);

		if (omap->usbhost1_48m_fck)
			clk_disable(omap->usbhost1_48m_fck);
		if (omap->usbhost2_120m_fck)
			clk_disable(omap->usbhost2_120m_fck);
		if (omap->usbtll_fck)
			clk_disable(omap->usbtll_fck);
		clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
		LOG_USBHOST_ACTIVITY(aUsbHostDbg, iUsbHostDbg, jiffies);
	}
	spin_unlock_irqrestore(&usb_clocks_lock, flags);
#ifdef CONFIG_HAS_WAKELOCK
	wake_unlock(&ehci->wake_lock_ehci_pm);
#endif
	return 0;

end:
	/* Put UHH in NoStandby mode */
	sysconfig = ehci_omap_readl(omap->uhh_base, OMAP_UHH_SYSCONFIG);
	sysconfig &= ~OMAP_UHH_SYSCONFIG_MIDLEMODE_MASK;
	sysconfig |= OMAP_UHH_SYSCONFIG_NOSTBYMODE;
	ehci_omap_writel(omap->uhh_base, OMAP_UHH_SYSCONFIG, sysconfig);

	spin_unlock_irqrestore(&usb_clocks_lock, flags);
	ehci_bus_resume(hcd);
	/* unmask irq 77 */
	/* omap_writel(0x2000, 0x482000C8); */
	enable_irq(hcd->irq);
	return ret;
}
예제 #23
0
static int ehci_hsic_bus_suspend(struct usb_hcd *hcd)
{
	dbg_log_event(NULL, "Suspend RH", 0);
	return ehci_bus_suspend(hcd);
}
예제 #24
0
/* Electrical test support */
static void host_write_port(u8 port, const char *buf)
{
	struct usb_bus *bus;
	struct ehci_hcd *ehci = hcd_to_ehci(ghcd);
	u32 port_status;
	u32 cmd;

	/* Reset Device */
	if (!strncmp(buf, "reset", 5)) {
		printk(KERN_INFO "\n RESET PORT \n");
		bus = hcd_to_bus(ghcd);
		if (bus->root_hub->children[port])
			usb_reset_device(bus->root_hub->children[port]);
	}

	if (!strncmp(buf, "t-j", 3)) {
		printk(KERN_INFO "\n TEST_J \n");

#ifdef CONFIG_PM
		/* Suspend bus first */
		ehci_bus_suspend(ghcd);
#endif
		port_status = ehci_readl(ehci, &ehci->regs->port_status[port]);
		cmd = ehci_readl(ehci, &ehci->regs->command);

		port_status |= 1<<16; /* Test_Packet on Port2 */
		ehci_writel(ehci, port_status, &ehci->regs->port_status[port]);

		cmd |= CMD_RUN;
		ehci_writel(ehci, cmd, &ehci->regs->command);
	}

	if (!strncmp(buf, "t-k", 3)) {
		printk(KERN_INFO "\n TEST_K \n");

#ifdef CONFIG_PM
		/* Suspend bus first */
		ehci_bus_suspend(ghcd);
#endif
		port_status = ehci_readl(ehci, &ehci->regs->port_status[port]);
		cmd = ehci_readl(ehci, &ehci->regs->command);

		port_status |= 2<<16; /* Test_Packet on Port2 */
		ehci_writel(ehci, port_status, &ehci->regs->port_status[port]);

		cmd |= CMD_RUN;
		ehci_writel(ehci, cmd, &ehci->regs->command);
	}

	if (!strncmp(buf, "t-se0", 5)) {
		printk(KERN_INFO "\n TEST_SE0_NAK \n");

#ifdef CONFIG_PM
		/* Suspend bus first */
		ehci_bus_suspend(ghcd);
#endif
		port_status = ehci_readl(ehci, &ehci->regs->port_status[port]);
		cmd = ehci_readl(ehci, &ehci->regs->command);

		port_status |= 3<<16; /* Test_Packet on Port2 */
		ehci_writel(ehci, port_status, &ehci->regs->port_status[port]);

		cmd |= CMD_RUN;
		ehci_writel(ehci, cmd, &ehci->regs->command);
	}

	/* Send test packet on suspended port */
	if (!strncmp(buf, "t-pkt", 5)) {
		printk(KERN_INFO "\n TEST_PACKET \n");

#ifdef CONFIG_PM
		/* Suspend bus first */
		ehci_bus_suspend(ghcd);
#endif
		port_status = ehci_readl(ehci, &ehci->regs->port_status[port]);
		cmd = ehci_readl(ehci, &ehci->regs->command);

		/* Set Test packet bit */
		port_status |= 4<<16; /* Test_Packet on Port2 */
		ehci_writel(ehci, port_status, &ehci->regs->port_status[port]);

		cmd |= CMD_RUN;
		ehci_writel(ehci, cmd, &ehci->regs->command);
	}

	if (!strncmp(buf, "t-force", 7)) {
		printk(KERN_INFO "\n TEST_FORCE \n");

#ifdef CONFIG_PM
		/* Suspend bus first */
		ehci_bus_suspend(ghcd);
#endif
		port_status = ehci_readl(ehci, &ehci->regs->port_status[port]);
		cmd = ehci_readl(ehci, &ehci->regs->command);

		port_status |= 5<<16; /* Test_Packet on Port2 */
		ehci_writel(ehci, port_status, &ehci->regs->port_status[port]);

		cmd |= CMD_RUN;
		ehci_writel(ehci, cmd, &ehci->regs->command);
	}

}