Re: [PATCH 2/6] USB: musb: pm: change to direct addrs with endpoint registers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Oct 23, 2010 at 6:11 PM, Mike Frysinger <vapier@xxxxxxxxxx> wrote:
> From: Bob Liu <lliubbo@xxxxxxxxx>
>
> Rather than relying on a cpu-specific register offset between the base
> of the musb registers and the endpoints, leverage the existing musb
> structures to find the endpoint register base. ÂThis makes the code
> work across processors including Blackfin parts.
>
> Signed-off-by: Bob Liu <lliubbo@xxxxxxxxx>
> Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>
> ---
> Âdrivers/usb/musb/musb_core.c | Â 46 ++++++++++++++++++++---------------------
> Â1 files changed, 22 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
> index 540c766..d4f18bb 100644
> --- 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 *musb)
> Â Â Â Â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 *musb)
> Â Â Â Â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 *musb)
> Â Â Â Â Â Â Â Â}
>
> Â Â Â Â Â Â Â Â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 *musb)
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âmusb_context.index_regs[i].rxhubport);
> Â Â Â Â Â Â Â Â}
> Â Â Â Â}
> -
> - Â Â Â musb_writeb(musb_base, MUSB_INDEX, musb_context.index);
> Â}
>
> Âstatic int musb_suspend(struct device *dev)
> --

Hi, Mike
This patch has been added to general code.

-- 
Thanks
--Bob
ÿô.nlj·Ÿ®‰­†+%ŠË±é¥Šwÿº{.nlj·¥Š{±þë)íèjg¬±¨¶‰šŽŠÝjÿ¾«þG«é¸¢·¦j:+v‰¨Šwèm¶Ÿÿþø®w¥þŠà£¢·hšâÿ†Ù



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux