From patchwork Mon May 15 07:07:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Moreno Bartalucci X-Patchwork-Id: 9726189 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 30B4560231 for ; Mon, 15 May 2017 07:07:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 20C2627B81 for ; Mon, 15 May 2017 07:07:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 13B9F2818E; Mon, 15 May 2017 07:07:36 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 14A7627B81 for ; Mon, 15 May 2017 07:07:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751531AbdEOHHd convert rfc822-to-8bit (ORCPT ); Mon, 15 May 2017 03:07:33 -0400 Received: from out.consiagnet.it ([83.149.128.196]:51990 "EHLO out.consiagnet.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751365AbdEOHHc (ORCPT ); Mon, 15 May 2017 03:07:32 -0400 Received: from hermes.tecnorama.it (host-static-157-154.consiagnet.it [83.149.157.154] (may be forged)) by out.consiagnet.it (8.15.2/8.15.2) with ESMTP id v4F77Hwn040307; Mon, 15 May 2017 09:07:18 +0200 (CEST) (envelope-from moreno.bartalucci@tecnorama.it) Received: from localhost (localhost [127.0.0.1]) by hermes.tecnorama.it (Postfix) with ESMTP id 4855CB410E2; Mon, 15 May 2017 09:07:07 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at tecnorama.it Received: from hermes.tecnorama.it ([127.0.0.1]) by localhost (hermes.tecnorama.it [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EzJa1u8GU5RG; Mon, 15 May 2017 09:07:05 +0200 (CEST) Received: from macmoreno.tecnorama.it (macmoreno.tecnorama.it [192.168.100.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hermes.tecnorama.it (Postfix) with ESMTPSA id 200B4B40480; Mon, 15 May 2017 09:07:05 +0200 (CEST) Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [PATCH] usb-musb: keep VBUS on when device is disconnected From: Moreno Bartalucci In-Reply-To: <20170512152144.GA651@uda0271908> Date: Mon, 15 May 2017 09:07:10 +0200 Cc: Tony Lindgren , Lars Melin , "linux-omap@vger.kernel.org" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Alessio Igor Bogani Message-Id: <172B0853-86A2-4253-B56D-8F7E716E5E0E@tecnorama.it> References: <20170511190100.GF7154@uda0271908> <20170511191005.GG7154@uda0271908> <20170511192013.GA4459@uda0271908> <20170511193810.GX3489@atomide.com> <20170511200220.GH7154@uda0271908> <20170511202306.GY3489@atomide.com> <20170511204406.GI7154@uda0271908> <20170511210628.GA3489@atomide.com> <20170512134042.GK7154@uda0271908> <20170512145849.GE3489@atomide.com> <20170512152144.GA651@uda0271908> To: Bin Liu X-Mailer: Apple Mail (2.3273) Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP > Il giorno 12 mag 2017, alle ore 17:21, Bin Liu ha scritto: > > […] > > Moreno, would you mind to test the patch below with your modem? > > […] >> >>> 8< -------------------- >>> diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c >>> index 9c7ee26ef388..465281244596 100644 >>> --- a/drivers/usb/musb/musb_dsps.c >>> +++ b/drivers/usb/musb/musb_dsps.c >>> @@ -245,9 +245,14 @@ static int dsps_check_status(struct musb *musb, void *unused) >>> dsps_mod_timer_optional(glue); >>> break; >>> case OTG_STATE_A_WAIT_BCON: >>> + /* keep VBUS on for host-only mode */ >>> + if (musb->port_mode == MUSB_PORT_MODE_HOST) { >>> + dsps_mod_timer_optional(glue); >>> + break; >>> + } >>> musb_writeb(musb->mregs, MUSB_DEVCTL, 0); >>> skip_session = 1; >>> - /* fall */ >>> + /* fall through */ >>> >>> case OTG_STATE_A_IDLE: >>> case OTG_STATE_B_IDLE: Hello Bin, I tested the above patch with my device and it seems to work correctly with the current mainline kernel. I tested it with my “production” kernel as well (4.9.20) but, for it to work, I had to change it slightly. This is what I tested for kernel 4.9.20: In this form, it appears to work properly for 4.9.20 too. Best regards, Moreno --- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/usb/musb/musb_dsps.c 2017-05-15 08:40:23.000000000 +0200 +++ b/drivers/usb/musb/musb_dsps.c 2017-05-15 08:49:17.000000000 +0200 @@ -213,6 +213,12 @@ static int dsps_check_status(struct musb msecs_to_jiffies(wrp->poll_timeout)); break; case OTG_STATE_A_WAIT_BCON: + /* keep VBUS on for host-only mode */ + if (musb->port_mode == MUSB_PORT_MODE_HOST) { + mod_timer(&glue->timer, jiffies + + msecs_to_jiffies(wrp->poll_timeout)); + break; + } musb_writeb(musb->mregs, MUSB_DEVCTL, 0); skip_session = 1; /* fall */