From a125babc76b10266523ff03f28381c39e4edf3a7 Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Tue, 5 Sep 2006 17:13:34 +0300 Subject: [PATCH] MUSB: Fix TUSB register access 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 --- drivers/usb/musb/musbdefs.h | 4 ++++ drivers/usb/musb/musbhdrc.h | 3 +-- drivers/usb/musb/plat_uds.c | 4 ++++ drivers/usb/musb/tusb6010.c | 4 ++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/usb/musb/musbdefs.h b/drivers/usb/musb/musbdefs.h index ee8a81b15c8..6962be49e69 100644 --- a/drivers/usb/musb/musbdefs.h +++ b/drivers/usb/musb/musbdefs.h @@ -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; diff --git a/drivers/usb/musb/musbhdrc.h b/drivers/usb/musb/musbhdrc.h index 95f38e5afb5..188a7f07541 100644 --- a/drivers/usb/musb/musbhdrc.h +++ b/drivers/usb/musb/musbhdrc.h @@ -108,8 +108,7 @@ #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 diff --git a/drivers/usb/musb/plat_uds.c b/drivers/usb/musb/plat_uds.c index f7bb6e64736..62c215cb11c 100644 --- a/drivers/usb/musb/plat_uds.c +++ b/drivers/usb/musb/plat_uds.c @@ -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; diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index d2e2ba9159c..f912b906e1a 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c @@ -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; -- 2.41.1