diff options
Diffstat (limited to 'drivers/usb/musb/am35x.c')
-rw-r--r-- | drivers/usb/musb/am35x.c | 42 |
1 files changed, 12 insertions, 30 deletions
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c index 02fbb4fe3745..0ad664efda6b 100644 --- a/drivers/usb/musb/am35x.c +++ b/drivers/usb/musb/am35x.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Texas Instruments AM35x "glue layer" @@ -8,23 +9,6 @@ * Copyright (c) 2008-2009, MontaVista Software, Inc. <source@mvista.com> * * This file is part of the Inventra Controller Driver for Linux. - * - * The Inventra Controller Driver for Linux is free software; you - * can redistribute it and/or modify it under the terms of the GNU - * General Public License version 2 as published by the Free Software - * Foundation. - * - * The Inventra Controller Driver for Linux is distributed in - * the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - * License for more details. - * - * You should have received a copy of the GNU General Public License - * along with The Inventra Controller Driver for Linux ; if not, - * write to the Free Software Foundation, Inc., 59 Temple Place, - * Suite 330, Boston, MA 02111-1307 USA - * */ #include <linux/module.h> @@ -133,11 +117,9 @@ static void am35x_musb_set_vbus(struct musb *musb, int is_on) #define POLL_SECONDS 2 -static struct timer_list otg_workaround; - -static void otg_timer(unsigned long _musb) +static void otg_timer(struct timer_list *t) { - struct musb *musb = (void *)_musb; + struct musb *musb = from_timer(musb, t, dev_timer); void __iomem *mregs = musb->mregs; u8 devctl; unsigned long flags; @@ -173,7 +155,7 @@ static void otg_timer(unsigned long _musb) case OTG_STATE_B_IDLE: devctl = musb_readb(mregs, MUSB_DEVCTL); if (devctl & MUSB_DEVCTL_BDEVICE) - mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); + mod_timer(&musb->dev_timer, jiffies + POLL_SECONDS * HZ); else musb->xceiv->otg->state = OTG_STATE_A_IDLE; break; @@ -195,12 +177,12 @@ static void am35x_musb_try_idle(struct musb *musb, unsigned long timeout) musb->xceiv->otg->state == OTG_STATE_A_WAIT_BCON)) { dev_dbg(musb->controller, "%s active, deleting timer\n", usb_otg_state_string(musb->xceiv->otg->state)); - del_timer(&otg_workaround); + del_timer(&musb->dev_timer); last_timer = jiffies; return; } - if (time_after(last_timer, timeout) && timer_pending(&otg_workaround)) { + if (time_after(last_timer, timeout) && timer_pending(&musb->dev_timer)) { dev_dbg(musb->controller, "Longer idle timer already pending, ignoring...\n"); return; } @@ -209,7 +191,7 @@ static void am35x_musb_try_idle(struct musb *musb, unsigned long timeout) dev_dbg(musb->controller, "%s inactive, starting idle timer for %u ms\n", usb_otg_state_string(musb->xceiv->otg->state), jiffies_to_msecs(timeout - jiffies)); - mod_timer(&otg_workaround, timeout); + mod_timer(&musb->dev_timer, timeout); } static irqreturn_t am35x_musb_interrupt(int irq, void *hci) @@ -278,14 +260,14 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci) */ musb->int_usb &= ~MUSB_INTR_VBUSERROR; musb->xceiv->otg->state = OTG_STATE_A_WAIT_VFALL; - mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); + mod_timer(&musb->dev_timer, jiffies + POLL_SECONDS * HZ); WARNING("VBUS error workaround (delay coming)\n"); } else if (drvvbus) { MUSB_HST_MODE(musb); otg->default_a = 1; musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; portstate(musb->port1_status |= USB_PORT_STAT_POWER); - del_timer(&otg_workaround); + del_timer(&musb->dev_timer); } else { musb->is_active = 0; MUSB_DEV_MODE(musb); @@ -324,7 +306,7 @@ eoi: /* Poll for ID change */ if (musb->xceiv->otg->state == OTG_STATE_B_IDLE) - mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); + mod_timer(&musb->dev_timer, jiffies + POLL_SECONDS * HZ); spin_unlock_irqrestore(&musb->lock, flags); @@ -365,7 +347,7 @@ static int am35x_musb_init(struct musb *musb) if (IS_ERR_OR_NULL(musb->xceiv)) return -EPROBE_DEFER; - setup_timer(&otg_workaround, otg_timer, (unsigned long) musb); + timer_setup(&musb->dev_timer, otg_timer, 0); /* Reset the musb */ if (data->reset) @@ -395,7 +377,7 @@ static int am35x_musb_exit(struct musb *musb) struct musb_hdrc_platform_data *plat = dev_get_platdata(dev); struct omap_musb_board_data *data = plat->board_data; - del_timer_sync(&otg_workaround); + del_timer_sync(&musb->dev_timer); /* Shutdown the on-chip PHY and its PLL. */ if (data->set_phy_power) |