summaryrefslogtreecommitdiff
path: root/arch/arm/mach-exynos/setup-usb-phy.c
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2011-12-23 02:19:36 (GMT)
committerKukjin Kim <kgene.kim@samsung.com>2011-12-23 02:21:28 (GMT)
commit6e7eb170fda0ee14a2cb75a70825a2328fa1f9b8 (patch)
treedc318840a156031d9b099a7be45f5be6df246768 /arch/arm/mach-exynos/setup-usb-phy.c
parent384703b8e6cd4c8ef08512e596024e028c91c339 (diff)
downloadlinux-fsl-qoriq-6e7eb170fda0ee14a2cb75a70825a2328fa1f9b8.tar.xz
ARM: EXYNOS: Add USB OHCI device
Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/mach-exynos/setup-usb-phy.c')
-rw-r--r--arch/arm/mach-exynos/setup-usb-phy.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/arch/arm/mach-exynos/setup-usb-phy.c b/arch/arm/mach-exynos/setup-usb-phy.c
index 39aca04..41743d2 100644
--- a/arch/arm/mach-exynos/setup-usb-phy.c
+++ b/arch/arm/mach-exynos/setup-usb-phy.c
@@ -19,6 +19,13 @@
#include <plat/cpu.h>
#include <plat/usb-phy.h>
+static atomic_t host_usage;
+
+static int exynos4_usb_host_phy_is_on(void)
+{
+ return (readl(EXYNOS4_PHYPWR) & PHY1_STD_ANALOG_POWERDOWN) ? 0 : 1;
+}
+
static int exynos4_usb_phy1_init(struct platform_device *pdev)
{
struct clk *otg_clk;
@@ -27,6 +34,8 @@ static int exynos4_usb_phy1_init(struct platform_device *pdev)
u32 rstcon;
int err;
+ atomic_inc(&host_usage);
+
otg_clk = clk_get(&pdev->dev, "otg");
if (IS_ERR(otg_clk)) {
dev_err(&pdev->dev, "Failed to get otg clock\n");
@@ -39,6 +48,9 @@ static int exynos4_usb_phy1_init(struct platform_device *pdev)
return err;
}
+ if (exynos4_usb_host_phy_is_on())
+ return 0;
+
writel(readl(S5P_USBHOST_PHY_CONTROL) | S5P_USBHOST_PHY_ENABLE,
S5P_USBHOST_PHY_CONTROL);
@@ -95,6 +107,9 @@ static int exynos4_usb_phy1_exit(struct platform_device *pdev)
struct clk *otg_clk;
int err;
+ if (atomic_dec_return(&host_usage) > 0)
+ return 0;
+
otg_clk = clk_get(&pdev->dev, "otg");
if (IS_ERR(otg_clk)) {
dev_err(&pdev->dev, "Failed to get otg clock\n");