diff options
Diffstat (limited to 'arch/arm/mach-exynos/setup-usb-phy.c')
-rw-r--r-- | arch/arm/mach-exynos/setup-usb-phy.c | 73 |
1 files changed, 49 insertions, 24 deletions
diff --git a/arch/arm/mach-exynos/setup-usb-phy.c b/arch/arm/mach-exynos/setup-usb-phy.c index 22621c5..815be57 100644 --- a/arch/arm/mach-exynos/setup-usb-phy.c +++ b/arch/arm/mach-exynos/setup-usb-phy.c @@ -68,6 +68,10 @@ struct exynos_usb_phy { unsigned long usage; }; +#if defined(CONFIG_KONA_00_BD) +extern int current_cable_type; +#endif + static struct exynos_usb_phy usb_phy_control; static atomic_t host_usage; @@ -357,10 +361,13 @@ static int exynos4_usb_phy1_resume(struct platform_device *pdev) if (usb_phy_control.lpa_entered) { #if defined(CONFIG_LINK_DEVICE_HSIC) || defined(CONFIG_LINK_DEVICE_USB) \ || defined(CONFIG_MDM_HSIC_PM) - if (!strcmp(pdev->name, "s5p-ehci")) + if (!strcmp(pdev->name, "s5p-ehci")) { set_hsic_lpa_states(STATE_HSIC_LPA_WAKE); -#endif + usb_phy_control.lpa_entered = 0; + } +#else usb_phy_control.lpa_entered = 0; +#endif err = 1; } else { err = 0; @@ -422,10 +429,13 @@ static int exynos4_usb_phy1_resume(struct platform_device *pdev) } #if defined(CONFIG_LINK_DEVICE_HSIC) || defined(CONFIG_LINK_DEVICE_USB) \ || defined(CONFIG_MDM_HSIC_PM) - if (!strcmp(pdev->name, "s5p-ehci")) + if (!strcmp(pdev->name, "s5p-ehci")) { set_hsic_lpa_states(STATE_HSIC_LPA_WAKE); -#endif + usb_phy_control.lpa_entered = 0; + } +#else usb_phy_control.lpa_entered = 0; +#endif err = 1; } udelay(80); @@ -469,11 +479,7 @@ static int exynos4_usb_phy1_init(struct platform_device *pdev) /* set clock frequency for PLL */ phyclk = readl(EXYNOS4_PHYCLK) & ~(EXYNOS4210_CLKSEL_MASK); phyclk |= exynos_usb_phy_set_clock(pdev); -#ifdef CONFIG_USB_OHCI_S5P - phyclk |= PHY1_COMMON_ON_N; -#else phyclk &= ~(PHY1_COMMON_ON_N); -#endif writel(phyclk, EXYNOS4_PHYCLK); /* set to normal HSIC 0 and 1 of PHY1 */ @@ -1003,6 +1009,9 @@ int exynos4_check_usb_op(void) int ret; #if defined(CONFIG_MDM_HSIC_PM) + if (set_hsic_lpa_states(STATE_HSIC_LPA_ENABLE)) + return 1; + /* if it is normal boot, block lpa till modem boot */ if (set_hsic_lpa_states(STATE_HSIC_LPA_CHECK)) return 1; @@ -1014,14 +1023,29 @@ int exynos4_check_usb_op(void) local_irq_save(flags); phypwr = readl(EXYNOS4_PHYPWR); - /*If USB Device is power on, */ - if (exynos_usb_device_phy_is_on()) { - op = 1; - goto done; - } else if (!exynos4_usb_host_phy_is_on()) { - op = 0; - goto done; - } +#if defined(CONFIG_KONA_00_BD) + /*If USB Device is power on, */ + if (current_cable_type != 3) // 3 is TA (POWER_SUPPLY_TYPE_MAINS) + { +// printk("[USB] current_cable_type is %d !!!!!! ",current_cable_type); + if (exynos_usb_device_phy_is_on()) { + op = 1; + goto done; + } else if (!exynos4_usb_host_phy_is_on()) { + op = 0; + goto done; + } + } +#else + /*If USB Device is power on, */ + if (exynos_usb_device_phy_is_on()) { + op = 1; + goto done; + } else if (!exynos4_usb_host_phy_is_on()) { + op = 0; + goto done; + } +#endif /*If USB Device & Host is suspended, */ if (soc_is_exynos4210()) { @@ -1044,6 +1068,8 @@ int exynos4_check_usb_op(void) if (phypwr & (PHY1_STD_FORCE_SUSPEND | EXYNOS4212_HSIC0_FORCE_SUSPEND | EXYNOS4212_HSIC1_FORCE_SUSPEND)) { + /* HSIC LPA: LPA USB phy retention reume call the usb + * reset resume, so we should let CP to HSIC L3 mode. */ #if defined(CONFIG_LINK_DEVICE_HSIC) || defined(CONFIG_LINK_DEVICE_USB) set_hsic_lpa_states(STATE_HSIC_LPA_ENTER); #elif defined(CONFIG_MDM_HSIC_PM) @@ -1176,15 +1202,13 @@ int s5p_usb_phy_suspend(struct platform_device *pdev, int type) if (soc_is_exynos4210() || soc_is_exynos4212() || soc_is_exynos4412()) { + dev_info(&pdev->dev, "host_phy_susp\n"); #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); + if (ohci_hcd->state == HC_STATE_SUSPENDED) { + phyclk = readl(EXYNOS4_PHYCLK); + phyclk &= ~(PHY1_COMMON_ON_N); + writel(phyclk, EXYNOS4_PHYCLK); + } #endif ret = exynos4_usb_phy1_suspend(pdev); } else @@ -1214,6 +1238,7 @@ int s5p_usb_phy_resume(struct platform_device *pdev, int type) if (soc_is_exynos4210() || soc_is_exynos4212() || soc_is_exynos4412()) { + dev_info(&pdev->dev, "host_phy_resume\n"); #ifdef CONFIG_USB_OHCI_S5P phyclk = readl(EXYNOS4_PHYCLK); phyclk |= PHY1_COMMON_ON_N; |