Hello.
Daniel Mack wrote:
diff --git a/arch/arm/plat-mxc/include/mach/ulpi.h b/arch/arm/plat-mxc/include/mach/ulpi.h
new file mode 100644
index 0000000..96b6ab4
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/ulpi.h
@@ -0,0 +1,7 @@
+#ifndef __MACH_ULPI_H
+#define __MACH_ULPI_H
+
+extern struct otg_io_access_ops mxc_ulpi_access_ops;
Why this is needed at all?
Hmm, don't understand the question :) This is the ops struct exported by
this implementation and used by board support code to feed
otg_ulpi_create(). This is how it should be, right?
Perhaps a single declaration wasn't worth creating a header for though...
+static int ulpi_read(struct otg_transceiver *otg, u32 reg)
+{
+ int ret;
+ void __iomem *view = otg->io_priv;
+
+ /* make sure interface is running */
+ if (!(__raw_readl(view) && ULPIVW_SS)) {
+ __raw_writel(ULPIVW_WU, view);
+
+ /* wait for wakeup */
+ ret = ulpi_poll(view, ULPIVW_WU);
+ if (ret < 0)
+ return ret;
+ }
+
+ /* read the register */
+ __raw_writel((ULPIVW_RUN | (reg << ULPIVW_ADDR_SHIFT)), view);
+
+ /* wait for completion */
+ return ulpi_poll(view, ULPIVW_RUN);
... and read the register again here (I don't think the read data
disappers after the first read :-).
Yes, and other places that also use ulpi_poll() look cleaner now. Done.
New patch below, that for the feedback!
Daniel
From cea4ce8bf4a0b8e71c39e2819b799e87a86eae5c Mon Sep 17 00:00:00 2001
From: Daniel Mack <daniel@xxxxxxxx>
Date: Thu, 25 Jun 2009 13:27:40 +0200
Subject: [PATCH] MXC: Add support for ULPI Viewports
The ARC USB OTG Core has support for accessing ULPI tranceivers
through so called ULPI viewports. Export a set of function for use with
the USB OTG framework.
Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
Signed-off-by: Daniel Mack <daniel@xxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxx>
Cc: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx>
Cc: linux-usb@xxxxxxxxxxxxxxx
[...]
diff --git a/arch/arm/plat-mxc/ulpi.c b/arch/arm/plat-mxc/ulpi.c
new file mode 100644
index 0000000..7b97ab8
--- /dev/null
+++ b/arch/arm/plat-mxc/ulpi.c
@@ -0,0 +1,115 @@
[...]
+static int ulpi_poll(void __iomem *view, u32 bit)
+{
+ uint32_t data;
+ int timeout = 10000;
+
+ data = __raw_readl(view);
+ while (data & bit) {
+ if (!timeout--) {
+ printk(KERN_WARNING
+ "timeout polling for ULPI device\n");
+ return -ETIMEDOUT;
+ }
+
+ cpu_relax();
+ data = __raw_readl(view);
+ }
I'd have done the loop and its exit condition the other way, to only
call __raw_readl() once... oh well.
WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html