static int tegra_ehci_remove(struct platform_device *pdev)
{
	struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev);
	struct usb_hcd *hcd = NULL;

	if (tegra == NULL)
		return -EINVAL;

	hcd = ehci_to_hcd(tegra->ehci);

	if (hcd == NULL)
		return -EINVAL;

#ifdef CONFIG_USB_OTG_UTILS
	if (tegra->transceiver) {
		otg_set_host(tegra->transceiver->otg, NULL);
		usb_put_transceiver(tegra->transceiver);
	}
#endif

	if (tegra->irq)
		disable_irq_wake(tegra->irq);

	/* Make sure phy is powered ON to access USB register */
	if(!tegra_usb_phy_hw_accessible(tegra->phy))
		tegra_usb_phy_power_on(tegra->phy);

	usb_remove_hcd(hcd);
	tegra_usb_phy_power_off(tegra->phy);
	usb_phy_shutdown(get_usb_phy(tegra->phy));
	iounmap(hcd->regs);
	usb_put_hcd(hcd);

	return 0;
}
void fsl_udc_clk_suspend(bool is_dpd)
{
	tegra_usb_phy_power_off(phy, is_dpd);
	clk_disable(udc_clk);
	clk_disable(sclk_clk);
	clk_disable(emc_clk);
}
void fsl_udc_clk_suspend(void)
{
	tegra_usb_phy_power_off(phy);
	clk_disable(udc_clk);
	clk_disable(sclk_clk);
	clk_disable(emc_clk);
}
Esempio n. 4
0
static int tegra_ehci_suspend(struct platform_device *pdev, pm_message_t state)
{
	struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev);
	struct tegra_usb_platform_data *pdata = dev_get_platdata(&pdev->dev);
	int err;

	/* bus suspend could have failed because of remote wakeup resume */
	if (tegra->bus_suspended_fail)
		return -EBUSY;
	else {
		err = tegra_usb_phy_power_off(tegra->phy);
		if (err < 0)
			return err;
		if (pdata->u_data.host.turn_off_vbus_on_lp0) {
			tegra_usb_enable_vbus(tegra->phy, false);
			tegra_usb_phy_pmc_disable(tegra->phy);
		}
		if (tegra->irq) {
			err = enable_irq_wake(tegra->irq);
			if (err < 0)
				dev_err(&pdev->dev,
					"Couldn't enable USB host mode wakeup, irq=%d, "
					"error=%d\n", tegra->irq, err);
		}
		return err;
	}
}
Esempio n. 5
0
static int tegra_ehci_remove(struct platform_device *pdev)
{
	struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev);
	struct usb_hcd *hcd = NULL;
	struct usb_device *rhdev = NULL;
	struct tegra_usb_platform_data *pdata;
	unsigned long timeout = 0;

	if (tegra == NULL)
		return -EINVAL;

	hcd = ehci_to_hcd(tegra->ehci);

	if (hcd == NULL)
		return -EINVAL;

#ifdef CONFIG_TEGRA_EHCI_BOOST_CPU_FREQ
	cancel_delayed_work(&tegra->boost_cpu_freq_work);
	pm_qos_update_request(&tegra->boost_cpu_freq_req,
				PM_QOS_DEFAULT_VALUE);
	tegra->cpu_boost_in_work = false;
#endif
	rhdev = hcd->self.root_hub;
	pdata = dev_get_platdata(&pdev->dev);

#ifdef CONFIG_USB_OTG_UTILS
	if (tegra->transceiver) {
		otg_set_host(tegra->transceiver->otg, NULL);
		usb_put_transceiver(tegra->transceiver);
	}
#endif

	if (tegra->irq)
		disable_irq_wake(tegra->irq);

	/* Make sure phy is powered ON to access USB register */
	if(!tegra_usb_phy_hw_accessible(tegra->phy))
		tegra_usb_phy_power_on(tegra->phy);

	if (pdata->port_otg) {

		timeout = jiffies + 5 * HZ;

		/* wait for devices connected to root hub to disconnect*/
		while (time_before(jiffies, timeout) &&
			rhdev && rhdev->children[0])
			;

		/* wait for any control packets sent to root hub to complete */
		mdelay(1000);
	}

	usb_remove_hcd(hcd);
	tegra_usb_phy_power_off(tegra->phy);
	usb_phy_shutdown(get_usb_phy(tegra->phy));
	iounmap(hcd->regs);
	usb_put_hcd(hcd);

	return 0;
}
Esempio n. 6
0
static void tegra_ehci_power_down(struct usb_hcd *hcd, bool is_dpd)
{
	struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller);

	tegra->host_resumed = 0;
	tegra_usb_phy_power_off(tegra->phy, is_dpd);
	clk_disable(tegra->emc_clk);
	clk_disable(tegra->sclk_clk);
}
Esempio n. 7
0
static int tegra_ehci_remove(struct platform_device *pdev)
{
	struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev);
	struct usb_hcd *hcd = ehci_to_hcd(tegra->ehci);

	dev_info(&pdev->dev, "%s+\n", __func__);		//htc_dbg

	if (tegra == NULL || hcd == NULL)
		return -EINVAL;

#ifdef CONFIG_USB_OTG_UTILS
	if (tegra->transceiver) {
		otg_set_host(tegra->transceiver, NULL);
		otg_put_transceiver(tegra->transceiver);
	}
#endif

	if (tegra->irq)
		disable_irq_wake(tegra->irq);

	/* Make sure phy is powered ON to access USB register */
	if(!tegra_usb_phy_hw_accessible(tegra->phy))
		tegra_usb_phy_power_on(tegra->phy);

	pr_info("+%s:usb_remove_hcd\n", __func__);
	uhsic_phy_remove(tegra->phy);
	usb_remove_hcd(hcd);
	usb_put_hcd(hcd);
	ehci_remove = 1;
	tegra_usb_phy_power_off(tegra->phy);
	tegra_usb_phy_close(tegra->phy);
	iounmap(hcd->regs);
	platform_set_drvdata(pdev, NULL);

	//htc++
	#ifdef CONFIG_QCT_9K_MODEM
	if (Modem_is_QCT_MDM9K())
	{
		extern struct platform_device tegra_ehci2_device;

		if (&tegra_ehci2_device == pdev)
		{
			mdm_hsic_ehci_hcd = NULL;
			mdm_hsic_usb_hcd = NULL;
			mdm_hsic_phy = NULL;
			pr_info("%s:: mdm_hsic_ehci_hcd = %x, mdm_hsic_usb_hcd = %x, mdm_hsic_phy = %x\n",
				__func__, (unsigned int)mdm_hsic_ehci_hcd, (unsigned int)mdm_hsic_usb_hcd, (unsigned int)mdm_hsic_phy);
		}
	}
	#endif	//CONFIG_QCT_9K_MODEM
	//htc--

	dev_info(&pdev->dev, "%s-\n", __func__);		//htc_dbg

	return 0;
}
Esempio n. 8
0
static void tegra_ehci_power_down(struct usb_hcd *hcd)
{
	struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller);

	tegra->host_resumed = 0;
	tegra_usb_phy_power_off(tegra->phy);
	if (!tegra->keep_clock_in_bus_suspend)
		clk_disable(tegra->clk);
	clk_disable(tegra->emc_clk);
}
Esempio n. 9
0
static void tegra_ehci_power_down(struct usb_hcd *hcd, bool is_dpd)
{
	struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller);

	tegra->host_resumed = 0;
	tegra_usb_phy_power_off(tegra->phy, is_dpd);
#ifndef CONFIG_USB_HOTPLUG
	clk_disable(tegra->clk);
#endif
}
Esempio n. 10
0
static void tegra_ehci_power_down(struct usb_hcd *hcd, bool is_dpd)
{
	struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller);

	tegra->host_resumed = 0;
	if(tegra->power_down_on_bus_suspend) {
		tegra_usb_phy_power_off(tegra->phy, is_dpd);
		clk_disable(tegra->clk);
		clk_disable(tegra->emc_clk);
		clk_disable(tegra->sclk_clk);
	} else if(!tegra->bus_suspended) {
		clk_set_rate(tegra->clk, 400000000);
		clk_disable(tegra->emc_clk);
		clk_disable(tegra->sclk_clk);
	} else {
		tegra_usb_phy_power_off(tegra->phy, is_dpd);
		clk_set_rate(tegra->clk, 480000000);
		clk_disable(tegra->clk);
	}
}
Esempio n. 11
0
static int tegra_ehci_remove(struct platform_device *pdev)
{
	struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev);
	struct usb_hcd *hcd = ehci_to_hcd(tegra->ehci);
	struct usb_device *rhdev = NULL;
	struct tegra_usb_platform_data *pdata;
	unsigned long timeout = 0;

	wake_lock_destroy(&tegra->ehci_wake_lock);

#ifdef CONFIG_TEGRA_EHCI_BOOST_CPU_FREQ
	cancel_delayed_work_sync(&tegra->boost_cpu_freq_work);
	tegra->cpu_boost_in_work = false;
	pm_qos_remove_request(&tegra->boost_cpu_freq_req);
#endif
	rhdev = hcd->self.root_hub;
	pdata = dev_get_platdata(&pdev->dev);

	if (!IS_ERR_OR_NULL(tegra->transceiver))
		otg_set_host(tegra->transceiver->otg, NULL);

	/* Make sure phy is powered ON to access USB register */
	if(!tegra_usb_phy_hw_accessible(tegra->phy))
		tegra_usb_phy_power_on(tegra->phy);

	if (pdata->port_otg) {
		timeout = jiffies + 5 * HZ;
		/* wait for devices connected to root hub to disconnect*/
		while (rhdev && usb_hub_find_child(rhdev, 1)) {
			/* wait for any control packets
			sent to root hub to complete */
			if (time_after(jiffies, timeout))
				break;
			msleep(20);
			cpu_relax();
		}
	}

#ifdef CONFIG_TEGRA_EHCI_BOOST_CPU_FREQ
	device_remove_file(hcd->self.controller, &dev_attr_boost_enable);
#endif
	usb_remove_hcd(hcd);
	usb_put_hcd(hcd);
	tegra_usb_phy_power_off(tegra->phy);
	usb_phy_shutdown(get_usb_phy(tegra->phy));

	mutex_destroy(&tegra->sync_lock);
	tegra_pd_remove_device(&pdev->dev);

	return 0;
}
static int tegra_ehci_suspend(struct platform_device *pdev, pm_message_t state)
{
	struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev);
	int err;
	struct tegra_usb_platform_data *pdata = dev_get_platdata(&pdev->dev);
	/* bus suspend could have failed because of remote wakeup resume */
	if (tegra->bus_suspended_fail)
		return -EBUSY;
	else {
		err = tegra_usb_phy_power_off(tegra->phy);
		if (pdata->u_data.host.turn_off_vbus_on_lp0 && pdata->port_otg)
			tegra_usb_enable_vbus(tegra->phy, false);
		return err;
	}
}
Esempio n. 13
0
static void tegra_ehci_power_down(struct usb_hcd *hcd, bool is_dpd)
{
	struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller);

	pr_info(MODULE_NAME "%s\n", __func__); /* HTC */

	tegra->host_resumed = 0;
	tegra_usb_phy_power_off(tegra->phy, is_dpd);

	pr_info(MODULE_NAME "%s complete\n", __func__); /* HTC */

	if (!tegra->default_enable)
		clk_disable(tegra->clk);

}
Esempio n. 14
0
static int tegra_ehci_suspend(struct platform_device *pdev, pm_message_t state)
{
	struct tegra_ehci_hcd *tegra = platform_get_drvdata(pdev);

	dev_info(&pdev->dev, "%s\n", __func__);		//htc_dbg

	pr_info("%s:: bus_suspended_fail = %d\n", __func__, tegra->bus_suspended_fail);
	pr_info("%s::ehci_remove = %d\n", __func__, ehci_remove);

	/* bus suspend could have failed because of remote wakeup resume */
	if (tegra->bus_suspended_fail)
		return -EBUSY;
	else
		return tegra_usb_phy_power_off(tegra->phy);
}
Esempio n. 15
0
static void tegra_ehci_power_down(struct usb_hcd *hcd, bool is_dpd)
{
	struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd->self.controller);

	tegra->host_resumed = 0;
        tegra_usb_phy_power_off(tegra->phy, is_dpd);

	if(ASUSGetProjectID()==101){
		if(tegra->phy->instance == 2 && usb3_emc_sclk_enable == 1){
			clk_disable(tegra->emc_clk);
			clk_disable(tegra->sclk_clk);
			usb3_emc_sclk_enable = 0;
		}else if(tegra->phy->instance != 2){
			clk_disable(tegra->emc_clk);
			clk_disable(tegra->sclk_clk);
		}
	}else{
		clk_disable(tegra->emc_clk);
		clk_disable(tegra->sclk_clk);
	}

}