MUSB: Fix TUSB register access
authorTony Lindgren <tony@atomide.com>
Tue, 5 Sep 2006 14:13:34 +0000 (17:13 +0300)
committerTony Lindgren <tony@atomide.com>
Tue, 5 Sep 2006 14:13:34 +0000 (17:13 +0300)
TUSB uses non-flat register model, and also has TUSB specific
ep registers in addition to shared MUSB ep registers.

Signed-off-by: Tony Lindgren <tony@atomide.com>
drivers/usb/musb/musbdefs.h
drivers/usb/musb/musbhdrc.h
drivers/usb/musb/plat_uds.c
drivers/usb/musb/tusb6010.c

index ee8a81b..6962be4 100644 (file)
@@ -329,6 +329,10 @@ struct musb_hw_ep {
        void __iomem            *fifo;
        void __iomem            *regs;
 
+#ifdef CONFIG_USB_TUSB6010
+       void __iomem            *conf;
+#endif
+
        /* index in musb->aLocalEnd[]  */
        u8                      bLocalEnd;
 
index 95f38e5..188a7f0 100644 (file)
 #ifdef CONFIG_USB_TUSB6010
 /* TUSB6010 EP0 configuration register is special */
 #define MGC_TUSB_OFFSET(_bEnd, _bOffset)       \
-       (_bEnd ? (0x400 + (((_bEnd - 1) & 0xf) << 2) + (_bOffset)) :    \
-               ((_bEnd - 0x400) + TUSB_EP0_CONF + (_bOffset)))
+       (0x10 + _bOffset)
 #include "tusb6010.h"          /* needed "only" for TUSB_EP0_CONF */
 #endif
 
index f7bb6e6..62c215c 100644 (file)
@@ -1127,6 +1127,10 @@ static int __devinit musb_core_init(u16 wType, struct musb *pThis)
 #ifdef CONFIG_USB_TUSB6010
                hw_ep->fifo_async = pThis->async + 0x400 + MUSB_FIFO_OFFSET(i);
                hw_ep->fifo_sync = pThis->sync + 0x400 + MUSB_FIFO_OFFSET(i);
+               if (i == 0)
+                       hw_ep->conf = pBase - 0x400 + TUSB_EP0_CONF;
+               else
+                       hw_ep->conf = pBase + 0x400 + (((i - 1) & 0xf) << 2);
 #endif
 
                hw_ep->regs = MGC_END_OFFSET(i, 0) + pBase;
index d2e2ba9..f912b90 100644 (file)
@@ -34,7 +34,7 @@
 
 void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *buf)
 {
-       void __iomem    *ep_conf = hw_ep->regs;
+       void __iomem    *ep_conf = hw_ep->conf;
        void __iomem    *fifo = hw_ep->fifo;
        u8              epnum = hw_ep->bLocalEnd;
        u8              *bufp = (u8 *)buf;
@@ -90,7 +90,7 @@ void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *buf)
 
 void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *buf)
 {
-       void __iomem    *ep_conf = hw_ep->regs;
+       void __iomem    *ep_conf = hw_ep->conf;
        void __iomem    *fifo = hw_ep->fifo;
        u8              epnum = hw_ep->bLocalEnd;
        u8              *bufp = (u8 *)buf;