[U-Boot] [PATCH v8 4/4] Add USB support for Efika

Marek Vasut
2011-09-28T18:26:56Z

On Wednesday, September 28, 2011 08:12:08 PM Jana Rapava wrote:
> 2011/9/28 Marek Vasut <marek.vasut.n900@gmail.com>
>
> > > + if (!timeout)
> > > + return -1;
> > > + else
> > > + return tmp;
> > > +}
> >
> > Won't 'return !timeout;' be enough?
> >
> > > + tmp = ulpi_wait(ehci, ULPI_RWRUN);
> >
> > + if (tmp == -1) {
> > + printf("ULPI read timed out\n");
> > + return 0;
> > + }
> > + return ulpi_read_mask(tmp);
> > +}
>
> Here in ulpi_read() I need to store and return value which was read in
> ulpi_wait(). What is the proper way to do this, If ulpi_wait() should
> return !timeout ?

You can read again ... it's more systematic. Anyway ... use the approach below,
it seems better.

>
> > Also, can you change 'ulpi_bit' to 'ulpi_mask'? That seems more
> > appropriate.
> >
> > Maybe this can be even changed to ulpi_wait(ehci, value_to_be_written,
> > bit_to_be_polled), then you won't need those writel()s before every write
> > to ulpi anymore.
>
> Ok.
>
> > cheers