.. | .. |
---|
3 | 3 | * Renesas USB driver |
---|
4 | 4 | * |
---|
5 | 5 | * Copyright (C) 2011 Renesas Solutions Corp. |
---|
| 6 | + * Copyright (C) 2019 Renesas Electronics Corporation |
---|
6 | 7 | * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
---|
7 | 8 | */ |
---|
8 | 9 | #include <linux/interrupt.h> |
---|
9 | 10 | |
---|
10 | 11 | #include "common.h" |
---|
11 | 12 | #include "mod.h" |
---|
12 | | - |
---|
13 | | -#define usbhs_priv_to_modinfo(priv) (&priv->mod_info) |
---|
14 | | -#define usbhs_mod_info_call(priv, func, param...) \ |
---|
15 | | -({ \ |
---|
16 | | - struct usbhs_mod_info *info; \ |
---|
17 | | - info = usbhs_priv_to_modinfo(priv); \ |
---|
18 | | - !info->func ? 0 : \ |
---|
19 | | - info->func(param); \ |
---|
20 | | -}) |
---|
21 | 13 | |
---|
22 | 14 | /* |
---|
23 | 15 | * autonomy |
---|
.. | .. |
---|
41 | 33 | { |
---|
42 | 34 | struct platform_device *pdev = usbhs_priv_to_pdev(priv); |
---|
43 | 35 | |
---|
44 | | - renesas_usbhs_call_notify_hotplug(pdev); |
---|
| 36 | + usbhsc_schedule_notify_hotplug(pdev); |
---|
45 | 37 | |
---|
46 | 38 | return 0; |
---|
47 | 39 | } |
---|
.. | .. |
---|
50 | 42 | { |
---|
51 | 43 | struct usbhs_mod_info *info = usbhs_priv_to_modinfo(priv); |
---|
52 | 44 | |
---|
53 | | - info->irq_vbus = usbhsm_autonomy_irq_vbus; |
---|
54 | | - priv->pfunc.get_vbus = usbhsm_autonomy_get_vbus; |
---|
| 45 | + info->irq_vbus = usbhsm_autonomy_irq_vbus; |
---|
| 46 | + info->get_vbus = usbhsm_autonomy_get_vbus; |
---|
55 | 47 | |
---|
56 | 48 | usbhs_irq_callback_update(priv, NULL); |
---|
| 49 | +} |
---|
| 50 | + |
---|
| 51 | +void usbhs_mod_non_autonomy_mode(struct usbhs_priv *priv) |
---|
| 52 | +{ |
---|
| 53 | + struct usbhs_mod_info *info = usbhs_priv_to_modinfo(priv); |
---|
| 54 | + |
---|
| 55 | + info->get_vbus = priv->pfunc->get_vbus; |
---|
57 | 56 | } |
---|
58 | 57 | |
---|
59 | 58 | /* |
---|
.. | .. |
---|
170 | 169 | */ |
---|
171 | 170 | int usbhs_status_get_device_state(struct usbhs_irq_state *irq_state) |
---|
172 | 171 | { |
---|
173 | | - int state = irq_state->intsts0 & DVSQ_MASK; |
---|
174 | | - |
---|
175 | | - switch (state) { |
---|
176 | | - case POWER_STATE: |
---|
177 | | - case DEFAULT_STATE: |
---|
178 | | - case ADDRESS_STATE: |
---|
179 | | - case CONFIGURATION_STATE: |
---|
180 | | - return state; |
---|
181 | | - } |
---|
182 | | - |
---|
183 | | - return -EIO; |
---|
| 172 | + return (int)irq_state->intsts0 & DVSQ_MASK; |
---|
184 | 173 | } |
---|
185 | 174 | |
---|
186 | 175 | int usbhs_status_get_ctrl_stage(struct usbhs_irq_state *irq_state) |
---|
.. | .. |
---|
349 | 338 | * usbhs_interrupt |
---|
350 | 339 | */ |
---|
351 | 340 | |
---|
352 | | - /* |
---|
353 | | - * it don't enable DVSE (intenb0) here |
---|
354 | | - * but "mod->irq_dev_state" will be called. |
---|
355 | | - */ |
---|
356 | 341 | if (info->irq_vbus) |
---|
357 | 342 | intenb0 |= VBSE; |
---|
358 | 343 | |
---|
.. | .. |
---|
363 | 348 | if (mod->irq_ctrl_stage) |
---|
364 | 349 | intenb0 |= CTRE; |
---|
365 | 350 | |
---|
| 351 | + if (mod->irq_dev_state) |
---|
| 352 | + intenb0 |= DVSE; |
---|
| 353 | + |
---|
366 | 354 | if (mod->irq_empty && mod->irq_bempsts) { |
---|
367 | 355 | usbhs_write(priv, BEMPENB, mod->irq_bempsts); |
---|
368 | 356 | intenb0 |= BEMPE; |
---|