Beispiel #1
0
static int omap_ohci_bus_suspend(struct usb_hcd *hcd)
{
	struct ohci_omap_clock_defs *ohci_clocks;
	int ret = 0;

	ohci_clocks = (struct ohci_omap_clock_defs *)
			(((char *)hcd_to_ohci(hcd)) + sizeof(struct ohci_hcd));

	if (!ohci_clocks->suspended) {
		ret = ohci_bus_suspend(hcd);
		if (ret)
			return ret;
		mdelay(8); /* MSTANDBY assertion delayed by ~8ms */
		ohci_context_save();
		clk_disable(ohci_clocks->usbhost_ick_clk);
		clk_disable(ohci_clocks->usbhost1_48m_fck_clk);
		clk_disable(ohci_clocks->usbhost2_120m_fck_clk);
		clk_disable(ohci_clocks->usbtll_ick_clk);
		clk_disable(ohci_clocks->usbtll_fck_clk);
		ohci_clocks->suspended = 1;
		clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
	}

	return ret;
}
static int omap_ohci_bus_suspend(struct usb_hcd *hcd)
{
	struct ohci_omap_clock_defs *ohci_clocks;
	int ret = 0;
	u32 uhh_sysconfig;

	ohci_clocks = (struct ohci_omap_clock_defs *)
			(((char *)hcd_to_ohci(hcd)) + sizeof(struct ohci_hcd));

	if (!ohci_clocks->suspended) {
		ret = ohci_bus_suspend(hcd);
		if (ret)
			return ret;
		mdelay(8); /* MSTANDBY assertion delayed by ~8ms */

		/* Need to set ForceStandby,ForceIdle here
		 * else the domain may not be able to transition
		 * back during clk_enable if there was a pending event.
		 */

		uhh_sysconfig = omap_readl(OMAP_UHH_SYSCONFIG);
		uhh_sysconfig &= ~(3 << OMAP_UHH_SYSCONFIG_MIDLEMODE_SHIFT);
		uhh_sysconfig &= ~(3 << OMAP_UHH_SYSCONFIG_SIDLEMODE_SHIFT);
		omap_writel(uhh_sysconfig, OMAP_UHH_SYSCONFIG);

		ohci_context_save();
		clk_disable(ohci_clocks->usbhost_ick_clk);
		clk_disable(ohci_clocks->usbhost2_120m_fck_clk);
		clk_disable(ohci_clocks->usbhost1_48m_fck_clk);
		clk_disable(ohci_clocks->usbtll_ick_clk);
		clk_disable(ohci_clocks->usbtll_fck_clk);
		ohci_clocks->suspended = 1;
		clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
	}

	return ret;
}