linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/3] usb: renesas_usbhs: enable DVSE interrupt
@ 2019-09-06 12:03 Veeraiyan Chidambaram
  2019-09-06 12:03 ` [PATCH v2 2/3] usb: renesas_usbhs: simplify usbhs_status_get_device_state() Veeraiyan Chidambaram
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Veeraiyan Chidambaram @ 2019-09-06 12:03 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman, Geert Uytterhoeven,
	Yoshihiro Shimoda, Linux-Renesas
  Cc: linux-usb, Andrew Gabbasov, Eugeniu Rosca, external.veeraiyan.c

From: Eugeniu Rosca <erosca@de.adit-jv.com>

Commit [1] enabled the possibility of checking the DVST (Device State
Transition) bit of INTSTS0 (Interrupt Status Register 0) and calling
the irq_dev_state() handler if the DVST bit is set. But neither
commit [1] nor commit [2] actually enabled the DVSE (Device State
Transition Interrupt Enable) bit in the INTENB0 (Interrupt Enable
Register 0). As a consequence, irq_dev_state() handler is getting
called as a side effect of other (non-DVSE) interrupts being fired,
which definitely can't be relied upon, if DVST notifications are of
any value.

Why this doesn't hurt is because usbhsg_irq_dev_state() currently
doesn't do much except of a dev_dbg(). Once more work is added to
the handler (e.g. detecting device "Suspended" state and notifying
other USB gadget components about it), enabling DVSE becomes a hard
requirement. Do it in a standalone commit for better visibility and
clear explanation.

[1] f1407d5 ("usb: renesas_usbhs: Add Renesas USBHS common code")
[2] 2f98382 ("usb: renesas_usbhs: Add Renesas USBHS Gadget")

Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
---
v2: No change
v1: https://patchwork.kernel.org/patch/10581479/

 drivers/usb/renesas_usbhs/mod.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/renesas_usbhs/mod.c b/drivers/usb/renesas_usbhs/mod.c
index 7475c4f64724..87e08b1512ad 100644
--- a/drivers/usb/renesas_usbhs/mod.c
+++ b/drivers/usb/renesas_usbhs/mod.c
@@ -349,10 +349,6 @@ void usbhs_irq_callback_update(struct usbhs_priv *priv, struct usbhs_mod *mod)
 	 *	usbhs_interrupt
 	 */
 
-	/*
-	 * it don't enable DVSE (intenb0) here
-	 * but "mod->irq_dev_state" will be called.
-	 */
 	if (info->irq_vbus)
 		intenb0 |= VBSE;
 
@@ -363,6 +359,9 @@ void usbhs_irq_callback_update(struct usbhs_priv *priv, struct usbhs_mod *mod)
 		if (mod->irq_ctrl_stage)
 			intenb0 |= CTRE;
 
+		if (mod->irq_dev_state)
+			intenb0 |= DVSE;
+
 		if (mod->irq_empty && mod->irq_bempsts) {
 			usbhs_write(priv, BEMPENB, mod->irq_bempsts);
 			intenb0 |= BEMPE;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-11-18 10:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-06 12:03 [PATCH v2 1/3] usb: renesas_usbhs: enable DVSE interrupt Veeraiyan Chidambaram
2019-09-06 12:03 ` [PATCH v2 2/3] usb: renesas_usbhs: simplify usbhs_status_get_device_state() Veeraiyan Chidambaram
2019-09-06 12:03 ` [PATCH v2 3/3] usb: renesas_usbhs: add suspend event support in gadget mode Veeraiyan Chidambaram
2019-09-09  7:05   ` Yoshihiro Shimoda
2019-09-09  7:02 ` [PATCH v2 1/3] usb: renesas_usbhs: enable DVSE interrupt Yoshihiro Shimoda
2019-09-09  9:55   ` Greg Kroah-Hartman
2019-09-09 11:04     ` veeraiyan chidambaram
2019-09-09 13:05 ` Eugeniu Rosca
2019-09-09 16:01   ` veeraiyan chidambaram
2019-11-18 10:24   ` Eugeniu Rosca

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).