[PATCH v2 05/11] usb: musb: move musb_start to musb_virthub.c
This function has its only user in musb_virthub.c, so let's move it there and make it static. Signed-off-by: Daniel Mack --- drivers/usb/musb/musb_core.c| 45 - drivers/usb/musb/musb_core.h| 1 - drivers/usb/musb/musb_virthub.c | 44 3 files changed, 44 insertions(+), 46 deletions(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 13341c6..adf069d 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -905,51 +905,6 @@ b_host: /*-*/ -/* -* Program the HDRC to start (enable interrupts, dma, etc.). -*/ -void musb_start(struct musb *musb) -{ - void __iomem*regs = musb->mregs; - u8 devctl = musb_readb(regs, MUSB_DEVCTL); - - dev_dbg(musb->controller, "<== devctl %02x\n", devctl); - - /* Set INT enable registers, enable interrupts */ - musb->intrtxe = musb->epmask; - musb_writew(regs, MUSB_INTRTXE, musb->intrtxe); - musb->intrrxe = musb->epmask & 0xfffe; - musb_writew(regs, MUSB_INTRRXE, musb->intrrxe); - musb_writeb(regs, MUSB_INTRUSBE, 0xf7); - - musb_writeb(regs, MUSB_TESTMODE, 0); - - /* put into basic highspeed mode and start session */ - musb_writeb(regs, MUSB_POWER, MUSB_POWER_ISOUPDATE - | MUSB_POWER_HSENAB - /* ENSUSPEND wedges tusb */ - /* | MUSB_POWER_ENSUSPEND */ - ); - - musb->is_active = 0; - devctl = musb_readb(regs, MUSB_DEVCTL); - devctl &= ~MUSB_DEVCTL_SESSION; - - /* session started after: -* (a) ID-grounded irq, host mode; -* (b) vbus present/connect IRQ, peripheral mode; -* (c) peripheral initiates, using SRP -*/ - if ((devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS) - musb->is_active = 1; - else - devctl |= MUSB_DEVCTL_SESSION; - - musb_platform_enable(musb); - musb_writeb(regs, MUSB_DEVCTL, devctl); -} - - static void musb_generic_disable(struct musb *musb) { void __iomem*mbase = musb->mregs; diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 04d8974..87da041 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -503,7 +503,6 @@ static inline void musb_configure_ep0(struct musb *musb) extern const char musb_driver_name[]; -extern void musb_start(struct musb *musb); extern void musb_stop(struct musb *musb); extern void musb_write_fifo(struct musb_hw_ep *ep, u16 len, const u8 *src); diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c index ef7d110..1e17c20 100644 --- a/drivers/usb/musb/musb_virthub.c +++ b/drivers/usb/musb/musb_virthub.c @@ -44,6 +44,50 @@ #include "musb_core.h" +/* +* Program the HDRC to start (enable interrupts, dma, etc.). +*/ +static void musb_start(struct musb *musb) +{ + void __iomem*regs = musb->mregs; + u8 devctl = musb_readb(regs, MUSB_DEVCTL); + + dev_dbg(musb->controller, "<== devctl %02x\n", devctl); + + /* Set INT enable registers, enable interrupts */ + musb->intrtxe = musb->epmask; + musb_writew(regs, MUSB_INTRTXE, musb->intrtxe); + musb->intrrxe = musb->epmask & 0xfffe; + musb_writew(regs, MUSB_INTRRXE, musb->intrrxe); + musb_writeb(regs, MUSB_INTRUSBE, 0xf7); + + musb_writeb(regs, MUSB_TESTMODE, 0); + + /* put into basic highspeed mode and start session */ + musb_writeb(regs, MUSB_POWER, MUSB_POWER_ISOUPDATE + | MUSB_POWER_HSENAB + /* ENSUSPEND wedges tusb */ + /* | MUSB_POWER_ENSUSPEND */ + ); + + musb->is_active = 0; + devctl = musb_readb(regs, MUSB_DEVCTL); + devctl &= ~MUSB_DEVCTL_SESSION; + + /* session started after: +* (a) ID-grounded irq, host mode; +* (b) vbus present/connect IRQ, peripheral mode; +* (c) peripheral initiates, using SRP +*/ + if ((devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS) { + musb->is_active = 1; + } else { + devctl |= MUSB_DEVCTL_SESSION; + } + + musb_platform_enable(musb); + musb_writeb(regs, MUSB_DEVCTL, devctl); +} static void musb_port_suspend(struct musb *musb, bool do_suspend) { -- 1.8.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 05/11] usb: musb: move musb_start to musb_virthub.c
> "Daniel" == Daniel Mack writes: Daniel> This function has its only user in musb_virthub.c, so let's move it Daniel> there and make it static. Daniel> Signed-off-by: Daniel Mack Acked-by: Peter Korsgaard Daniel> --- Daniel> drivers/usb/musb/musb_core.c| 45 - Daniel> drivers/usb/musb/musb_core.h| 1 - Daniel> drivers/usb/musb/musb_virthub.c | 44 Daniel> 3 files changed, 44 insertions(+), 46 deletions(-) Daniel> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c Daniel> index 13341c6..adf069d 100644 Daniel> --- a/drivers/usb/musb/musb_core.c Daniel> +++ b/drivers/usb/musb/musb_core.c Daniel> @@ -905,51 +905,6 @@ b_host: Daniel> /*-*/ Daniel> -/* Daniel> -* Program the HDRC to start (enable interrupts, dma, etc.). Daniel> -*/ Daniel> -void musb_start(struct musb *musb) Daniel> -{ Daniel> - void __iomem*regs = musb->mregs; Daniel> - u8 devctl = musb_readb(regs, MUSB_DEVCTL); Daniel> - Daniel> - dev_dbg(musb->controller, "<== devctl %02x\n", devctl); Daniel> - Daniel> - /* Set INT enable registers, enable interrupts */ Daniel> - musb->intrtxe = musb->epmask; Daniel> - musb_writew(regs, MUSB_INTRTXE, musb->intrtxe); Daniel> - musb->intrrxe = musb->epmask & 0xfffe; Daniel> - musb_writew(regs, MUSB_INTRRXE, musb->intrrxe); Daniel> - musb_writeb(regs, MUSB_INTRUSBE, 0xf7); Daniel> - Daniel> - musb_writeb(regs, MUSB_TESTMODE, 0); Daniel> - Daniel> - /* put into basic highspeed mode and start session */ Daniel> - musb_writeb(regs, MUSB_POWER, MUSB_POWER_ISOUPDATE Daniel> - | MUSB_POWER_HSENAB Daniel> - /* ENSUSPEND wedges tusb */ Daniel> - /* | MUSB_POWER_ENSUSPEND */ Daniel> - ); Daniel> - Daniel> - musb->is_active = 0; Daniel> - devctl = musb_readb(regs, MUSB_DEVCTL); Daniel> - devctl &= ~MUSB_DEVCTL_SESSION; Daniel> - Daniel> - /* session started after: Daniel> - * (a) ID-grounded irq, host mode; Daniel> - * (b) vbus present/connect IRQ, peripheral mode; Daniel> - * (c) peripheral initiates, using SRP Daniel> - */ Daniel> - if ((devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS) Daniel> - musb->is_active = 1; Daniel> - else Daniel> - devctl |= MUSB_DEVCTL_SESSION; Daniel> - Daniel> - musb_platform_enable(musb); Daniel> - musb_writeb(regs, MUSB_DEVCTL, devctl); Daniel> -} Daniel> - Daniel> - Daniel> static void musb_generic_disable(struct musb *musb) Daniel> { Daniel>void __iomem*mbase = musb->mregs; Daniel> diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h Daniel> index 04d8974..87da041 100644 Daniel> --- a/drivers/usb/musb/musb_core.h Daniel> +++ b/drivers/usb/musb/musb_core.h Daniel> @@ -503,7 +503,6 @@ static inline void musb_configure_ep0(struct musb *musb) Daniel> extern const char musb_driver_name[]; Daniel> -extern void musb_start(struct musb *musb); Daniel> extern void musb_stop(struct musb *musb); Daniel> extern void musb_write_fifo(struct musb_hw_ep *ep, u16 len, const u8 *src); Daniel> diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c Daniel> index ef7d110..1e17c20 100644 Daniel> --- a/drivers/usb/musb/musb_virthub.c Daniel> +++ b/drivers/usb/musb/musb_virthub.c Daniel> @@ -44,6 +44,50 @@ Daniel> #include "musb_core.h" Daniel> +/* Daniel> +* Program the HDRC to start (enable interrupts, dma, etc.). Daniel> +*/ Daniel> +static void musb_start(struct musb *musb) Daniel> +{ Daniel> + void __iomem*regs = musb->mregs; Daniel> + u8 devctl = musb_readb(regs, MUSB_DEVCTL); Daniel> + Daniel> + dev_dbg(musb->controller, "<== devctl %02x\n", devctl); Daniel> + Daniel> + /* Set INT enable registers, enable interrupts */ Daniel> + musb->intrtxe = musb->epmask; Daniel> + musb_writew(regs, MUSB_INTRTXE, musb->intrtxe); Daniel> + musb->intrrxe = musb->epmask & 0xfffe; Daniel> + musb_writew(regs, MUSB_INTRRXE, musb->intrrxe); Daniel> + musb_writeb(regs, MUSB_INTRUSBE, 0xf7); Daniel> + Daniel> + musb_writeb(regs, MUSB_TESTMODE, 0); Daniel> + Daniel> + /* put into basic highspeed mode and start session */ Daniel> + musb_writeb(regs, MUSB_POWER, MUSB_POWER_ISOUPDATE Daniel> + | MUSB_POWER_HSENAB Daniel> + /* ENSUSPEND wedges tusb */ Daniel> + /* | MUSB_POWER_ENSUSPEND */ Daniel> +