We currently only have functions to read/modify registers. Add a
function to write registers.

Signed-off-by: Sascha Hauer <[email protected]>
---
 drivers/usb/otg/ulpi.c |   17 +++++++++++++++++
 include/usb/ulpi.h     |    1 +
 2 files changed, 18 insertions(+)

diff --git a/drivers/usb/otg/ulpi.c b/drivers/usb/otg/ulpi.c
index 61cbada..badb05b 100644
--- a/drivers/usb/otg/ulpi.c
+++ b/drivers/usb/otg/ulpi.c
@@ -111,6 +111,23 @@ int ulpi_clear(u8 bits, int reg, void __iomem *view)
 }
 EXPORT_SYMBOL(ulpi_clear);
 
+int ulpi_write(u8 bits, int reg, void __iomem *view)
+{
+       int ret;
+
+       writel((ULPIVW_RUN | ULPIVW_WRITE |
+                     (reg << ULPIVW_ADDR_SHIFT) |
+                     ((bits & ULPIVW_WDATA_MASK) << ULPIVW_WDATA_SHIFT)),
+                    view);
+
+       /* wait for completion */
+       ret = ulpi_poll(view, ULPIVW_RUN);
+       if (ret < 0)
+               return ret;
+       return 0;
+}
+EXPORT_SYMBOL(ulpi_write);
+
 struct ulpi_info {
        uint32_t        id;
        char            *name;
diff --git a/include/usb/ulpi.h b/include/usb/ulpi.h
index 542993c..7c868a5 100644
--- a/include/usb/ulpi.h
+++ b/include/usb/ulpi.h
@@ -1,6 +1,7 @@
 #ifndef __MACH_ULPI_H
 #define __MACH_ULPI_H
 
+int ulpi_write(u8 bits, int reg, void __iomem *view);
 int ulpi_set(u8 bits, int reg, void __iomem *view);
 int ulpi_clear(u8 bits, int reg, void __iomem *view);
 int ulpi_read(int reg, void __iomem *view);
-- 
1.7.10.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to