Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5039476yba; Tue, 30 Apr 2019 08:13:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5PUrWfmY6BOuCOECJoRLqxKLgo01A+KlTOg9f8WK4unJbQlm4mAnES87W5vRkpPfAWoud X-Received: by 2002:a63:5511:: with SMTP id j17mr67574579pgb.449.1556637220449; Tue, 30 Apr 2019 08:13:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556637220; cv=none; d=google.com; s=arc-20160816; b=Vqi8nR4nnZCMXXXToucrx7uVXFkfUd0CijObBYx3/6DNXaCJMLE/EIDi/S70JCT5mq +RsXaOjSwyHgHL8myTeTUioQIYLNQvYT1r0gp5qYfjPtDawI/IYni5Jn8lhBYcAb4U6F 0T/XZf41xMUwcQ9RFB+gAUcUdbhmfkMtpk/ppITXucXs+4atJ4vRvCtxgp7baQtb3EVU M2tX+PTU3K3Y4snLAVJZkv7llgMYR5Nzps84tdPDQqc1Bsfq56q1zvCEPXjLPc5vVTdY 4G+8AX3RsdUCEHzNAP5O32rUD063ut2r47+IJ1kr8hX6Gt0b1CSwhxxWcxwMdDKc8+aO /L5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:to:from:date:dkim-signature; bh=PyjPXxQDLD7OrC57FpZWZ3HgMp8P6I8TlGFCKvjI1a4=; b=h6vx9hpYKGNOCbAQ63DgdklOh1rHU5Fog2q+lwo1RsJAHUSfuukEGxEe7tUV06tekR rKaT0LkOC4vnhWjyhcRk8YTPEo5c9ow5lQ+6qcPSX53uoaMDoxTZPjXdjF/czzjAEGQB TTaLoRFMkwc5CmTTa4BJ6SaQ3bwU37PkMLjEsYQP8K37qACcqY4c4Jmk9twDgqJ47RmU PUzyUdmbjRjvW+9npIW3CDvw3PYQrrEjY1SOc+O/wZokVMUDO0NLqBwGjJ4JvcEzifad WRZbTUNeLiI8gMmLhaGJ7KmGHoDHuv/rNo5qZLrtsFkYJWdqwIsCGuR3YxLj4juwOvs1 /SBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=PG9Kk3k9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n24si6510416pgh.579.2019.04.30.08.13.22; Tue, 30 Apr 2019 08:13:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=PG9Kk3k9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726512AbfD3PKr (ORCPT + 99 others); Tue, 30 Apr 2019 11:10:47 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:52242 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726030AbfD3PKr (ORCPT ); Tue, 30 Apr 2019 11:10:47 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x3UFAhn6102546; Tue, 30 Apr 2019 10:10:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1556637043; bh=PyjPXxQDLD7OrC57FpZWZ3HgMp8P6I8TlGFCKvjI1a4=; h=Date:From:To:Subject:References:In-Reply-To; b=PG9Kk3k9s2bA12V3msMGYu5ppdPrEMreOt4Xv1toqdr+/tCWUW7cD/1Q979HjWway kWp1IiD95I+JhoRr+qXSCeWhDB3vTqd9IXQ8sWUIOfIngdh/lIxRA7CAoDo47PJOGk f2B/t9aLPlc+bgTBW+yW71e1i2jLEuaoBVkykRc8= Received: from DFLE106.ent.ti.com (dfle106.ent.ti.com [10.64.6.27]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x3UFAh0V107532 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 30 Apr 2019 10:10:43 -0500 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Tue, 30 Apr 2019 10:10:43 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Tue, 30 Apr 2019 10:10:43 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id x3UFAhoi114023; Tue, 30 Apr 2019 10:10:43 -0500 Date: Tue, 30 Apr 2019 10:10:43 -0500 From: Bin Liu To: Paul Cercueil , , , Subject: Re: [PATCH] usb: musb: Disable pullup in gadget setup Message-ID: <20190430151043.GG20993@uda0271908> Mail-Followup-To: Bin Liu , Paul Cercueil , od@zcrc.me, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190404093743.6470-1-paul@crapouillou.net> <20190404161046.GA30182@uda0271908> <20190430150506.GF20993@uda0271908> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20190430150506.GF20993@uda0271908> User-Agent: Mutt/1.5.21 (2010-09-15) X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 30, 2019 at 10:05:06AM -0500, Bin Liu wrote: > Hi Paul, > > On Thu, Apr 04, 2019 at 11:10:46AM -0500, Bin Liu wrote: > > On Thu, Apr 04, 2019 at 11:37:43AM +0200, Paul Cercueil wrote: > > > The pullup may be already enabled before the driver is initialized. > > > It has to be disabled at init time, as we cannot guarantee that a gadget > > > driver will be bound to the UDC. > > > > > > Signed-off-by: Paul Cercueil > > > --- > > > drivers/usb/musb/musb_gadget.c | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c > > > index ffe462a657b1..094dc59c834c 100644 > > > --- a/drivers/usb/musb/musb_gadget.c > > > +++ b/drivers/usb/musb/musb_gadget.c > > > @@ -1794,6 +1794,7 @@ int musb_gadget_setup(struct musb *musb) > > > > > > musb->is_active = 0; > > > musb_platform_try_idle(musb, 0); > > > + musb_pullup(musb, 0); > > > > > > status = usb_add_gadget_udc(musb->controller, &musb->g); > > > if (status) > > > > Applied. > > Sorry, I have dropped this patch from my tree. I realized the gadget > core already defines callbacks to control the pullup. I think the > proper fix should be calling usb_udc_vbus_handler() in musb gadget or > glue layers. Basically besides the problem your patch tries to fix, there is another problem related to the pullup, which is enabled right after bind a gadget driver, regardless of vbus status. This violates the USB Spec. Implementing the udc core callbacks should fix both issues. -Bin.