linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: musb: mediatek: add reset FADDR to zero in reset interrupt handle
@ 2020-05-14  4:01 Macpaul Lin
  2020-05-14  7:33 ` Min Guo
  0 siblings, 1 reply; 3+ messages in thread
From: Macpaul Lin @ 2020-05-14  4:01 UTC (permalink / raw)
  To: Min Guo, Chunfeng Yun, Hans de Goede, Bin Liu,
	Greg Kroah-Hartman, Matthias Brugger, linux-usb, linux-kernel,
	linux-arm-kernel, linux-mediatek
  Cc: Mediatek WSD Upstream, Macpaul Lin, Macpaul Lin

When receiving reset interrupt, FADDR need to be reset to zero in
periphearl mode. Otherwise ep0 cannot do enumeration when re-pluging USB
cable.

Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
---
 drivers/usb/musb/mediatek.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/musb/mediatek.c b/drivers/usb/musb/mediatek.c
index 6196b0e..eebeadd 100644
--- a/drivers/usb/musb/mediatek.c
+++ b/drivers/usb/musb/mediatek.c
@@ -208,6 +208,12 @@ static irqreturn_t generic_interrupt(int irq, void *__hci)
 	musb->int_rx = musb_clearw(musb->mregs, MUSB_INTRRX);
 	musb->int_tx = musb_clearw(musb->mregs, MUSB_INTRTX);
 
+	if ((musb->int_usb & MUSB_INTR_RESET) && !is_host_active(musb)) {
+		/* ep0 FADDR must be 0 when (re)entering peripheral mode */
+		musb_ep_select(musb->mregs, 0);
+		musb_writeb(musb->mregs, MUSB_FADDR, 0);
+	}
+
 	if (musb->int_usb || musb->int_tx || musb->int_rx)
 		retval = musb_interrupt(musb);
 
-- 
1.7.9.5

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

* Re: [PATCH] usb: musb: mediatek: add reset FADDR to zero in reset interrupt handle
  2020-05-14  4:01 [PATCH] usb: musb: mediatek: add reset FADDR to zero in reset interrupt handle Macpaul Lin
@ 2020-05-14  7:33 ` Min Guo
  2020-05-20  2:44   ` Bin Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Min Guo @ 2020-05-14  7:33 UTC (permalink / raw)
  To: Macpaul Lin
  Cc: Chunfeng Yun, Hans de Goede, Bin Liu, Greg Kroah-Hartman,
	Matthias Brugger, linux-usb, linux-kernel, linux-arm-kernel,
	linux-mediatek, Mediatek WSD Upstream, Macpaul Lin

On Thu, 2020-05-14 at 12:01 +0800, Macpaul Lin wrote:
> When receiving reset interrupt, FADDR need to be reset to zero in
> periphearl mode. Otherwise ep0 cannot do enumeration when re-pluging USB
> cable.
> 
> Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
> ---
>  drivers/usb/musb/mediatek.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/usb/musb/mediatek.c b/drivers/usb/musb/mediatek.c
> index 6196b0e..eebeadd 100644
> --- a/drivers/usb/musb/mediatek.c
> +++ b/drivers/usb/musb/mediatek.c
> @@ -208,6 +208,12 @@ static irqreturn_t generic_interrupt(int irq, void *__hci)
>  	musb->int_rx = musb_clearw(musb->mregs, MUSB_INTRRX);
>  	musb->int_tx = musb_clearw(musb->mregs, MUSB_INTRTX);
>  
> +	if ((musb->int_usb & MUSB_INTR_RESET) && !is_host_active(musb)) {
> +		/* ep0 FADDR must be 0 when (re)entering peripheral mode */
> +		musb_ep_select(musb->mregs, 0);
> +		musb_writeb(musb->mregs, MUSB_FADDR, 0);
> +	}
> +
>  	if (musb->int_usb || musb->int_tx || musb->int_rx)
>  		retval = musb_interrupt(musb);
>  

Acked-by:Min Guo <min.guo@mediatek.com>


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

* Re: [PATCH] usb: musb: mediatek: add reset FADDR to zero in reset interrupt handle
  2020-05-14  7:33 ` Min Guo
@ 2020-05-20  2:44   ` Bin Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Bin Liu @ 2020-05-20  2:44 UTC (permalink / raw)
  To: Min Guo
  Cc: Macpaul Lin, Chunfeng Yun, Hans de Goede, Greg Kroah-Hartman,
	Matthias Brugger, linux-usb, linux-kernel, linux-arm-kernel,
	linux-mediatek, Mediatek WSD Upstream, Macpaul Lin

On Thu, May 14, 2020 at 03:33:25PM +0800, Min Guo wrote:
> On Thu, 2020-05-14 at 12:01 +0800, Macpaul Lin wrote:
> > When receiving reset interrupt, FADDR need to be reset to zero in
> > periphearl mode. Otherwise ep0 cannot do enumeration when re-pluging USB
> > cable.
> > 
> > Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
> > ---
> >  drivers/usb/musb/mediatek.c |    6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/drivers/usb/musb/mediatek.c b/drivers/usb/musb/mediatek.c
> > index 6196b0e..eebeadd 100644
> > --- a/drivers/usb/musb/mediatek.c
> > +++ b/drivers/usb/musb/mediatek.c
> > @@ -208,6 +208,12 @@ static irqreturn_t generic_interrupt(int irq, void *__hci)
> >  	musb->int_rx = musb_clearw(musb->mregs, MUSB_INTRRX);
> >  	musb->int_tx = musb_clearw(musb->mregs, MUSB_INTRTX);
> >  
> > +	if ((musb->int_usb & MUSB_INTR_RESET) && !is_host_active(musb)) {
> > +		/* ep0 FADDR must be 0 when (re)entering peripheral mode */
> > +		musb_ep_select(musb->mregs, 0);
> > +		musb_writeb(musb->mregs, MUSB_FADDR, 0);
> > +	}
> > +
> >  	if (musb->int_usb || musb->int_tx || musb->int_rx)
> >  		retval = musb_interrupt(musb);
> >  
> 
> Acked-by:Min Guo <min.guo@mediatek.com>
> 

Queued for v5.8. Thanks.

-Bin.

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

end of thread, other threads:[~2020-05-20  2:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14  4:01 [PATCH] usb: musb: mediatek: add reset FADDR to zero in reset interrupt handle Macpaul Lin
2020-05-14  7:33 ` Min Guo
2020-05-20  2:44   ` Bin Liu

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).