From: Nicolas Ferre <nicolas.ferre@microchip.com> To: Claudiu Beznea <claudiu.beznea@microchip.com>, <stern@rowland.harvard.edu>, <gregkh@linuxfoundation.org>, <alexandre.belloni@bootlin.com>, <ludovic.desroches@microchip.com>, <cristian.birsan@microchip.com> Cc: <linux-usb@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org> Subject: Re: [PATCH] usb: host: ohci-at91: suspend/resume ports after/before OHCI accesses Date: Wed, 9 Jun 2021 14:40:19 +0200 [thread overview] Message-ID: <21280c02-0dd2-461a-1baf-464f280d2f0e@microchip.com> (raw) In-Reply-To: <20210609121027.70951-1-claudiu.beznea@microchip.com> On 09/06/2021 at 14:10, Claudiu Beznea wrote: > On SAMA7G5 suspending ports will cut the access to OHCI registers and > any subsequent access to them will lead to CPU being blocked trying to > access that memory. Same thing happens on resume: if OHCI memory is > accessed before resuming ports the CPU will block on that access. The > OCHI memory is accessed on suspend/resume though > ohci_suspend()/ohci_resume(). > > Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Claudiu, Your patch look good to me. In addition, I see ohci_at91_port_suspend() function also used in ohci_at91_hub_control(). It might suffer the same problem as I see accesses to ohci register, at first glance. Can you please double check that we are not in such condition with calls to ohci_at91_hub_control()? Best regards, Nicolas > --- > > The patch was tested on SAMA7G5, SAMA5D2 and SAM9X60. > > Thank you, > Claudiu Beznea > > drivers/usb/host/ohci-at91.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c > index b3a6a497dcb1..7c6202b05ff4 100644 > --- a/drivers/usb/host/ohci-at91.c > +++ b/drivers/usb/host/ohci-at91.c > @@ -666,8 +666,6 @@ ohci_hcd_at91_drv_suspend(struct device *dev) > if (ohci_at91->wakeup) > enable_irq_wake(hcd->irq); > > - ohci_at91_port_suspend(ohci_at91, 1); > - > ret = ohci_suspend(hcd, ohci_at91->wakeup); > if (ret) { > if (ohci_at91->wakeup) > @@ -687,7 +685,10 @@ ohci_hcd_at91_drv_suspend(struct device *dev) > /* flush the writes */ > (void) ohci_readl (ohci, &ohci->regs->control); > msleep(1); > + ohci_at91_port_suspend(ohci_at91, 1); > at91_stop_clock(ohci_at91); > + } else { > + ohci_at91_port_suspend(ohci_at91, 1); > } > > return ret; > @@ -699,6 +700,8 @@ ohci_hcd_at91_drv_resume(struct device *dev) > struct usb_hcd *hcd = dev_get_drvdata(dev); > struct ohci_at91_priv *ohci_at91 = hcd_to_ohci_at91_priv(hcd); > > + ohci_at91_port_suspend(ohci_at91, 0); > + > if (ohci_at91->wakeup) > disable_irq_wake(hcd->irq); > else > @@ -706,8 +709,6 @@ ohci_hcd_at91_drv_resume(struct device *dev) > > ohci_resume(hcd, false); > > - ohci_at91_port_suspend(ohci_at91, 0); > - > return 0; > } > > -- Nicolas Ferre
WARNING: multiple messages have this Message-ID (diff)
From: Nicolas Ferre <nicolas.ferre@microchip.com> To: Claudiu Beznea <claudiu.beznea@microchip.com>, <stern@rowland.harvard.edu>, <gregkh@linuxfoundation.org>, <alexandre.belloni@bootlin.com>, <ludovic.desroches@microchip.com>, <cristian.birsan@microchip.com> Cc: <linux-usb@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-kernel@vger.kernel.org> Subject: Re: [PATCH] usb: host: ohci-at91: suspend/resume ports after/before OHCI accesses Date: Wed, 9 Jun 2021 14:40:19 +0200 [thread overview] Message-ID: <21280c02-0dd2-461a-1baf-464f280d2f0e@microchip.com> (raw) In-Reply-To: <20210609121027.70951-1-claudiu.beznea@microchip.com> On 09/06/2021 at 14:10, Claudiu Beznea wrote: > On SAMA7G5 suspending ports will cut the access to OHCI registers and > any subsequent access to them will lead to CPU being blocked trying to > access that memory. Same thing happens on resume: if OHCI memory is > accessed before resuming ports the CPU will block on that access. The > OCHI memory is accessed on suspend/resume though > ohci_suspend()/ohci_resume(). > > Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Claudiu, Your patch look good to me. In addition, I see ohci_at91_port_suspend() function also used in ohci_at91_hub_control(). It might suffer the same problem as I see accesses to ohci register, at first glance. Can you please double check that we are not in such condition with calls to ohci_at91_hub_control()? Best regards, Nicolas > --- > > The patch was tested on SAMA7G5, SAMA5D2 and SAM9X60. > > Thank you, > Claudiu Beznea > > drivers/usb/host/ohci-at91.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c > index b3a6a497dcb1..7c6202b05ff4 100644 > --- a/drivers/usb/host/ohci-at91.c > +++ b/drivers/usb/host/ohci-at91.c > @@ -666,8 +666,6 @@ ohci_hcd_at91_drv_suspend(struct device *dev) > if (ohci_at91->wakeup) > enable_irq_wake(hcd->irq); > > - ohci_at91_port_suspend(ohci_at91, 1); > - > ret = ohci_suspend(hcd, ohci_at91->wakeup); > if (ret) { > if (ohci_at91->wakeup) > @@ -687,7 +685,10 @@ ohci_hcd_at91_drv_suspend(struct device *dev) > /* flush the writes */ > (void) ohci_readl (ohci, &ohci->regs->control); > msleep(1); > + ohci_at91_port_suspend(ohci_at91, 1); > at91_stop_clock(ohci_at91); > + } else { > + ohci_at91_port_suspend(ohci_at91, 1); > } > > return ret; > @@ -699,6 +700,8 @@ ohci_hcd_at91_drv_resume(struct device *dev) > struct usb_hcd *hcd = dev_get_drvdata(dev); > struct ohci_at91_priv *ohci_at91 = hcd_to_ohci_at91_priv(hcd); > > + ohci_at91_port_suspend(ohci_at91, 0); > + > if (ohci_at91->wakeup) > disable_irq_wake(hcd->irq); > else > @@ -706,8 +709,6 @@ ohci_hcd_at91_drv_resume(struct device *dev) > > ohci_resume(hcd, false); > > - ohci_at91_port_suspend(ohci_at91, 0); > - > return 0; > } > > -- Nicolas Ferre _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-06-09 12:40 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-06-09 12:10 [PATCH] usb: host: ohci-at91: suspend/resume ports after/before OHCI accesses Claudiu Beznea 2021-06-09 12:10 ` Claudiu Beznea 2021-06-09 12:40 ` Nicolas Ferre [this message] 2021-06-09 12:40 ` Nicolas Ferre 2021-06-09 23:07 ` Alan Stern 2021-06-09 23:07 ` Alan Stern 2021-06-23 12:47 ` Claudiu.Beznea 2021-06-23 12:47 ` Claudiu.Beznea 2021-06-23 13:59 ` Alan Stern 2021-06-23 13:59 ` Alan Stern 2021-06-23 14:09 ` Claudiu.Beznea 2021-06-23 14:09 ` Claudiu.Beznea 2021-06-23 14:19 ` Alan Stern 2021-06-23 14:19 ` Alan Stern 2021-06-23 14:33 ` Claudiu.Beznea 2021-06-23 14:33 ` Claudiu.Beznea 2021-06-23 16:41 ` Alan Stern 2021-06-23 16:41 ` Alan Stern 2021-06-24 6:40 ` Claudiu.Beznea 2021-06-24 6:40 ` Claudiu.Beznea 2021-06-24 6:54 ` Claudiu.Beznea 2021-06-24 6:54 ` Claudiu.Beznea 2021-06-24 13:23 ` Alan Stern 2021-06-24 13:23 ` Alan Stern 2021-06-30 14:46 ` Claudiu.Beznea 2021-06-30 14:46 ` Claudiu.Beznea 2021-06-30 18:21 ` Alan Stern 2021-06-30 18:21 ` Alan Stern 2021-07-01 5:45 ` Claudiu.Beznea 2021-07-01 5:45 ` Claudiu.Beznea 2021-07-01 14:01 ` Alan Stern 2021-07-01 14:01 ` Alan Stern 2021-06-30 14:47 ` Claudiu.Beznea 2021-06-30 14:47 ` Claudiu.Beznea 2021-07-21 8:08 ` Greg KH 2021-07-21 8:08 ` Greg KH
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=21280c02-0dd2-461a-1baf-464f280d2f0e@microchip.com \ --to=nicolas.ferre@microchip.com \ --cc=alexandre.belloni@bootlin.com \ --cc=claudiu.beznea@microchip.com \ --cc=cristian.birsan@microchip.com \ --cc=gregkh@linuxfoundation.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-usb@vger.kernel.org \ --cc=ludovic.desroches@microchip.com \ --cc=stern@rowland.harvard.edu \ /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: linkBe 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.