Пример #1
0
int s5p_usb_phy_resume(struct platform_device *pdev, int type)
{
	int ret = 0;

	if (exynos_usb_phy_clock_enable(pdev))
		return 0;

	mutex_lock(&phy_lock);
	if (usb_phy_control.flags)
		goto done;

	if (type == S5P_USB_PHY_HOST) {
		if (soc_is_exynos4210() ||
			soc_is_exynos4212() ||
			soc_is_exynos4412())
			ret = exynos4_usb_phy1_resume(pdev);
		else
			ret = exynos5_usb_phy_host_resume(pdev);
	}
done:
	if (!strcmp(pdev->name, "s5p-ehci"))
		set_bit(HOST_PHY_EHCI, &usb_phy_control.flags);
	else if (!strcmp(pdev->name, "s5p-ohci"))
		set_bit(HOST_PHY_OHCI, &usb_phy_control.flags);

	mutex_unlock(&phy_lock);
	exynos_usb_phy_clock_disable(pdev);

	return ret;
}
Пример #2
0
int s5p_usb_phy_exit(struct platform_device *pdev, int type)
{
	int ret = -EINVAL;

	if (exynos_usb_phy_clock_enable(pdev))
		return ret;

	mutex_lock(&phy_lock);
	if (type == S5P_USB_PHY_HOST) {
		if (soc_is_exynos4210())
			ret = exynos4_usb_phy1_exit(pdev);
		else if (soc_is_exynos4212() || soc_is_exynos4412())
			ret = exynos4_usb_phy20_exit(pdev);
		else
			ret = exynos5_usb_phy20_exit(pdev);

		if (!strcmp(pdev->name, "s5p-ehci"))
			clear_bit(HOST_PHY_EHCI, &usb_phy_control.flags);
		else if (!strcmp(pdev->name, "s5p-ohci"))
			clear_bit(HOST_PHY_OHCI, &usb_phy_control.flags);
	} else if (type == S5P_USB_PHY_DEVICE) {
		if (soc_is_exynos4210())
			ret = exynos4_usb_phy0_exit(pdev);
		else
			ret = exynos_usb_dev_phy20_exit(pdev);
	} else if (type == S5P_USB_PHY_DRD)
		ret = exynos5_usb_phy30_exit(pdev);

	mutex_unlock(&phy_lock);
	exynos_usb_phy_clock_disable(pdev);

	return ret;
}
Пример #3
0
int s5p_usb_phy_exit(struct platform_device *pdev, int type)
{
	int ret = -EINVAL;

	if (exynos_usb_phy_clock_enable(pdev))
		return ret;

	mutex_lock(&phy_lock);

	if (type == S5P_USB_PHY_HOST) {
		if (soc_is_exynos4210())
			ret = exynos4_usb_phy1_exit(pdev);
		else if (soc_is_exynos4212() || soc_is_exynos4412())
			ret = exynos4_usb_phy20_exit(pdev);
	} else if (type == S5P_USB_PHY_DEVICE) {
		if (soc_is_exynos4210())
			ret = exynos4_usb_phy0_exit(pdev);
		else
			ret = exynos_usb_dev_phy20_exit(pdev);
	}

	mutex_unlock(&phy_lock);
	exynos_usb_phy_clock_disable(pdev);

	return ret;
}
int s5p_usb_phy_init(struct platform_device *pdev, int type)
{
    int ret = -EINVAL;

    if (exynos_usb_phy_clock_enable(pdev))
        return ret;

    mutex_lock(&phy_lock);

    if (type == S5P_USB_PHY_HOST) {
        if (!strcmp(pdev->name, "s5p-ehci"))
            set_bit(HOST_PHY_EHCI, &usb_phy_control.flags);
        else if (!strcmp(pdev->name, "s5p-ohci"))
            set_bit(HOST_PHY_OHCI, &usb_phy_control.flags);

#if defined(CONFIG_LINK_DEVICE_HSIC) || defined(CONFIG_LINK_DEVICE_USB) \
		|| defined(CONFIG_MDM_HSIC_PM)
        /* HSIC LPA: Let CP know the slave wakeup from LPA wakeup */
        if (!strcmp(pdev->name, "s5p-ehci"))
            set_hsic_lpa_states(STATE_HSIC_LPA_PHY_INIT);
#endif
        if (soc_is_exynos4210())
            ret = exynos4_usb_phy1_init(pdev);
        else if (soc_is_exynos4212() || soc_is_exynos4412()) {
            ret = exynos4_usb_phy20_init(pdev);
            set_exynos_usb_phy_tune(type);
        } else
            ret = exynos5_usb_phy20_init(pdev);
    } else if (type == S5P_USB_PHY_DEVICE) {
        if (soc_is_exynos4210())
            ret = exynos4_usb_phy0_init(pdev);
        else {
            ret = exynos_usb_dev_phy20_init(pdev);
            set_exynos_usb_phy_tune(type);
        }
        /* set custom usb phy tune */
        if (pdev->dev.platform_data)
            ret = s5p_usb_phy0_tune(pdev->dev.platform_data, 0);
    } else if (type == S5P_USB_PHY_OTGHOST) {
        if (soc_is_exynos4210())
            ret = exynos4_usb_phy0_init(pdev);
        else
            ret = exynos_usb_dev_phy20_init(pdev);
    } else if (type == S5P_USB_PHY_DRD)
        ret = exynos5_usb_phy30_init(pdev);

    mutex_unlock(&phy_lock);
    exynos_usb_phy_clock_disable(pdev);

    return ret;
}
int s5p_usb_phy_suspend(struct platform_device *pdev, int type)
{
	int ret = 0;
#ifdef CONFIG_USB_OHCI_S5P
	struct s5p_ohci_hcd *s5p_ohci = platform_get_drvdata(&s5p_device_ohci);
	struct usb_hcd *ohci_hcd = s5p_ohci->hcd;
	u32 phyclk;
#endif

	if (exynos_usb_phy_clock_enable(pdev))
		return 0;

	mutex_lock(&phy_lock);

	if (!strcmp(pdev->name, "s5p-ehci"))
		clear_bit(HOST_PHY_EHCI, &usb_phy_control.flags);
	else if (!strcmp(pdev->name, "s5p-ohci"))
		clear_bit(HOST_PHY_OHCI, &usb_phy_control.flags);

	if (usb_phy_control.flags)
		goto done;

	if (type == S5P_USB_PHY_HOST) {
		if (soc_is_exynos4210() ||
			soc_is_exynos4212() ||
			soc_is_exynos4412()) {
#ifdef CONFIG_USB_OHCI_S5P
			/* Set OHCI clock off when ohci_hcd is suspended */
			if (ohci_hcd->state == HC_STATE_SUSPENDED) {
				phyclk = readl(EXYNOS4_PHYCLK);
				phyclk &= ~(PHY1_COMMON_ON_N);
				writel(phyclk, EXYNOS4_PHYCLK);
			}
			dev_info(&pdev->dev, "host_phy_susp:%d\n",
					ohci_hcd->state);
#endif
			ret = exynos4_usb_phy1_suspend(pdev);
		} else
			ret = exynos5_usb_phy_host_suspend(pdev);
	}
done:
	mutex_unlock(&phy_lock);
	exynos_usb_phy_clock_disable(pdev);

	return ret;
}
int s5p_usb_phy_resume(struct platform_device *pdev, int type)
{
    int ret = 0;
#ifdef CONFIG_USB_OHCI_S5P
    u32 phyclk;
#endif
    if (exynos_usb_phy_clock_enable(pdev))
        return 0;

    mutex_lock(&phy_lock);

    if (usb_phy_control.flags)
        goto done;

    if (type == S5P_USB_PHY_HOST) {
        if (soc_is_exynos4210() ||
                soc_is_exynos4212() ||
                soc_is_exynos4412()) {
#ifdef CONFIG_USB_OHCI_S5P
            phyclk = readl(EXYNOS4_PHYCLK);
            phyclk |= PHY1_COMMON_ON_N;
            writel(phyclk, EXYNOS4_PHYCLK);
#endif
            ret = exynos4_usb_phy1_resume(pdev);
        } else
            ret = exynos5_usb_phy_host_resume(pdev);
    }
done:
    if (!strcmp(pdev->name, "s5p-ehci"))
        set_bit(HOST_PHY_EHCI, &usb_phy_control.flags);
    else if (!strcmp(pdev->name, "s5p-ohci"))
        set_bit(HOST_PHY_OHCI, &usb_phy_control.flags);

    mutex_unlock(&phy_lock);
    exynos_usb_phy_clock_disable(pdev);

    return ret;
}
Пример #7
0
int s5p_usb_phy_suspend(struct platform_device *pdev, int type)
{
	int ret = 0;

	if (exynos_usb_phy_clock_enable(pdev))
		return 0;

	mutex_lock(&phy_lock);
	if (!strcmp(pdev->name, "s5p-ehci"))
		clear_bit(HOST_PHY_EHCI, &usb_phy_control.flags);
	else if (!strcmp(pdev->name, "s5p-ohci"))
		clear_bit(HOST_PHY_OHCI, &usb_phy_control.flags);

	if (usb_phy_control.flags)
		goto done;

	if (type == S5P_USB_PHY_HOST)
		ret = exynos4_usb_phy1_suspend(pdev);
done:
	mutex_unlock(&phy_lock);
	exynos_usb_phy_clock_disable(pdev);

	return ret;
}
int s5p_usb_phy_suspend(struct platform_device *pdev, int type)
{
	int ret = 0;
#ifdef CONFIG_USB_OHCI_S5P
	struct s5p_ohci_hcd *s5p_ohci = platform_get_drvdata(&s5p_device_ohci);
	struct usb_hcd *ohci_hcd = s5p_ohci->hcd;
	u32 phyclk;
#endif

	if (exynos_usb_phy_clock_enable(pdev))
		return 0;

	mutex_lock(&phy_lock);

	if (!strcmp(pdev->name, "s5p-ehci"))
		clear_bit(HOST_PHY_EHCI, &usb_phy_control.flags);
	else if (!strcmp(pdev->name, "s5p-ohci"))
		clear_bit(HOST_PHY_OHCI, &usb_phy_control.flags);

	if (usb_phy_control.flags)
		goto done;

	if (type == S5P_USB_PHY_HOST) {
		if (soc_is_exynos4210() ||
			soc_is_exynos4212() ||
			soc_is_exynos4412())
			ret = exynos4_usb_phy1_suspend(pdev);
		else
			ret = exynos5_usb_phy_host_suspend(pdev);
	}
done:
	mutex_unlock(&phy_lock);
	exynos_usb_phy_clock_disable(pdev);

	return ret;
}