diff options
Diffstat (limited to 'drivers/usb/renesas_usbhs/common.c')
-rw-r--r-- | drivers/usb/renesas_usbhs/common.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index aa94e33e6885..e9a5b1d2615e 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c | |||
@@ -95,25 +95,15 @@ struct usbhs_priv *usbhs_pdev_to_priv(struct platform_device *pdev) | |||
95 | /* | 95 | /* |
96 | * syscfg functions | 96 | * syscfg functions |
97 | */ | 97 | */ |
98 | void usbhs_sys_clock_ctrl(struct usbhs_priv *priv, int enable) | 98 | static void usbhs_sys_clock_ctrl(struct usbhs_priv *priv, int enable) |
99 | { | 99 | { |
100 | usbhs_bset(priv, SYSCFG, SCKE, enable ? SCKE : 0); | 100 | usbhs_bset(priv, SYSCFG, SCKE, enable ? SCKE : 0); |
101 | } | 101 | } |
102 | 102 | ||
103 | void usbhs_sys_hispeed_ctrl(struct usbhs_priv *priv, int enable) | ||
104 | { | ||
105 | usbhs_bset(priv, SYSCFG, HSE, enable ? HSE : 0); | ||
106 | } | ||
107 | |||
108 | void usbhs_sys_usb_ctrl(struct usbhs_priv *priv, int enable) | ||
109 | { | ||
110 | usbhs_bset(priv, SYSCFG, USBE, enable ? USBE : 0); | ||
111 | } | ||
112 | |||
113 | void usbhs_sys_host_ctrl(struct usbhs_priv *priv, int enable) | 103 | void usbhs_sys_host_ctrl(struct usbhs_priv *priv, int enable) |
114 | { | 104 | { |
115 | u16 mask = DCFM | DRPD | DPRPU; | 105 | u16 mask = DCFM | DRPD | DPRPU | HSE | USBE; |
116 | u16 val = DCFM | DRPD; | 106 | u16 val = DCFM | DRPD | HSE | USBE; |
117 | int has_otg = usbhs_get_dparam(priv, has_otg); | 107 | int has_otg = usbhs_get_dparam(priv, has_otg); |
118 | 108 | ||
119 | if (has_otg) | 109 | if (has_otg) |
@@ -130,8 +120,8 @@ void usbhs_sys_host_ctrl(struct usbhs_priv *priv, int enable) | |||
130 | 120 | ||
131 | void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable) | 121 | void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable) |
132 | { | 122 | { |
133 | u16 mask = DCFM | DRPD | DPRPU; | 123 | u16 mask = DCFM | DRPD | DPRPU | HSE | USBE; |
134 | u16 val = DPRPU; | 124 | u16 val = DPRPU | HSE | USBE; |
135 | 125 | ||
136 | /* | 126 | /* |
137 | * if enable | 127 | * if enable |
@@ -142,6 +132,11 @@ void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable) | |||
142 | usbhs_bset(priv, SYSCFG, mask, enable ? val : 0); | 132 | usbhs_bset(priv, SYSCFG, mask, enable ? val : 0); |
143 | } | 133 | } |
144 | 134 | ||
135 | void usbhs_sys_set_test_mode(struct usbhs_priv *priv, u16 mode) | ||
136 | { | ||
137 | usbhs_write(priv, TESTMODE, mode); | ||
138 | } | ||
139 | |||
145 | /* | 140 | /* |
146 | * frame functions | 141 | * frame functions |
147 | */ | 142 | */ |
@@ -229,7 +224,7 @@ static void usbhsc_bus_init(struct usbhs_priv *priv) | |||
229 | /* | 224 | /* |
230 | * device configuration | 225 | * device configuration |
231 | */ | 226 | */ |
232 | int usbhs_set_device_speed(struct usbhs_priv *priv, int devnum, | 227 | int usbhs_set_device_config(struct usbhs_priv *priv, int devnum, |
233 | u16 upphub, u16 hubport, u16 speed) | 228 | u16 upphub, u16 hubport, u16 speed) |
234 | { | 229 | { |
235 | struct device *dev = usbhs_priv_to_dev(priv); | 230 | struct device *dev = usbhs_priv_to_dev(priv); |
@@ -301,18 +296,25 @@ static u32 usbhsc_default_pipe_type[] = { | |||
301 | */ | 296 | */ |
302 | static void usbhsc_power_ctrl(struct usbhs_priv *priv, int enable) | 297 | static void usbhsc_power_ctrl(struct usbhs_priv *priv, int enable) |
303 | { | 298 | { |
299 | struct platform_device *pdev = usbhs_priv_to_pdev(priv); | ||
304 | struct device *dev = usbhs_priv_to_dev(priv); | 300 | struct device *dev = usbhs_priv_to_dev(priv); |
305 | 301 | ||
306 | if (enable) { | 302 | if (enable) { |
307 | /* enable PM */ | 303 | /* enable PM */ |
308 | pm_runtime_get_sync(dev); | 304 | pm_runtime_get_sync(dev); |
309 | 305 | ||
306 | /* enable platform power */ | ||
307 | usbhs_platform_call(priv, power_ctrl, pdev, priv->base, enable); | ||
308 | |||
310 | /* USB on */ | 309 | /* USB on */ |
311 | usbhs_sys_clock_ctrl(priv, enable); | 310 | usbhs_sys_clock_ctrl(priv, enable); |
312 | } else { | 311 | } else { |
313 | /* USB off */ | 312 | /* USB off */ |
314 | usbhs_sys_clock_ctrl(priv, enable); | 313 | usbhs_sys_clock_ctrl(priv, enable); |
315 | 314 | ||
315 | /* disable platform power */ | ||
316 | usbhs_platform_call(priv, power_ctrl, pdev, priv->base, enable); | ||
317 | |||
316 | /* disable PM */ | 318 | /* disable PM */ |
317 | pm_runtime_put_sync(dev); | 319 | pm_runtime_put_sync(dev); |
318 | } | 320 | } |
@@ -388,7 +390,7 @@ static void usbhsc_notify_hotplug(struct work_struct *work) | |||
388 | usbhsc_hotplug(priv); | 390 | usbhsc_hotplug(priv); |
389 | } | 391 | } |
390 | 392 | ||
391 | int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev) | 393 | static int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev) |
392 | { | 394 | { |
393 | struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev); | 395 | struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev); |
394 | int delay = usbhs_get_dparam(priv, detection_delay); | 396 | int delay = usbhs_get_dparam(priv, detection_delay); |
@@ -398,7 +400,8 @@ int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev) | |||
398 | * To make sure safety context, | 400 | * To make sure safety context, |
399 | * use workqueue for usbhs_notify_hotplug | 401 | * use workqueue for usbhs_notify_hotplug |
400 | */ | 402 | */ |
401 | schedule_delayed_work(&priv->notify_hotplug_work, delay); | 403 | schedule_delayed_work(&priv->notify_hotplug_work, |
404 | msecs_to_jiffies(delay)); | ||
402 | return 0; | 405 | return 0; |
403 | } | 406 | } |
404 | 407 | ||