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 (soc_is_exynos4210())
			ret = exynos4_usb_phy1_init(pdev);
		else if (soc_is_exynos4212() || soc_is_exynos4412())
			ret = exynos4_usb_phy20_init(pdev);
		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);
	} 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;
}
static int exynos_usb_dev_phy20_init(struct platform_device *pdev)
{
	if (soc_is_exynos4212() || soc_is_exynos4412()) {
		exynos4_usb_phy20_init(pdev);
		if (usb_phy_control.lpa_entered)
			exynos4_usb_phy1_suspend(pdev);
	} else
		exynos5_usb_phy20_init(pdev);

	exynos_usb_mux_change(pdev, 0);

	return 0;
}
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;
}
Beispiel #4
0
int s5p_usb_phy_init(struct platform_device *pdev, int type)
{
	if (type == S5P_USB_PHY_HOST) {
		if (soc_is_exynos4210() || soc_is_exynos4212() || soc_is_exynos4412())
			return exynos4_usb_phy1_init(pdev);
		else
			return exynos5_usb_phy20_init(pdev);
	} else if (type == S5P_USB_PHY_DEVICE) {
		if (soc_is_exynos4210() || soc_is_exynos4212() || soc_is_exynos4412())
			return exynos4_usb_phy0_init(pdev);
		else
			return exynos5_usb_dev_phy20_init(pdev);
	} else if (type == S5P_USB_PHY_DRD) {
		return exynos5_usb_phy30_init(pdev);
	}

	return -EINVAL;
}
Beispiel #5
0
static int exynos5_usb_dev_phy20_init(struct platform_device *pdev)
{
	struct clk *otg_clk;
	struct clk *host_clk;
	int err;

	exynos4_usb_phy_control(USB_PHY1, PHY_ENABLE);

	host_clk = clk_get(&pdev->dev, "usbhost");
	if (IS_ERR(host_clk)) {
		dev_err(&pdev->dev, "Failed to get otg clock\n");
		return PTR_ERR(host_clk);
	}

	err = clk_enable(host_clk);
	if (err) {
		clk_put(host_clk);
		return err;
	}

	if (!exynos5_usb_host_phy20_is_on()) {
		exynos5_usb_phy20_init(pdev);
	}
	clk_disable(host_clk);
	clk_put(host_clk);

	otg_clk = clk_get(&pdev->dev, "usbotg");
	if (IS_ERR(otg_clk)) {
		dev_err(&pdev->dev, "Failed to get otg clock\n");
		return PTR_ERR(otg_clk);
	}

	err = clk_enable(otg_clk);
	if (err) {
		clk_put(otg_clk);
		return err;
	}

	exynos_usb_mux_change(pdev, 0);

	clk_put(otg_clk);
	return 0;
}