This is a note to let you know that I've just added the patch titled usb: musb: Change to direct addr in context save/restore to my gregkh-2.6 tree which can be found in directory form at: http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/ and in git form at: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/patches.git The filename of this patch is: usb-musb-change-to-direct-addr-in-context-save-restore.patch The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.) If this patch meets the merge guidelines for a bugfix, it should be merged into Linus's tree before the next major kernel release. If not, it will be merged into Linus's tree during the next merge window. Either way, you will probably be copied on the patch when it gets sent to Linus for merging so that others can see what is happening in kernel development. If you have any questions about this process, please let me know. >From balbi@xxxxxx Tue Oct 5 13:29:35 2010 From: Felipe Balbi <balbi@xxxxxx> To: Greg KH <greg@xxxxxxxxx> Cc: Linux USB Mailing List <linux-usb@xxxxxxxxxxxxxxx>, Bob Liu <lliubbo@xxxxxxxxx>, Felipe Balbi <balbi@xxxxxx> Subject: usb: musb: Change to direct addr in context save/restore Date: Fri, 24 Sep 2010 13:44:07 +0300 Message-Id: <1285325055-1247-7-git-send-email-balbi@xxxxxx> From: Bob Liu <lliubbo@xxxxxxxxx> Since not all platforms are using the same offset 0x10 in musb_save/restore_context() eg Blackfin the offset is 0x40, Change the indexed address to direct. Signed-off-by: Bob Liu <lliubbo@xxxxxxxxx> Signed-off-by: Felipe Balbi <balbi@xxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx> --- drivers/usb/musb/musb_core.c | 46 ++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 24 deletions(-) --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2266,6 +2266,7 @@ void musb_save_context(struct musb *musb { int i; void __iomem *musb_base = musb->mregs; + void __iomem *epio; if (is_host_enabled(musb)) { musb_context.frame = musb_readw(musb_base, MUSB_FRAME); @@ -2279,16 +2280,16 @@ void musb_save_context(struct musb *musb musb_context.index = musb_readb(musb_base, MUSB_INDEX); musb_context.devctl = musb_readb(musb_base, MUSB_DEVCTL); - for (i = 0; i < MUSB_C_NUM_EPS; ++i) { - musb_writeb(musb_base, MUSB_INDEX, i); + for (i = 0; i < musb->config->num_eps; ++i) { + epio = musb->endpoints[i].regs; musb_context.index_regs[i].txmaxp = - musb_readw(musb_base, 0x10 + MUSB_TXMAXP); + musb_readw(epio, MUSB_TXMAXP); musb_context.index_regs[i].txcsr = - musb_readw(musb_base, 0x10 + MUSB_TXCSR); + musb_readw(epio, MUSB_TXCSR); musb_context.index_regs[i].rxmaxp = - musb_readw(musb_base, 0x10 + MUSB_RXMAXP); + musb_readw(epio, MUSB_RXMAXP); musb_context.index_regs[i].rxcsr = - musb_readw(musb_base, 0x10 + MUSB_RXCSR); + musb_readw(epio, MUSB_RXCSR); if (musb->dyn_fifo) { musb_context.index_regs[i].txfifoadd = @@ -2302,13 +2303,13 @@ void musb_save_context(struct musb *musb } if (is_host_enabled(musb)) { musb_context.index_regs[i].txtype = - musb_readb(musb_base, 0x10 + MUSB_TXTYPE); + musb_readb(epio, MUSB_TXTYPE); musb_context.index_regs[i].txinterval = - musb_readb(musb_base, 0x10 + MUSB_TXINTERVAL); + musb_readb(epio, MUSB_TXINTERVAL); musb_context.index_regs[i].rxtype = - musb_readb(musb_base, 0x10 + MUSB_RXTYPE); + musb_readb(epio, MUSB_RXTYPE); musb_context.index_regs[i].rxinterval = - musb_readb(musb_base, 0x10 + MUSB_RXINTERVAL); + musb_readb(epio, MUSB_RXINTERVAL); musb_context.index_regs[i].txfunaddr = musb_read_txfunaddr(musb_base, i); @@ -2326,8 +2327,6 @@ void musb_save_context(struct musb *musb } } - musb_writeb(musb_base, MUSB_INDEX, musb_context.index); - musb_platform_save_context(musb, &musb_context); } @@ -2336,6 +2335,7 @@ void musb_restore_context(struct musb *m int i; void __iomem *musb_base = musb->mregs; void __iomem *ep_target_regs; + void __iomem *epio; musb_platform_restore_context(musb, &musb_context); @@ -2350,15 +2350,15 @@ void musb_restore_context(struct musb *m musb_writeb(musb_base, MUSB_INTRUSBE, musb_context.intrusbe); musb_writeb(musb_base, MUSB_DEVCTL, musb_context.devctl); - for (i = 0; i < MUSB_C_NUM_EPS; ++i) { - musb_writeb(musb_base, MUSB_INDEX, i); - musb_writew(musb_base, 0x10 + MUSB_TXMAXP, + for (i = 0; i < musb->config->num_eps; ++i) { + epio = musb->endpoints[i].regs; + musb_writew(epio, MUSB_TXMAXP, musb_context.index_regs[i].txmaxp); - musb_writew(musb_base, 0x10 + MUSB_TXCSR, + musb_writew(epio, MUSB_TXCSR, musb_context.index_regs[i].txcsr); - musb_writew(musb_base, 0x10 + MUSB_RXMAXP, + musb_writew(epio, MUSB_RXMAXP, musb_context.index_regs[i].rxmaxp); - musb_writew(musb_base, 0x10 + MUSB_RXCSR, + musb_writew(epio, MUSB_RXCSR, musb_context.index_regs[i].rxcsr); if (musb->dyn_fifo) { @@ -2373,13 +2373,13 @@ void musb_restore_context(struct musb *m } if (is_host_enabled(musb)) { - musb_writeb(musb_base, 0x10 + MUSB_TXTYPE, + musb_writeb(epio, MUSB_TXTYPE, musb_context.index_regs[i].txtype); - musb_writeb(musb_base, 0x10 + MUSB_TXINTERVAL, + musb_writeb(epio, MUSB_TXINTERVAL, musb_context.index_regs[i].txinterval); - musb_writeb(musb_base, 0x10 + MUSB_RXTYPE, + musb_writeb(epio, MUSB_RXTYPE, musb_context.index_regs[i].rxtype); - musb_writeb(musb_base, 0x10 + MUSB_RXINTERVAL, + musb_writeb(epio, MUSB_RXINTERVAL, musb_context.index_regs[i].rxinterval); musb_write_txfunaddr(musb_base, i, @@ -2400,8 +2400,6 @@ void musb_restore_context(struct musb *m musb_context.index_regs[i].rxhubport); } } - - musb_writeb(musb_base, MUSB_INDEX, musb_context.index); } static int musb_suspend(struct device *dev) -- 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