From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Thu, 29 Sep 2011 01:59:05 +0200 Subject: [U-Boot] [PATCH 4/4] usb: add USB support for Efika In-Reply-To: <1317253971-24558-5-git-send-email-fermata7@gmail.com> References: <1317253971-24558-1-git-send-email-fermata7@gmail.com> <1317253971-24558-5-git-send-email-fermata7@gmail.com> Message-ID: <201109290159.06113.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 Thursday, September 29, 2011 01:52:51 AM Jana Rapava wrote: > This commit adds USB support for EfikaMX and EfikaSB. > > Signed-off-by: Jana Rapava > Signed-off-by: Marek Vasut > Cc: Remy Bohmer > Cc: Stefano Babic > --- > board/efikamx/Makefile | 3 + > board/efikamx/efika.h | 30 +++ > board/efikamx/efikamx-usb.c | 420 > +++++++++++++++++++++++++++++++++++++++++++ board/efikamx/efikamx.c | > 3 + > include/configs/efikamx.h | 16 ++ > 5 files changed, 472 insertions(+), 0 deletions(-) > create mode 100644 board/efikamx/efika.h > create mode 100644 board/efikamx/efikamx-usb.c [...] > > + > +int ulpi_wakeup(struct usb_ehci *ehci) > +{ > + if (readl(&ehci->ulpi_viewpoint) & ULPI_SS) > + return 0; /* already awake */ > + return ulpi_wait(ehci, ULPI_WU, ULPI_WU); > +} > + > +void ulpi_write(struct usb_ehci *ehci, u32 reg, u32 value) > +{ > + if (ulpi_wakeup(ehci)) { > + printf("ULPI wakeup timed out\n"); > + return; > + } > + > + if (ulpi_wait(ehci, ULPI_RWRUN | ULPI_RWCTRL | > + reg << ULPI_ADDR_SHIFT | ulpi_write_mask(value), ULPI_RWRUN)) > + printf("ULPI write timed out\n"); Please use temp. variable here and fix indent. > +} > + > +u32 ulpi_read(struct usb_ehci *ehci, u32 reg) > +{ > + if (ulpi_wakeup(ehci)) { > + printf("ULPI wakeup timed out\n"); > + return 0; > + } > + > + if (ulpi_wait(ehci, ULPI_RWRUN | reg << ULPI_ADDR_SHIFT, ULPI_RWRUN)) { > + printf("ULPI read timed out\n"); > + return 0; > + } Newline > + return ulpi_read_mask(readl(&ehci->ulpi_viewpoint)); > +}