hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/usb/renesas_usbhs/mod.c
....@@ -3,21 +3,13 @@
33 * Renesas USB driver
44 *
55 * Copyright (C) 2011 Renesas Solutions Corp.
6
+ * Copyright (C) 2019 Renesas Electronics Corporation
67 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
78 */
89 #include <linux/interrupt.h>
910
1011 #include "common.h"
1112 #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
-})
2113
2214 /*
2315 * autonomy
....@@ -41,7 +33,7 @@
4133 {
4234 struct platform_device *pdev = usbhs_priv_to_pdev(priv);
4335
44
- renesas_usbhs_call_notify_hotplug(pdev);
36
+ usbhsc_schedule_notify_hotplug(pdev);
4537
4638 return 0;
4739 }
....@@ -50,10 +42,17 @@
5042 {
5143 struct usbhs_mod_info *info = usbhs_priv_to_modinfo(priv);
5244
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;
5547
5648 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;
5756 }
5857
5958 /*
....@@ -170,17 +169,7 @@
170169 */
171170 int usbhs_status_get_device_state(struct usbhs_irq_state *irq_state)
172171 {
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;
184173 }
185174
186175 int usbhs_status_get_ctrl_stage(struct usbhs_irq_state *irq_state)
....@@ -349,10 +338,6 @@
349338 * usbhs_interrupt
350339 */
351340
352
- /*
353
- * it don't enable DVSE (intenb0) here
354
- * but "mod->irq_dev_state" will be called.
355
- */
356341 if (info->irq_vbus)
357342 intenb0 |= VBSE;
358343
....@@ -363,6 +348,9 @@
363348 if (mod->irq_ctrl_stage)
364349 intenb0 |= CTRE;
365350
351
+ if (mod->irq_dev_state)
352
+ intenb0 |= DVSE;
353
+
366354 if (mod->irq_empty && mod->irq_bempsts) {
367355 usbhs_write(priv, BEMPENB, mod->irq_bempsts);
368356 intenb0 |= BEMPE;