aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan T. Ivanov <iivanov@mm-sol.com>2013-12-30 16:15:27 -0500
committerOlof Johansson <olof@lixom.net>2014-01-09 03:06:48 -0500
commit5146d7714302f0b5dff7c591c6de947067669ca3 (patch)
tree2ef0b29f1bae62ecb13a4064117f2492fb24435d
parent21dea66951342ec514ad498eda843cf633a13634 (diff)
usb: phy: msm: Move mach dependent code to platform data
This patch fix compilation error when driver is compiled in multi-platform builds. drivers/built-in.o: In function `msm_otg_link_clk_reset': ./drivers/usb/phy/phy-msm-usb.c:314: undefined reference to `clk_reset' ./drivers/usb/phy/phy-msm-usb.c:318: undefined reference to `clk_reset' Use platform data supplied reset handlers and adjust error messages reported when reset sequence fail. This is an intermediate step before adding support for reset framework and newer targets. Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com> Acked-by: David Brown <davidb@codeaurora.org> Cc: Daniel Walker <dwalker@fifo99.com> Acked-by: Felipe Balbi <balbi@ti.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Olof Johansson <olof@lixom.net>
-rw-r--r--arch/arm/mach-msm/board-msm7x30.c35
-rw-r--r--arch/arm/mach-msm/board-qsd8x50.c35
-rw-r--r--drivers/usb/phy/phy-msm-usb.c35
-rw-r--r--include/linux/usb/msm_hsusb.h3
4 files changed, 88 insertions, 20 deletions
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index f9af5a46e8b6..46de789ad3ae 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -30,6 +30,7 @@
30#include <asm/memory.h> 30#include <asm/memory.h>
31#include <asm/setup.h> 31#include <asm/setup.h>
32 32
33#include <mach/clk.h>
33#include <mach/msm_iomap.h> 34#include <mach/msm_iomap.h>
34#include <mach/dma.h> 35#include <mach/dma.h>
35 36
@@ -60,10 +61,44 @@ static int hsusb_phy_init_seq[] = {
60 -1 61 -1
61}; 62};
62 63
64static int hsusb_link_clk_reset(struct clk *link_clk, bool assert)
65{
66 int ret;
67
68 if (assert) {
69 ret = clk_reset(link_clk, CLK_RESET_ASSERT);
70 if (ret)
71 pr_err("usb hs_clk assert failed\n");
72 } else {
73 ret = clk_reset(link_clk, CLK_RESET_DEASSERT);
74 if (ret)
75 pr_err("usb hs_clk deassert failed\n");
76 }
77 return ret;
78}
79
80static int hsusb_phy_clk_reset(struct clk *phy_clk)
81{
82 int ret;
83
84 ret = clk_reset(phy_clk, CLK_RESET_ASSERT);
85 if (ret) {
86 pr_err("usb phy clk assert failed\n");
87 return ret;
88 }
89 usleep_range(10000, 12000);
90 ret = clk_reset(phy_clk, CLK_RESET_DEASSERT);
91 if (ret)
92 pr_err("usb phy clk deassert failed\n");
93 return ret;
94}
95
63static struct msm_otg_platform_data msm_otg_pdata = { 96static struct msm_otg_platform_data msm_otg_pdata = {
64 .phy_init_seq = hsusb_phy_init_seq, 97 .phy_init_seq = hsusb_phy_init_seq,
65 .mode = USB_PERIPHERAL, 98 .mode = USB_PERIPHERAL,
66 .otg_control = OTG_PHY_CONTROL, 99 .otg_control = OTG_PHY_CONTROL,
100 .link_clk_reset = hsusb_link_clk_reset,
101 .phy_clk_reset = hsusb_phy_clk_reset,
67}; 102};
68 103
69struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = { 104struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = {
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 5f933bc50783..9169ec324a43 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -31,6 +31,7 @@
31#include <mach/irqs.h> 31#include <mach/irqs.h>
32#include <mach/sirc.h> 32#include <mach/sirc.h>
33#include <mach/vreg.h> 33#include <mach/vreg.h>
34#include <mach/clk.h>
34#include <linux/platform_data/mmc-msm_sdcc.h> 35#include <linux/platform_data/mmc-msm_sdcc.h>
35 36
36#include "devices.h" 37#include "devices.h"
@@ -81,10 +82,44 @@ static int hsusb_phy_init_seq[] = {
81 -1 82 -1
82}; 83};
83 84
85static int hsusb_link_clk_reset(struct clk *link_clk, bool assert)
86{
87 int ret;
88
89 if (assert) {
90 ret = clk_reset(link_clk, CLK_RESET_ASSERT);
91 if (ret)
92 pr_err("usb hs_clk assert failed\n");
93 } else {
94 ret = clk_reset(link_clk, CLK_RESET_DEASSERT);
95 if (ret)
96 pr_err("usb hs_clk deassert failed\n");
97 }
98 return ret;
99}
100
101static int hsusb_phy_clk_reset(struct clk *phy_clk)
102{
103 int ret;
104
105 ret = clk_reset(phy_clk, CLK_RESET_ASSERT);
106 if (ret) {
107 pr_err("usb phy clk assert failed\n");
108 return ret;
109 }
110 usleep_range(10000, 12000);
111 ret = clk_reset(phy_clk, CLK_RESET_DEASSERT);
112 if (ret)
113 pr_err("usb phy clk deassert failed\n");
114 return ret;
115}
116
84static struct msm_otg_platform_data msm_otg_pdata = { 117static struct msm_otg_platform_data msm_otg_pdata = {
85 .phy_init_seq = hsusb_phy_init_seq, 118 .phy_init_seq = hsusb_phy_init_seq,
86 .mode = USB_PERIPHERAL, 119 .mode = USB_PERIPHERAL,
87 .otg_control = OTG_PHY_CONTROL, 120 .otg_control = OTG_PHY_CONTROL,
121 .link_clk_reset = hsusb_link_clk_reset,
122 .phy_clk_reset = hsusb_phy_clk_reset,
88}; 123};
89 124
90static struct platform_device *devices[] __initdata = { 125static struct platform_device *devices[] __initdata = {
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index e9d4cd960ecd..9a47d4403e86 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -40,8 +40,6 @@
40#include <linux/usb/msm_hsusb_hw.h> 40#include <linux/usb/msm_hsusb_hw.h>
41#include <linux/regulator/consumer.h> 41#include <linux/regulator/consumer.h>
42 42
43#include <mach/clk.h>
44
45#define MSM_USB_BASE (motg->regs) 43#define MSM_USB_BASE (motg->regs)
46#define DRIVER_NAME "msm_otg" 44#define DRIVER_NAME "msm_otg"
47 45
@@ -308,33 +306,30 @@ static void ulpi_init(struct msm_otg *motg)
308 306
309static int msm_otg_link_clk_reset(struct msm_otg *motg, bool assert) 307static int msm_otg_link_clk_reset(struct msm_otg *motg, bool assert)
310{ 308{
311 int ret; 309 int ret = 0;
310
311 if (!motg->pdata->link_clk_reset)
312 return ret;
313
314 ret = motg->pdata->link_clk_reset(motg->clk, assert);
315 if (ret)
316 dev_err(motg->phy.dev, "usb link clk reset %s failed\n",
317 assert ? "assert" : "deassert");
312 318
313 if (assert) {
314 ret = clk_reset(motg->clk, CLK_RESET_ASSERT);
315 if (ret)
316 dev_err(motg->phy.dev, "usb hs_clk assert failed\n");
317 } else {
318 ret = clk_reset(motg->clk, CLK_RESET_DEASSERT);
319 if (ret)
320 dev_err(motg->phy.dev, "usb hs_clk deassert failed\n");
321 }
322 return ret; 319 return ret;
323} 320}
324 321
325static int msm_otg_phy_clk_reset(struct msm_otg *motg) 322static int msm_otg_phy_clk_reset(struct msm_otg *motg)
326{ 323{
327 int ret; 324 int ret = 0;
328 325
329 ret = clk_reset(motg->phy_reset_clk, CLK_RESET_ASSERT); 326 if (!motg->pdata->phy_clk_reset)
330 if (ret) {
331 dev_err(motg->phy.dev, "usb phy clk assert failed\n");
332 return ret; 327 return ret;
333 } 328
334 usleep_range(10000, 12000); 329 ret = motg->pdata->phy_clk_reset(motg->phy_reset_clk);
335 ret = clk_reset(motg->phy_reset_clk, CLK_RESET_DEASSERT);
336 if (ret) 330 if (ret)
337 dev_err(motg->phy.dev, "usb phy clk deassert failed\n"); 331 dev_err(motg->phy.dev, "usb phy clk reset failed\n");
332
338 return ret; 333 return ret;
339} 334}
340 335
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 22a396c13f3a..32754835a39b 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -20,6 +20,7 @@
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/usb/otg.h> 22#include <linux/usb/otg.h>
23#include <linux/clk.h>
23 24
24/** 25/**
25 * Supported USB modes 26 * Supported USB modes
@@ -135,6 +136,8 @@ struct msm_otg_platform_data {
135 enum msm_usb_phy_type phy_type; 136 enum msm_usb_phy_type phy_type;
136 void (*setup_gpio)(enum usb_otg_state state); 137 void (*setup_gpio)(enum usb_otg_state state);
137 char *pclk_src_name; 138 char *pclk_src_name;
139 int (*link_clk_reset)(struct clk *link_clk, bool assert);
140 int (*phy_clk_reset)(struct clk *phy_clk);
138}; 141};
139 142
140/** 143/**