Re: [PATCH] usb: cdnsp: fix wakeup from S3 after controller context loss
Peter Chen <[email protected]>
| Newsgroups | org.kernel.vger.linux-usb,org.kernel.vger.linux-kernel,org.kernel.vger.stable |
|---|---|
| Message-ID | <[email protected]> |
On 26-07-23 13:28:27, Pawel Laszczak via B4 Relay wrote: > From: Pawel Laszczak <[email protected]> > Hi Pawel, I have already left nxp six years ago, please change my email as [email protected]. > CDNSP controller loses its runtime register programming across S3 > suspend/resume. It is not always true, it depends on SoC implementation. For some SoCs (like CIX P1), the controller power still exists when the system at S3. > After resume the operational and interrupter registers > may contain reset values, which prevents the gadget side from recovering > correctly and breaks wakeup from S3. > > Fix this by reprogramming the controller state required for normal > operation after resume, including the command ring, DCBAA pointer, > doorbell base, event ring, ERST base/size and event ring dequeue > pointer. > > Move the basic controller register programming out of the one-time memory > initialization path and make it reusable from the resume path. Also > separate ring allocation from ring initialization so that rings can be > reinitialized without reallocating DMA memory. > > This fixes S3 resume on systems where the controller register context is > lost while keeping the existing DMA allocations intact. With your fix, does device mode wakeup still work, does affect the SoC like I mentioned CIX P1 which keeps power at S3? > @@ -1575,9 +1576,13 @@ irqreturn_t cdnsp_thread_irq_handler(int irq, void *data) > irqreturn_t cdnsp_irq_handler(int irq, void *priv) > { > struct cdnsp_device *pdev = (struct cdnsp_device *)priv; > + struct cdns *cdns = dev_get_drvdata(pdev->dev); > u32 irq_pending; > u32 status; > > + if (cdns->in_lpm) > + return IRQ_NONE; > + If the interrupt happens before cdns->in_lpm is clear, there will be no one handles interrupt issue. -- Thanks, Peter Chen