From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Wed, 28 Sep 2011 20:26:56 +0200 Subject: [U-Boot] [PATCH v8 4/4] Add USB support for Efika In-Reply-To: References: <1317222327-18367-1-git-send-email-fermata7@gmail.com> <1317223213.3682.2.camel@konomi> Message-ID: <201109282026.56876.marek.vasut@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Wednesday, September 28, 2011 08:12:08 PM Jana Rapava wrote: > 2011/9/28 Marek Vasut > > > > + 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