提交 e1eb3eb8 编写于 作者: F Felipe Balbi

usb: musb: core: refactor IRQ enable/disable to separate functions

sometimes we want to just mask/unmask interrupts
without touching devctl register. For those
cases, let's introduce musb_enable_interrupts and
musb_disable_interrupts()
Tested-by: NBin Liu <b-liu@ti.com>
Signed-off-by: NFelipe Balbi <balbi@ti.com>
上级 3709ffca
...@@ -507,7 +507,9 @@ void musb_hnp_stop(struct musb *musb) ...@@ -507,7 +507,9 @@ void musb_hnp_stop(struct musb *musb)
musb->port1_status &= ~(USB_PORT_STAT_C_CONNECTION << 16); musb->port1_status &= ~(USB_PORT_STAT_C_CONNECTION << 16);
} }
static void musb_disable_interrupts(struct musb *musb);
static void musb_generic_disable(struct musb *musb); static void musb_generic_disable(struct musb *musb);
/* /*
* Interrupt Service Routine to record USB "global" interrupts. * Interrupt Service Routine to record USB "global" interrupts.
* Since these do not happen often and signify things of * Since these do not happen often and signify things of
...@@ -977,7 +979,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, ...@@ -977,7 +979,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static void musb_generic_disable(struct musb *musb) static void musb_disable_interrupts(struct musb *musb)
{ {
void __iomem *mbase = musb->mregs; void __iomem *mbase = musb->mregs;
u16 temp; u16 temp;
...@@ -989,16 +991,35 @@ static void musb_generic_disable(struct musb *musb) ...@@ -989,16 +991,35 @@ static void musb_generic_disable(struct musb *musb)
musb->intrrxe = 0; musb->intrrxe = 0;
musb_writew(mbase, MUSB_INTRRXE, 0); musb_writew(mbase, MUSB_INTRRXE, 0);
/* off */
musb_writeb(mbase, MUSB_DEVCTL, 0);
/* flush pending interrupts */ /* flush pending interrupts */
temp = musb_readb(mbase, MUSB_INTRUSB); temp = musb_readb(mbase, MUSB_INTRUSB);
temp = musb_readw(mbase, MUSB_INTRTX); temp = musb_readw(mbase, MUSB_INTRTX);
temp = musb_readw(mbase, MUSB_INTRRX); temp = musb_readw(mbase, MUSB_INTRRX);
}
static void musb_enable_interrupts(struct musb *musb)
{
void __iomem *regs = musb->mregs;
/* 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);
} }
static void musb_generic_disable(struct musb *musb)
{
void __iomem *mbase = musb->mregs;
musb_disable_interrupts(musb);
/* off */
musb_writeb(mbase, MUSB_DEVCTL, 0);
}
/* /*
* Program the HDRC to start (enable interrupts, dma, etc.). * Program the HDRC to start (enable interrupts, dma, etc.).
*/ */
...@@ -1009,13 +1030,7 @@ void musb_start(struct musb *musb) ...@@ -1009,13 +1030,7 @@ void musb_start(struct musb *musb)
dev_dbg(musb->controller, "<== devctl %02x\n", devctl); dev_dbg(musb->controller, "<== devctl %02x\n", devctl);
/* Set INT enable registers, enable interrupts */ musb_enable_interrupts(musb);
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); musb_writeb(regs, MUSB_TESTMODE, 0);
/* put into basic highspeed mode and start session */ /* put into basic highspeed mode and start session */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册