diff options
author | Jingoo Han <jg1.han@samsung.com> | 2011-12-22 21:19:36 -0500 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2011-12-22 21:21:28 -0500 |
commit | 6e7eb170fda0ee14a2cb75a70825a2328fa1f9b8 (patch) | |
tree | dc318840a156031d9b099a7be45f5be6df246768 /arch/arm/mach-exynos/setup-usb-phy.c | |
parent | 384703b8e6cd4c8ef08512e596024e028c91c339 (diff) |
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.c | 15 |
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 39aca045f660..41743d21e8c6 100644 --- a/arch/arm/mach-exynos/setup-usb-phy.c +++ b/arch/arm/mach-exynos/setup-usb-phy.c | |||
@@ -19,6 +19,13 @@ | |||
19 | #include <plat/cpu.h> | 19 | #include <plat/cpu.h> |
20 | #include <plat/usb-phy.h> | 20 | #include <plat/usb-phy.h> |
21 | 21 | ||
22 | static atomic_t host_usage; | ||
23 | |||
24 | static int exynos4_usb_host_phy_is_on(void) | ||
25 | { | ||
26 | return (readl(EXYNOS4_PHYPWR) & PHY1_STD_ANALOG_POWERDOWN) ? 0 : 1; | ||
27 | } | ||
28 | |||
22 | static int exynos4_usb_phy1_init(struct platform_device *pdev) | 29 | static int exynos4_usb_phy1_init(struct platform_device *pdev) |
23 | { | 30 | { |
24 | struct clk *otg_clk; | 31 | struct clk *otg_clk; |
@@ -27,6 +34,8 @@ static int exynos4_usb_phy1_init(struct platform_device *pdev) | |||
27 | u32 rstcon; | 34 | u32 rstcon; |
28 | int err; | 35 | int err; |
29 | 36 | ||
37 | atomic_inc(&host_usage); | ||
38 | |||
30 | otg_clk = clk_get(&pdev->dev, "otg"); | 39 | otg_clk = clk_get(&pdev->dev, "otg"); |
31 | if (IS_ERR(otg_clk)) { | 40 | if (IS_ERR(otg_clk)) { |
32 | dev_err(&pdev->dev, "Failed to get otg clock\n"); | 41 | dev_err(&pdev->dev, "Failed to get otg clock\n"); |
@@ -39,6 +48,9 @@ static int exynos4_usb_phy1_init(struct platform_device *pdev) | |||
39 | return err; | 48 | return err; |
40 | } | 49 | } |
41 | 50 | ||
51 | if (exynos4_usb_host_phy_is_on()) | ||
52 | return 0; | ||
53 | |||
42 | writel(readl(S5P_USBHOST_PHY_CONTROL) | S5P_USBHOST_PHY_ENABLE, | 54 | writel(readl(S5P_USBHOST_PHY_CONTROL) | S5P_USBHOST_PHY_ENABLE, |
43 | S5P_USBHOST_PHY_CONTROL); | 55 | S5P_USBHOST_PHY_CONTROL); |
44 | 56 | ||
@@ -95,6 +107,9 @@ static int exynos4_usb_phy1_exit(struct platform_device *pdev) | |||
95 | struct clk *otg_clk; | 107 | struct clk *otg_clk; |
96 | int err; | 108 | int err; |
97 | 109 | ||
110 | if (atomic_dec_return(&host_usage) > 0) | ||
111 | return 0; | ||
112 | |||
98 | otg_clk = clk_get(&pdev->dev, "otg"); | 113 | otg_clk = clk_get(&pdev->dev, "otg"); |
99 | if (IS_ERR(otg_clk)) { | 114 | if (IS_ERR(otg_clk)) { |
100 | dev_err(&pdev->dev, "Failed to get otg clock\n"); | 115 | dev_err(&pdev->dev, "Failed to get otg clock\n"); |