From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Mon, 26 Sep 2011 22:51:21 +0200 Subject: [U-Boot] [PATCH v4 4/4] Add USB support for Efika In-Reply-To: References: <1316312368-13006-1-git-send-email-fermata7@gmail.com> <201109251934.00630.marek.vasut@gmail.com> Message-ID: <201109262251.21875.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 Monday, September 26, 2011 10:28:17 PM Jana Rapava wrote: > > > + while (--timeout) { > > > + tmp = readl(&ehci->ulpi_viewpoint); > > > + if (!(tmp & ulpi_bit)) > > > + break; > > > + WATCHDOG_RESET(); > > > + } > > > + if (!timeout) { > > > + printf("ULPI %s timed out\n", operation); > > > + return 0; > > > + } > > > + return tmp; > > > +} > > > + > > > +void ulpi_write(u8 *reg, u32 value, struct usb_ehci *ehci) > > > > ulpi_write(ehci, reg, value), please fix globally and in similar > > functions. > > > > Also, change u8 *reg to u8 reg, why are you passing a pointer? > > Is it really important in ulpi_read/write function to use u8 reg instead of > u8 *reg? > When I rewrite this, usb reset starts giving me ULPI operations timeout, > and I couldn't find a source of that. > The problem is in the middle of usb_new_device, but it looks like no > function calling ULPI operations is called from that function. Actually I think this is the problem: writel(ULPI_RWRUN | (u32)reg << ULPI_ADDR_SHIFT, &ehci->ulpi_viewpoint); You cast the u8 * to u32, making the whole first argument of writel() an u32. Whereas in the other case, when passing u8, the first argument stays u8 and the result is truncated. > > Regards, > Jana Rapava