[U-Boot] [PATCH] usb: r8a66597: convert wait loop to readw_poll_timeout

Fabio Estevam festevam at gmail.com
Wed Nov 29 19:41:36 UTC 2017


On Wed, Nov 29, 2017 at 5:37 PM, Chris Brandt <chris.brandt at renesas.com> wrote:
> @@ -308,13 +308,10 @@ static int send_setup_packet(struct r8a66597 *r8a66597, struct usb_device *dev,
>  #if defined(CONFIG_RZA_USB)
>         dcpctr = r8a66597_read(r8a66597, DCPCTR);
>         if ((dcpctr & PID) == PID_BUF) {
> -               timeout2 = 10000;
> -               while (!(dcpctr & BSTS)) {
> -                       dcpctr = r8a66597_read(r8a66597, DCPCTR);
> -                       if (timeout2-- < 0) {
> -                               printf("DCPCTR clear timeout!\n");
> -                               break;
> -                       }
> +               if (readw_poll_timeout(r8a66597->reg + DCPCTR, dcpctr,
> +                                      dcpctr & BSTS, 1000) < 0) {
> +                       printf("DCPCTR BSTS timeout!\n");
> +                       return -1;

What about returning -ETIMEDOUT instead?


More information about the U-Boot mailing list