RE: [PATCH] usb: chipidea: udc: fix setup_status condition in isr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 
> > The isr is going to check for a status phase on the indexed endpoint.
> > Input endpoints have no status bits and can be skipped for that test.
> >
> > Signed-off-by: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx>
> > ---
> > This patch is based on the change mentioned by Matthieu CASTET,
> > but moves the check before using hw_test_and_clear_setup_status.
> >
> >  drivers/usb/chipidea/udc.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
> > index 69d20fb..9364184 100644
> > --- a/drivers/usb/chipidea/udc.c
> > +++ b/drivers/usb/chipidea/udc.c
> > @@ -989,6 +989,7 @@ __acquires(ci->lock)
> >  		}
> >
> >  		if (hwep->type != USB_ENDPOINT_XFER_CONTROL ||
> > +		    (i >= ci->hw_ep_max / 2) ||
> >  		    !hw_test_and_clear_setup_status(ci, i))
> >  			continue;
> >
> > --
> 
> Hi Michael,
> 
> I can't accept this patch, it more likes a workaround for current broken
> code.
> In fact, we only handle ep0out (setup packet) for below code, please try
> below
> simple fix.
> 
> diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
> index c318e66..b86ef9a 100644
> --- a/drivers/usb/chipidea/udc.c
> +++ b/drivers/usb/chipidea/udc.c
> @@ -997,15 +997,10 @@ __acquires(ci->lock)
>                         }
>                 }
> 
> -               if (hwep->type != USB_ENDPOINT_XFER_CONTROL ||
> -                   !hw_test_and_clear_setup_status(ci, i))
> +               /* Only handle setup packet below */
> +               if (i != 0)
>                         continue;
> 
> -               if (i != 0) {
> -                       dev_warn(ci->dev, "ctrl traffic at endpoint %d\n",
> i);
> -                       continue;
> -               }
> -
>                 /*
>                  * Flush data and handshake transactions of previous
>                  * setup packet.
> 

Sorry, it should clear ENDPTSETUPSTAT for ep0 before handling setup packet. 

I have tested mass storage and g_serial, below patch should ok.
Anyway, it is a temp solution before we re-work interrupt handler for
data packet.

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index c318e66..5905e85 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -997,15 +997,9 @@ __acquires(ci->lock)
                        }
                }
 
-               if (hwep->type != USB_ENDPOINT_XFER_CONTROL ||
-                   !hw_test_and_clear_setup_status(ci, i))
+               if (i != 0 || !hw_test_and_clear(ci, OP_ENDPTSETUPSTAT, BIT(0)))
                        continue;
 
-               if (i != 0) {
-                       dev_warn(ci->dev, "ctrl traffic at endpoint %d\n", i);
-                       continue;
-               }
-
                /*
                 * Flush data and handshake transactions of previous
                 * setup packet.

Peter
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux