aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2015-02-27 20:02:41 -0500
committerFelipe Balbi <balbi@ti.com>2015-03-10 16:33:32 -0400
commit9e204d885a6d0ae3696284bacd86e2b94dd936c8 (patch)
treec60eb34d7b9648f7547e7774e6ac9d81a62f47e6 /drivers/usb/musb
parent043f5b75dd2b1fbd45d5f367d50e5ae5b4afa955 (diff)
usb: musb: dsps: use msecs_to_jiffies instead
when polling, we were using n * HZ (where n is an integer in seconds), however HZ isn't always correct if we're using cpufreq. A better way is to use msecs_to_jiffies(n) (where n is now an integer in miliseconds). while at that, also rename poll_seconds to poll_timeout and change its type to unsigned int. Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/musb')
-rw-r--r--drivers/usb/musb/musb_dsps.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 30eb6ac29b81..9271450ebacd 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -119,7 +119,7 @@ struct dsps_musb_wrapper {
119 unsigned iddig:5; 119 unsigned iddig:5;
120 unsigned iddig_mux:5; 120 unsigned iddig_mux:5;
121 /* miscellaneous stuff */ 121 /* miscellaneous stuff */
122 u8 poll_seconds; 122 unsigned poll_timeout;
123}; 123};
124 124
125/* 125/*
@@ -285,7 +285,8 @@ static void otg_timer(unsigned long _musb)
285 } 285 }
286 if (!(devctl & MUSB_DEVCTL_SESSION) && !skip_session) 286 if (!(devctl & MUSB_DEVCTL_SESSION) && !skip_session)
287 dsps_writeb(mregs, MUSB_DEVCTL, MUSB_DEVCTL_SESSION); 287 dsps_writeb(mregs, MUSB_DEVCTL, MUSB_DEVCTL_SESSION);
288 mod_timer(&glue->timer, jiffies + wrp->poll_seconds * HZ); 288 mod_timer(&glue->timer, jiffies +
289 msecs_to_jiffies(wrp->poll_timeout));
289 break; 290 break;
290 case OTG_STATE_A_WAIT_VFALL: 291 case OTG_STATE_A_WAIT_VFALL:
291 musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; 292 musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
@@ -352,8 +353,8 @@ static irqreturn_t dsps_interrupt(int irq, void *hci)
352 */ 353 */
353 musb->int_usb &= ~MUSB_INTR_VBUSERROR; 354 musb->int_usb &= ~MUSB_INTR_VBUSERROR;
354 musb->xceiv->otg->state = OTG_STATE_A_WAIT_VFALL; 355 musb->xceiv->otg->state = OTG_STATE_A_WAIT_VFALL;
355 mod_timer(&glue->timer, 356 mod_timer(&glue->timer, jiffies +
356 jiffies + wrp->poll_seconds * HZ); 357 msecs_to_jiffies(wrp->poll_timeout));
357 WARNING("VBUS error workaround (delay coming)\n"); 358 WARNING("VBUS error workaround (delay coming)\n");
358 } else if (drvvbus) { 359 } else if (drvvbus) {
359 MUSB_HST_MODE(musb); 360 MUSB_HST_MODE(musb);
@@ -382,7 +383,8 @@ static irqreturn_t dsps_interrupt(int irq, void *hci)
382 /* Poll for ID change in OTG port mode */ 383 /* Poll for ID change in OTG port mode */
383 if (musb->xceiv->otg->state == OTG_STATE_B_IDLE && 384 if (musb->xceiv->otg->state == OTG_STATE_B_IDLE &&
384 musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE) 385 musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE)
385 mod_timer(&glue->timer, jiffies + wrp->poll_seconds * HZ); 386 mod_timer(&glue->timer, jiffies +
387 msecs_to_jiffies(wrp->poll_timeout));
386out: 388out:
387 spin_unlock_irqrestore(&musb->lock, flags); 389 spin_unlock_irqrestore(&musb->lock, flags);
388 390
@@ -832,7 +834,7 @@ static const struct dsps_musb_wrapper am33xx_driver_data = {
832 .rxep_shift = 16, 834 .rxep_shift = 16,
833 .rxep_mask = 0xfffe, 835 .rxep_mask = 0xfffe,
834 .rxep_bitmap = (0xfffe << 16), 836 .rxep_bitmap = (0xfffe << 16),
835 .poll_seconds = 2, 837 .poll_timeout = 2000, /* ms */
836}; 838};
837 839
838static const struct of_device_id musb_dsps_of_match[] = { 840static const struct of_device_id musb_dsps_of_match[] = {
@@ -888,7 +890,8 @@ static int dsps_resume(struct device *dev)
888 dsps_writel(mbase, wrp->rx_mode, glue->context.rx_mode); 890 dsps_writel(mbase, wrp->rx_mode, glue->context.rx_mode);
889 if (musb->xceiv->otg->state == OTG_STATE_B_IDLE && 891 if (musb->xceiv->otg->state == OTG_STATE_B_IDLE &&
890 musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE) 892 musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE)
891 mod_timer(&glue->timer, jiffies + wrp->poll_seconds * HZ); 893 mod_timer(&glue->timer, jiffies +
894 msecs_to_jiffies(wrp->poll_timeout));
892 895
893 return 0; 896 return 0;
894} 897}