From patchwork Mon May 21 13:42:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Liu X-Patchwork-Id: 10415365 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E8CB6600CC for ; Mon, 21 May 2018 13:42:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D872F28900 for ; Mon, 21 May 2018 13:42:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD04928906; Mon, 21 May 2018 13:42:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EEBB028900 for ; Mon, 21 May 2018 13:42:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752711AbeEUNmf (ORCPT ); Mon, 21 May 2018 09:42:35 -0400 Received: from fllnx210.ext.ti.com ([198.47.19.17]:35170 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751679AbeEUNmX (ORCPT ); Mon, 21 May 2018 09:42:23 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w4LDgMAu005749; Mon, 21 May 2018 08:42:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1526910142; bh=vMbVZ1bcfx4w/NxV2H00DLgTfI0wT4jF43oxWqeceTE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=t2shTM+9JR9SQLSHOmIJp18dbEJrDva7YbzdDBmiFC79ElJvW0dpjrlbiO7yP36NN cFzs5Y5LZw/BaKG5dOQVqVc7qiawxlDjdzNms6cL3EwkuSzByZr7uloWNhXVseLFSs +3ByC/VkLMKsmVcRkPq9QQcroWggayPXOB9XV/Oc= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w4LDgMHN006562; Mon, 21 May 2018 08:42:22 -0500 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Mon, 21 May 2018 08:42:22 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Mon, 21 May 2018 08:42:22 -0500 Received: from uda0271908.am.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w4LDgMXi032590; Mon, 21 May 2018 08:42:22 -0500 From: Bin Liu To: Greg Kroah-Hartman CC: , Bin Liu Subject: [PATCH 10/14] usb: musb: remove references to default_a of struct usb_otg Date: Mon, 21 May 2018 08:42:18 -0500 Message-ID: <1526910142-15862-11-git-send-email-b-liu@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1526910142-15862-1-git-send-email-b-liu@ti.com> References: <1526910142-15862-1-git-send-email-b-liu@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP musb drivers do not use the otg fsm framework, so referencing to otg->default_a doesn't have any effect, so remove the references. But tusb6010 glue driver uses it locally to control the vbus power, so keep the references in tusb6010 only. Signed-off-by: Bin Liu --- drivers/usb/musb/am35x.c | 3 --- drivers/usb/musb/da8xx.c | 2 -- drivers/usb/musb/davinci.c | 49 ++++++++++++++++++++---------------------- drivers/usb/musb/musb_core.c | 9 ++------ drivers/usb/musb/musb_dsps.c | 2 -- drivers/usb/musb/musb_gadget.c | 1 - drivers/usb/musb/musb_host.c | 1 - drivers/usb/musb/omap2430.c | 5 ----- drivers/usb/musb/sunxi.c | 2 -- drivers/usb/musb/ux500.c | 2 -- 10 files changed, 25 insertions(+), 51 deletions(-) diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c index 0ad664efda6b..660641ab1545 100644 --- a/drivers/usb/musb/am35x.c +++ b/drivers/usb/musb/am35x.c @@ -201,7 +201,6 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci) struct device *dev = musb->controller; struct musb_hdrc_platform_data *plat = dev_get_platdata(dev); struct omap_musb_board_data *data = plat->board_data; - struct usb_otg *otg = musb->xceiv->otg; unsigned long flags; irqreturn_t ret = IRQ_NONE; u32 epintr, usbintr; @@ -264,14 +263,12 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci) 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(&musb->dev_timer); } else { musb->is_active = 0; MUSB_DEV_MODE(musb); - otg->default_a = 0; musb->xceiv->otg->state = OTG_STATE_B_IDLE; portstate(musb->port1_status &= ~USB_PORT_STAT_POWER); } diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index b8295ce7c4fe..0e5929e81d26 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -280,7 +280,6 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci) 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(&musb->dev_timer); @@ -295,7 +294,6 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci) */ musb->is_active = 0; MUSB_DEV_MODE(musb); - otg->default_a = 0; musb->xceiv->otg->state = OTG_STATE_B_IDLE; portstate(musb->port1_status &= ~USB_PORT_STAT_POWER); } diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index 2ad39dcd2f4c..fb6bbd254ab7 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c @@ -311,14 +311,12 @@ static irqreturn_t davinci_musb_interrupt(int irq, void *__hci) 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(&musb->dev_timer); } else { musb->is_active = 0; MUSB_DEV_MODE(musb); - otg->default_a = 0; musb->xceiv->otg->state = OTG_STATE_B_IDLE; portstate(musb->port1_status &= ~USB_PORT_STAT_POWER); } @@ -425,6 +423,9 @@ static int davinci_musb_init(struct musb *musb) static int davinci_musb_exit(struct musb *musb) { + int maxdelay = 30; + u8 devctl, warn = 0; + del_timer_sync(&musb->dev_timer); /* force VBUS off */ @@ -438,31 +439,27 @@ static int davinci_musb_exit(struct musb *musb) davinci_musb_source_power(musb, 0 /*off*/, 1); - /* delay, to avoid problems with module reload */ - if (musb->xceiv->otg->default_a) { - int maxdelay = 30; - u8 devctl, warn = 0; + /* + * delay, to avoid problems with module reload. + * if there's no peripheral connected, this can take a + * long time to fall, especially on EVM with huge C133. + */ + do { + devctl = musb_readb(musb->mregs, MUSB_DEVCTL); + if (!(devctl & MUSB_DEVCTL_VBUS)) + break; + if ((devctl & MUSB_DEVCTL_VBUS) != warn) { + warn = devctl & MUSB_DEVCTL_VBUS; + dev_dbg(musb->controller, "VBUS %d\n", + warn >> MUSB_DEVCTL_VBUS_SHIFT); + } + msleep(1000); + maxdelay--; + } while (maxdelay > 0); - /* if there's no peripheral connected, this can take a - * long time to fall, especially on EVM with huge C133. - */ - do { - devctl = musb_readb(musb->mregs, MUSB_DEVCTL); - if (!(devctl & MUSB_DEVCTL_VBUS)) - break; - if ((devctl & MUSB_DEVCTL_VBUS) != warn) { - warn = devctl & MUSB_DEVCTL_VBUS; - dev_dbg(musb->controller, "VBUS %d\n", - warn >> MUSB_DEVCTL_VBUS_SHIFT); - } - msleep(1000); - maxdelay--; - } while (maxdelay > 0); - - /* in OTG mode, another host might be connected */ - if (devctl & MUSB_DEVCTL_VBUS) - dev_dbg(musb->controller, "VBUS off timeout (devctl %02x)\n", devctl); - } + /* in OTG mode, another host might be connected */ + if (devctl & MUSB_DEVCTL_VBUS) + dev_dbg(musb->controller, "VBUS off timeout (devctl %02x)\n", devctl); phy_off(); diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index a3a716197dc1..5cc64980058b 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2352,13 +2352,8 @@ static void musb_deassert_reset(struct work_struct *work) musb_writeb(musb->mregs, MUSB_ULPI_BUSCONTROL, busctl); } - if (musb->xceiv->otg->default_a) { - MUSB_HST_MODE(musb); - musb->xceiv->otg->state = OTG_STATE_A_IDLE; - } else { - MUSB_DEV_MODE(musb); - musb->xceiv->otg->state = OTG_STATE_B_IDLE; - } + MUSB_DEV_MODE(musb); + musb->xceiv->otg->state = OTG_STATE_B_IDLE; switch (musb->port_mode) { case MUSB_HOST: diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 71aec85b9bd4..34e4dda1d6ac 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -360,13 +360,11 @@ static irqreturn_t dsps_interrupt(int irq, void *hci) WARNING("VBUS error workaround (delay coming)\n"); } else if (drvvbus) { MUSB_HST_MODE(musb); - musb->xceiv->otg->default_a = 1; musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; dsps_mod_timer_optional(glue); } else { musb->is_active = 0; MUSB_DEV_MODE(musb); - musb->xceiv->otg->default_a = 0; musb->xceiv->otg->state = OTG_STATE_B_IDLE; } diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index d082b0cbea93..5b8e6297ebed 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -1794,7 +1794,6 @@ int musb_gadget_setup(struct musb *musb) musb->g.speed = USB_SPEED_UNKNOWN; MUSB_DEV_MODE(musb); - musb->xceiv->otg->default_a = 0; musb->xceiv->otg->state = OTG_STATE_B_IDLE; /* this "gadget" abstracts/virtualizes the controller */ diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index c8d0617da849..cd611a97f59e 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c @@ -2752,7 +2752,6 @@ int musb_host_setup(struct musb *musb, int power_budget) if (musb->port_mode == MUSB_HOST) { MUSB_HST_MODE(musb); - musb->xceiv->otg->default_a = 1; musb->xceiv->otg->state = OTG_STATE_A_IDLE; } otg_set_host(musb->xceiv->otg, &hcd->self); diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 3dd6e1c5e04f..b1dd81fb5f55 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -77,7 +77,6 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on) otg_set_vbus(otg, 1); } else { musb->is_active = 1; - otg->default_a = 1; musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; devctl |= MUSB_DEVCTL_SESSION; MUSB_HST_MODE(musb); @@ -89,7 +88,6 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on) * jumping right to B_IDLE... */ - otg->default_a = 0; musb->xceiv->otg->state = OTG_STATE_B_IDLE; devctl &= ~MUSB_DEVCTL_SESSION; @@ -148,14 +146,12 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) struct musb_hdrc_platform_data *pdata = dev_get_platdata(musb->controller); struct omap_musb_board_data *data = pdata->board_data; - struct usb_otg *otg = musb->xceiv->otg; pm_runtime_get_sync(musb->controller); switch (glue->status) { case MUSB_ID_GROUND: dev_dbg(musb->controller, "ID GND\n"); - otg->default_a = true; musb->xceiv->otg->state = OTG_STATE_A_IDLE; musb->xceiv->last_event = USB_EVENT_ID; if (musb->gadget_driver) { @@ -168,7 +164,6 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue) case MUSB_VBUS_VALID: dev_dbg(musb->controller, "VBUS Connect\n"); - otg->default_a = false; musb->xceiv->otg->state = OTG_STATE_B_IDLE; musb->xceiv->last_event = USB_EVENT_VBUS; omap_control_usb_set_mode(glue->control_otghs, USB_MODE_DEVICE); diff --git a/drivers/usb/musb/sunxi.c b/drivers/usb/musb/sunxi.c index 62ab2ca03779..832a41f9ee7d 100644 --- a/drivers/usb/musb/sunxi.c +++ b/drivers/usb/musb/sunxi.c @@ -105,13 +105,11 @@ static void sunxi_musb_work(struct work_struct *work) devctl = readb(musb->mregs + SUNXI_MUSB_DEVCTL); if (test_bit(SUNXI_MUSB_FL_HOSTMODE, &glue->flags)) { set_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); - musb->xceiv->otg->default_a = 1; musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; MUSB_HST_MODE(musb); devctl |= MUSB_DEVCTL_SESSION; } else { clear_bit(SUNXI_MUSB_FL_VBUS_ON, &glue->flags); - musb->xceiv->otg->default_a = 0; musb->xceiv->otg->state = OTG_STATE_B_IDLE; MUSB_DEV_MODE(musb); devctl &= ~MUSB_DEVCTL_SESSION; diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c index 27b4a77a9e23..73538d1d0524 100644 --- a/drivers/usb/musb/ux500.c +++ b/drivers/usb/musb/ux500.c @@ -62,7 +62,6 @@ static void ux500_musb_set_vbus(struct musb *musb, int is_on) } else { musb->is_active = 1; - musb->xceiv->otg->default_a = 1; musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; devctl |= MUSB_DEVCTL_SESSION; MUSB_HST_MODE(musb); @@ -73,7 +72,6 @@ static void ux500_musb_set_vbus(struct musb *musb, int is_on) /* NOTE: we're skipping A_WAIT_VFALL -> A_IDLE and jumping * right to B_IDLE... */ - musb->xceiv->otg->default_a = 0; devctl &= ~MUSB_DEVCTL_SESSION; MUSB_DEV_MODE(musb); }