aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2015-02-26 12:26:09 -0500
committerFelipe Balbi <balbi@ti.com>2015-03-10 16:33:27 -0400
commite1eb3eb8b02c5be35ea1fedccc6c9c6d2c9b0165 (patch)
tree929da249b31e804e7c4f3a777207d194fb12dce0 /drivers/usb/musb
parent3709ffca6485bd1b03b1fe2d9eb384dcf5db87a6 (diff)
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: Bin Liu <b-liu@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r--drivers/usb/musb/musb_core.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index b86e975cba2b..8ae24266f1a8 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -507,7 +507,9 @@ void musb_hnp_stop(struct musb *musb)
507 musb->port1_status &= ~(USB_PORT_STAT_C_CONNECTION << 16); 507 musb->port1_status &= ~(USB_PORT_STAT_C_CONNECTION << 16);
508} 508}
509 509
510static void musb_disable_interrupts(struct musb *musb);
510static void musb_generic_disable(struct musb *musb); 511static void musb_generic_disable(struct musb *musb);
512
511/* 513/*
512 * Interrupt Service Routine to record USB "global" interrupts. 514 * Interrupt Service Routine to record USB "global" interrupts.
513 * Since these do not happen often and signify things of 515 * Since these do not happen often and signify things of
@@ -977,7 +979,7 @@ b_host:
977 979
978/*-------------------------------------------------------------------------*/ 980/*-------------------------------------------------------------------------*/
979 981
980static void musb_generic_disable(struct musb *musb) 982static void musb_disable_interrupts(struct musb *musb)
981{ 983{
982 void __iomem *mbase = musb->mregs; 984 void __iomem *mbase = musb->mregs;
983 u16 temp; 985 u16 temp;
@@ -989,16 +991,35 @@ static void musb_generic_disable(struct musb *musb)
989 musb->intrrxe = 0; 991 musb->intrrxe = 0;
990 musb_writew(mbase, MUSB_INTRRXE, 0); 992 musb_writew(mbase, MUSB_INTRRXE, 0);
991 993
992 /* off */
993 musb_writeb(mbase, MUSB_DEVCTL, 0);
994
995 /* flush pending interrupts */ 994 /* flush pending interrupts */
996 temp = musb_readb(mbase, MUSB_INTRUSB); 995 temp = musb_readb(mbase, MUSB_INTRUSB);
997 temp = musb_readw(mbase, MUSB_INTRTX); 996 temp = musb_readw(mbase, MUSB_INTRTX);
998 temp = musb_readw(mbase, MUSB_INTRRX); 997 temp = musb_readw(mbase, MUSB_INTRRX);
998}
999
1000static void musb_enable_interrupts(struct musb *musb)
1001{
1002 void __iomem *regs = musb->mregs;
1003
1004 /* Set INT enable registers, enable interrupts */
1005 musb->intrtxe = musb->epmask;
1006 musb_writew(regs, MUSB_INTRTXE, musb->intrtxe);
1007 musb->intrrxe = musb->epmask & 0xfffe;
1008 musb_writew(regs, MUSB_INTRRXE, musb->intrrxe);
1009 musb_writeb(regs, MUSB_INTRUSBE, 0xf7);
999 1010
1000} 1011}
1001 1012
1013static void musb_generic_disable(struct musb *musb)
1014{
1015 void __iomem *mbase = musb->mregs;
1016
1017 musb_disable_interrupts(musb);
1018
1019 /* off */
1020 musb_writeb(mbase, MUSB_DEVCTL, 0);
1021}
1022
1002/* 1023/*
1003 * Program the HDRC to start (enable interrupts, dma, etc.). 1024 * Program the HDRC to start (enable interrupts, dma, etc.).
1004 */ 1025 */
@@ -1009,13 +1030,7 @@ void musb_start(struct musb *musb)
1009 1030
1010 dev_dbg(musb->controller, "<== devctl %02x\n", devctl); 1031 dev_dbg(musb->controller, "<== devctl %02x\n", devctl);
1011 1032
1012 /* Set INT enable registers, enable interrupts */ 1033 musb_enable_interrupts(musb);
1013 musb->intrtxe = musb->epmask;
1014 musb_writew(regs, MUSB_INTRTXE, musb->intrtxe);
1015 musb->intrrxe = musb->epmask & 0xfffe;
1016 musb_writew(regs, MUSB_INTRRXE, musb->intrrxe);
1017 musb_writeb(regs, MUSB_INTRUSBE, 0xf7);
1018
1019 musb_writeb(regs, MUSB_TESTMODE, 0); 1034 musb_writeb(regs, MUSB_TESTMODE, 0);
1020 1035
1021 /* put into basic highspeed mode and start session */ 1036 /* put into basic highspeed mode and start session */