All of lore.kernel.org
 help / color / mirror / Atom feed
From: Artur Petrosyan <Arthur.Petrosyan@synopsys.com>
To: Felipe Balbi <balbi@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Cc: John Youn <John.Youn@synopsys.com>,
	Artur Petrosyan <Arthur.Petrosyan@synopsys.com>
Subject: [v1,11/14] usb: dwc2: Allow exiting hibernation from gpwrdn rst detect
Date: Fri, 19 Apr 2019 11:25:19 +0000	[thread overview]
Message-ID: <ded6b0a301fc61c2f49ced519aff34fa87ac5759.1555672441.git.arturp@synopsys.com> (raw)

When device cable is disconnected core receives suspend
interrupt and enters hibernation. After entering
into hibernation GPWRDN_RST_DET and GPWRDN_STS_CHGINT
interrupts are asserted.

From cable disconnection we need to exit from hibernation
either by GPWRDN_RST_DET or GPWRDN_STS_CHGINT. If we exit
from hibernation by GPWRDN_STS_CHGINT, DEVADDR will not be
reset. But we need to exit gadget hibernation properly
with resetting the DEVADDR as reset accrued.

- Allowed exit from gadget hibernation from
  GPWRDN_RST_DET by checking only linestate.
- Setting hsotg->lx_state = DWC2_L0 in dwc2_hsotg_irq
  GINTSTS_RESETDET flow without checking if lx_state == DWC2_L2

Signed-off-by: Artur Petrosyan <arturp@synopsys.com>
---
 drivers/usb/dwc2/core_intr.c | 2 +-
 drivers/usb/dwc2/gadget.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
2.11.0

diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c
index 40d296d9b6fb..cb827a5e1bfb 100644
--- a/drivers/usb/dwc2/core_intr.c
+++ b/drivers/usb/dwc2/core_intr.c
@@ -771,7 +771,7 @@ static void dwc2_handle_gpwrdn_intr(struct dwc2_hsotg *hsotg)
 
 	if ((gpwrdn & GPWRDN_RST_DET) && (gpwrdn & GPWRDN_RST_DET_MSK)) {
 		dev_dbg(hsotg->dev, "%s: GPWRDN_RST_DET\n", __func__);
-		if (!linestate && (gpwrdn & GPWRDN_BSESSVLD))
+		if (!linestate)
 			dwc2_exit_hibernation(hsotg, 0, 1, 0);
 	}
 
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 8c3e1f1c1b0f..b35c966d4f63 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3637,8 +3637,8 @@ static irqreturn_t dwc2_hsotg_irq(int irq, void *pw)
 		/* This event must be used only if controller is suspended */
 		if (hsotg->lx_state == DWC2_L2) {
 			dwc2_exit_partial_power_down(hsotg, true);
-			hsotg->lx_state = DWC2_L0;
 		}
+		hsotg->lx_state = DWC2_L0;
 	}
 
 	if (gintsts & (GINTSTS_USBRST | GINTSTS_RESETDET)) {

WARNING: multiple messages have this Message-ID (diff)
From: Artur Petrosyan <Arthur.Petrosyan@synopsys.com>
To: Felipe Balbi <balbi@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Cc: John Youn <John.Youn@synopsys.com>,
	Artur Petrosyan <Arthur.Petrosyan@synopsys.com>
Subject: [PATCH v1 11/14] usb: dwc2: Allow exiting hibernation from gpwrdn rst detect
Date: Fri, 19 Apr 2019 11:25:19 +0000	[thread overview]
Message-ID: <ded6b0a301fc61c2f49ced519aff34fa87ac5759.1555672441.git.arturp@synopsys.com> (raw)
Message-ID: <20190419112519.fBHPCgbLFLneIy4QNS0gJHOfIdIc8J1KxZ4HAd6eoi8@z> (raw)
In-Reply-To: <cover.1555672441.git.arturp@synopsys.com>

When device cable is disconnected core receives suspend
interrupt and enters hibernation. After entering
into hibernation GPWRDN_RST_DET and GPWRDN_STS_CHGINT
interrupts are asserted.

From cable disconnection we need to exit from hibernation
either by GPWRDN_RST_DET or GPWRDN_STS_CHGINT. If we exit
from hibernation by GPWRDN_STS_CHGINT, DEVADDR will not be
reset. But we need to exit gadget hibernation properly
with resetting the DEVADDR as reset accrued.

- Allowed exit from gadget hibernation from
  GPWRDN_RST_DET by checking only linestate.
- Setting hsotg->lx_state = DWC2_L0 in dwc2_hsotg_irq
  GINTSTS_RESETDET flow without checking if lx_state == DWC2_L2

Signed-off-by: Artur Petrosyan <arturp@synopsys.com>
---
 drivers/usb/dwc2/core_intr.c | 2 +-
 drivers/usb/dwc2/gadget.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c
index 40d296d9b6fb..cb827a5e1bfb 100644
--- a/drivers/usb/dwc2/core_intr.c
+++ b/drivers/usb/dwc2/core_intr.c
@@ -771,7 +771,7 @@ static void dwc2_handle_gpwrdn_intr(struct dwc2_hsotg *hsotg)
 
 	if ((gpwrdn & GPWRDN_RST_DET) && (gpwrdn & GPWRDN_RST_DET_MSK)) {
 		dev_dbg(hsotg->dev, "%s: GPWRDN_RST_DET\n", __func__);
-		if (!linestate && (gpwrdn & GPWRDN_BSESSVLD))
+		if (!linestate)
 			dwc2_exit_hibernation(hsotg, 0, 1, 0);
 	}
 
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 8c3e1f1c1b0f..b35c966d4f63 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3637,8 +3637,8 @@ static irqreturn_t dwc2_hsotg_irq(int irq, void *pw)
 		/* This event must be used only if controller is suspended */
 		if (hsotg->lx_state == DWC2_L2) {
 			dwc2_exit_partial_power_down(hsotg, true);
-			hsotg->lx_state = DWC2_L0;
 		}
+		hsotg->lx_state = DWC2_L0;
 	}
 
 	if (gintsts & (GINTSTS_USBRST | GINTSTS_RESETDET)) {
-- 
2.11.0


             reply	other threads:[~2019-04-19 11:25 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-19 11:25 Artur Petrosyan [this message]
2019-04-19 11:25 ` [PATCH v1 11/14] usb: dwc2: Allow exiting hibernation from gpwrdn rst detect Artur Petrosyan
  -- strict thread matches above, loose matches on Subject: below --
2019-05-03  8:13 [v1,04/14] usb: dwc2: Fix suspend state in host mode for partial power down Artur Petrosyan
2019-05-03  8:13 ` [PATCH v1 04/14] " Artur Petrosyan
2019-05-03  7:58 [v1,08/14] usb: dwc2: Add default param to control power optimization Artur Petrosyan
2019-05-03  7:58 ` [PATCH v1 08/14] " Artur Petrosyan
2019-05-01  1:54 [v1,04/14] usb: dwc2: Fix suspend state in host mode for partial power down Doug Anderson
2019-05-01  1:54 ` [PATCH v1 04/14] " Doug Anderson
2019-04-30 15:23 [v1,08/14] usb: dwc2: Add default param to control power optimization Doug Anderson
2019-04-30 15:23 ` [PATCH v1 08/14] " Doug Anderson
2019-04-30 13:06 [v1,14/14] usb: dwc2: Add enter/exit hibernation from system issued suspend/resume Artur Petrosyan
2019-04-30 13:06 ` [PATCH v1 14/14] " Artur Petrosyan
2019-04-30 12:45 [v1,08/14] usb: dwc2: Add default param to control power optimization Artur Petrosyan
2019-04-30 12:45 ` [PATCH v1 08/14] " Artur Petrosyan
2019-04-30  7:10 [v1,04/14] usb: dwc2: Fix suspend state in host mode for partial power down Artur Petrosyan
2019-04-30  7:10 ` [PATCH v1 04/14] " Artur Petrosyan
2019-04-29 17:42 [v1,14/14] usb: dwc2: Add enter/exit hibernation from system issued suspend/resume Doug Anderson
2019-04-29 17:42 ` [PATCH v1 14/14] " Doug Anderson
2019-04-29 17:40 [v1,08/14] usb: dwc2: Add default param to control power optimization Doug Anderson
2019-04-29 17:40 ` [PATCH v1 08/14] " Doug Anderson
2019-04-29 17:35 [v1,04/14] usb: dwc2: Fix suspend state in host mode for partial power down Doug Anderson
2019-04-29 17:35 ` [PATCH v1 04/14] " Doug Anderson
2019-04-29 12:01 [v1,14/14] usb: dwc2: Add enter/exit hibernation from system issued suspend/resume Artur Petrosyan
2019-04-29 12:01 ` [PATCH v1 14/14] " Artur Petrosyan
2019-04-29 11:35 [v1,09/14] usb: dwc2: Update dwc2_handle_usb_suspend_intr function Artur Petrosyan
2019-04-29 11:35 ` [PATCH v1 09/14] " Artur Petrosyan
2019-04-29 11:29 [v1,08/14] usb: dwc2: Add default param to control power optimization Artur Petrosyan
2019-04-29 11:29 ` [PATCH v1 08/14] " Artur Petrosyan
2019-04-29 11:03 [v1,04/14] usb: dwc2: Fix suspend state in host mode for partial power down Artur Petrosyan
2019-04-29 11:03 ` [PATCH v1 04/14] " Artur Petrosyan
2019-04-29 10:54 [v1,03/14] usb: dwc2: Fix wakeup detected and session request interrupt handlers Artur Petrosyan
2019-04-29 10:54 ` [PATCH v1 03/14] " Artur Petrosyan
2019-04-26 21:00 [v1,14/14] usb: dwc2: Add enter/exit hibernation from system issued suspend/resume Doug Anderson
2019-04-26 21:00 ` [PATCH v1 14/14] " Doug Anderson
2019-04-26 20:51 [v1,12/14] usb: dwc2: Clear fifo_map when resetting core Doug Anderson
2019-04-26 20:51 ` [PATCH v1 12/14] " Doug Anderson
2019-04-26 20:51 [v1,09/14] usb: dwc2: Update dwc2_handle_usb_suspend_intr function Doug Anderson
2019-04-26 20:51 ` [PATCH v1 09/14] " Doug Anderson
2019-04-26 20:46 [v1,08/14] usb: dwc2: Add default param to control power optimization Doug Anderson
2019-04-26 20:46 ` [PATCH v1 08/14] " Doug Anderson
2019-04-26 20:45 [v1,06/14] usb: dwc2: Add part. power down exit from dwc2_conn_id_status_change() Doug Anderson
2019-04-26 20:45 ` [PATCH v1 06/14] " Doug Anderson
2019-04-26 20:45 [v1,05/14] usb: dwc2: Add port conn. sts. checking in _dwc2_hcd_resume() function Doug Anderson
2019-04-26 20:45 ` [PATCH v1 05/14] " Doug Anderson
2019-04-26 20:44 [v1,04/14] usb: dwc2: Fix suspend state in host mode for partial power down Doug Anderson
2019-04-26 20:44 ` [PATCH v1 04/14] " Doug Anderson
2019-04-26 20:44 [v1,03/14] usb: dwc2: Fix wakeup detected and session request interrupt handlers Doug Anderson
2019-04-26 20:44 ` [PATCH v1 03/14] " Doug Anderson
2019-04-19 11:25 [v1,14/14] usb: dwc2: Add enter/exit hibernation from system issued suspend/resume Artur Petrosyan
2019-04-19 11:25 ` [PATCH v1 14/14] " Artur Petrosyan
2019-04-19 11:25 [v1,13/14] usb: dwc2: Clear GINTSTS_RESTOREDONE bit after restore is generated Artur Petrosyan
2019-04-19 11:25 ` [PATCH v1 13/14] " Artur Petrosyan
2019-04-19 11:25 [v1,12/14] usb: dwc2: Clear fifo_map when resetting core Artur Petrosyan
2019-04-19 11:25 ` [PATCH v1 12/14] " Artur Petrosyan
2019-04-19 11:25 [v1,10/14] usb: dwc2: Fix hibernation between host and device modes Artur Petrosyan
2019-04-19 11:25 ` [PATCH v1 10/14] " Artur Petrosyan
2019-04-19 11:24 [v1,09/14] usb: dwc2: Update dwc2_handle_usb_suspend_intr function Artur Petrosyan
2019-04-19 11:24 ` [PATCH v1 09/14] " Artur Petrosyan
2019-04-19 11:24 [v1,08/14] usb: dwc2: Add default param to control power optimization Artur Petrosyan
2019-04-19 11:24 ` [PATCH v1 08/14] " Artur Petrosyan
2019-04-19 11:24 [v1,07/14] usb: dwc2: Reset DEVADDR after exiting gadget hibernation Artur Petrosyan
2019-04-19 11:24 ` [PATCH v1 07/14] " Artur Petrosyan
2019-04-19 11:24 [v1,06/14] usb: dwc2: Add part. power down exit from dwc2_conn_id_status_change() Artur Petrosyan
2019-04-19 11:24 ` [PATCH v1 06/14] " Artur Petrosyan
2019-04-19 11:24 [v1,05/14] usb: dwc2: Add port conn. sts. checking in _dwc2_hcd_resume() function Artur Petrosyan
2019-04-19 11:24 ` [PATCH v1 05/14] " Artur Petrosyan
2019-04-19 11:24 [v1,04/14] usb: dwc2: Fix suspend state in host mode for partial power down Artur Petrosyan
2019-04-19 11:24 ` [PATCH v1 04/14] " Artur Petrosyan
2019-04-19 11:23 [v1,03/14] usb: dwc2: Fix wakeup detected and session request interrupt handlers Artur Petrosyan
2019-04-19 11:23 ` [PATCH v1 03/14] " Artur Petrosyan
2019-04-19 11:23 [v1,02/14] usb: dwc2: Add descriptive debug messages for Partial Power Down mode Artur Petrosyan
2019-04-19 11:23 ` [PATCH v1 02/14] " Artur Petrosyan
2019-04-19 11:23 [v1,01/14] usb: dwc2: Fix dwc2_restore_device_registers() function Artur Petrosyan
2019-04-19 11:23 ` [PATCH v1 01/14] " Artur Petrosyan
2019-04-19 11:23 [PATCH v1 00/14] usb: dwc2: Fix and improve power saving modes Artur Petrosyan
2019-04-25 12:43 ` Felipe Balbi
2019-04-25 14:00   ` Artur Petrosyan
2019-04-25 20:12     ` Doug Anderson
2019-04-26  7:10       ` Artur Petrosyan
2019-04-26 16:01         ` Doug Anderson
2019-04-26 21:06           ` Doug Anderson
2019-04-29 12:05             ` Artur Petrosyan
2019-04-29 17:43               ` Doug Anderson
2019-04-29  8:44           ` Artur Petrosyan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ded6b0a301fc61c2f49ced519aff34fa87ac5759.1555672441.git.arturp@synopsys.com \
    --to=arthur.petrosyan@synopsys.com \
    --cc=John.Youn@synopsys.com \
    --cc=Minas.Harutyunyan@synopsys.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.