aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/renesas_usbhs/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/renesas_usbhs/common.c')
-rw-r--r--drivers/usb/renesas_usbhs/common.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index fd43fdd6cd81..243512d93e58 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -147,6 +147,33 @@ int usbhs_frame_get_num(struct usbhs_priv *priv)
147} 147}
148 148
149/* 149/*
150 * bus/vbus functions
151 */
152void usbhs_bus_send_sof_enable(struct usbhs_priv *priv)
153{
154 usbhs_bset(priv, DVSTCTR, (USBRST | UACT), UACT);
155}
156
157void usbhs_bus_send_reset(struct usbhs_priv *priv)
158{
159 usbhs_bset(priv, DVSTCTR, (USBRST | UACT), USBRST);
160}
161
162int usbhs_vbus_ctrl(struct usbhs_priv *priv, int enable)
163{
164 struct platform_device *pdev = usbhs_priv_to_pdev(priv);
165
166 return usbhs_platform_call(priv, set_vbus, pdev, enable);
167}
168
169static void usbhsc_bus_init(struct usbhs_priv *priv)
170{
171 usbhs_write(priv, DVSTCTR, 0);
172
173 usbhs_vbus_ctrl(priv, 0);
174}
175
176/*
150 * local functions 177 * local functions
151 */ 178 */
152static void usbhsc_set_buswait(struct usbhs_priv *priv) 179static void usbhsc_set_buswait(struct usbhs_priv *priv)
@@ -187,7 +214,6 @@ static void usbhsc_power_ctrl(struct usbhs_priv *priv, int enable)
187 214
188 /* USB on */ 215 /* USB on */
189 usbhs_sys_clock_ctrl(priv, enable); 216 usbhs_sys_clock_ctrl(priv, enable);
190 usbhsc_set_buswait(priv);
191 } else { 217 } else {
192 /* USB off */ 218 /* USB off */
193 usbhs_sys_clock_ctrl(priv, enable); 219 usbhs_sys_clock_ctrl(priv, enable);
@@ -229,6 +255,10 @@ static void usbhsc_hotplug(struct usbhs_priv *priv)
229 if (usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL)) 255 if (usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL))
230 usbhsc_power_ctrl(priv, enable); 256 usbhsc_power_ctrl(priv, enable);
231 257
258 /* bus init */
259 usbhsc_set_buswait(priv);
260 usbhsc_bus_init(priv);
261
232 /* module start */ 262 /* module start */
233 usbhs_mod_call(priv, start, priv); 263 usbhs_mod_call(priv, start, priv);
234 264
@@ -238,6 +268,9 @@ static void usbhsc_hotplug(struct usbhs_priv *priv)
238 /* module stop */ 268 /* module stop */
239 usbhs_mod_call(priv, stop, priv); 269 usbhs_mod_call(priv, stop, priv);
240 270
271 /* bus init */
272 usbhsc_bus_init(priv);
273
241 /* power off */ 274 /* power off */
242 if (usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL)) 275 if (usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL))
243 usbhsc_power_ctrl(priv, enable); 276 usbhsc_power_ctrl(priv, enable);