Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp159104yba; Wed, 3 Apr 2019 06:27:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqyvdkbwzc7beu6dsHAoUrFnBOLF4i8PhFeZm461IodvR0lZp6rRypYkdEr7yR8g8ejvXjW1 X-Received: by 2002:a65:63d7:: with SMTP id n23mr11504381pgv.26.1554298055562; Wed, 03 Apr 2019 06:27:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554298055; cv=none; d=google.com; s=arc-20160816; b=QqBRz8Fofe1nMN49jUln0dkiRnESiPDWQv3Neql3j7YRUvX60Xp4EAaUraR2ANaBZh I9gwn+A/oVjcSAHm/7CU1XautDNNQ6qaau9919G+SU5vcv/NLOGPrvEZ2aLb/3dgCpdu CmD+c3otXnPchlJSJt6xEVZoGJkH1q0SjEOwD+acIpPFAaSyA3vQfDZO2DOaiZm/M9IG T4bQk2I3qNZfWTOlgHpDxL0brT9Wa1sVTxR7yvz7mP7ctURoRKqRdJidw7ulzZgsyNvx 2mPhuiKVVlojXxyieZkbzNs3y4TLrxmGhcRDrSics4GrslPR9wD+bvzJTsgN2IlwHm7m Z31g== 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-transfer-encoding:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=30SzqplYVs7grg6I7qfHiMDOVncG2UIO899Trs/gO7M=; b=C/gRLEO+Rl0O2KdI9hS6nEL6Xf0mOsaIh8ht4ZizGixKfQY3sm3/m3GQEYf1gDS1wB hTFYuk5VcHaDoAHzPWXwRUoKwmLCBPT9q1vqgMwZZOvBYhsed3c9y60Nt4hYD+5Wr6kb jhBI06AXGQOnrsfGqb/j8byq0iLScHnwjphPnCUE0OjTvg4H7A6y7OfQvaS21a2fMiR+ pGZauq9QKUNKrkuAeVSf3eWF3NRFZzIS4DkQHg308eA/XhNT1yT4OxZ6/plpsMaxIs/p pbHMp2V+J98lBBPCMsah9O1Hc/FpvWXi1G8sg3F7I62Eh6CjTwBmG6jAybI0Rp3f6/wS fXaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=cqKNvNBa; 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 g24si13769965pfd.212.2019.04.03.06.27.20; Wed, 03 Apr 2019 06:27:35 -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=cqKNvNBa; 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 S1726738AbfDCN0R (ORCPT + 99 others); Wed, 3 Apr 2019 09:26:17 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:60396 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726628AbfDCN0H (ORCPT ); Wed, 3 Apr 2019 09:26:07 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x33DQ0gX113931; Wed, 3 Apr 2019 08:26:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1554297960; bh=30SzqplYVs7grg6I7qfHiMDOVncG2UIO899Trs/gO7M=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=cqKNvNBaQKLpQsp0d5c+H0XKX2kXLloO39KqsxVxm6ByProFacmnycRHCA89PHTzR +uKROseX5fNu8ybdO+9xvHIIJ1WpT3Hxw6+sFTa4IhFw+HXdy9VXJHhAw2yeAcbja8 4CM+skBUzNV1SBVj7dinG/juN1OQOIsJIrPWfXNg= Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x33DQ0jN021432 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Apr 2019 08:26:00 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 3 Apr 2019 08:26:00 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE115.ent.ti.com (157.170.170.26) 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; Wed, 3 Apr 2019 08:26:00 -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 x33DQ0Te068053; Wed, 3 Apr 2019 08:26:00 -0500 Date: Wed, 3 Apr 2019 08:26:00 -0500 From: Bin Liu To: Paul Cercueil CC: , , Subject: Re: [PATCH] usb: musb: Force-disable pullup on shutdown Message-ID: <20190403132600.GQ25852@uda0271908> Mail-Followup-To: Bin Liu , Paul Cercueil , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, od@zcrc.me References: <20190321144246.3547-1-paul@crapouillou.net> <20190401171725.GK25852@uda0271908> <1554140782.10471.0@crapouillou.net> <20190401182008.GL25852@uda0271908> <1554235122.13181.0@crapouillou.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1554235122.13181.0@crapouillou.net> 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 02, 2019 at 09:58:42PM +0200, Paul Cercueil wrote: > Hi, > > Le lun. 1 avril 2019 ? 20:20, Bin Liu a ?crit : > >On Mon, Apr 01, 2019 at 07:46:22PM +0200, Paul Cercueil wrote: > >> > >> > >> Le lun. 1 avril 2019 ? 19:17, Bin Liu a ?crit : > >> >On Thu, Mar 21, 2019 at 03:42:46PM +0100, Paul Cercueil wrote: > >> >> When the musb is shutdown, for instance when the driver is > >>unloaded, > >> >> force-disable the pullup. Otherwise, the host will still see > >> >>the gadget > >> >> device even after the shutdown. > >> > > >> >how would this happen? > >> > > >> >when musb-hdrc driver is unloaded, udc core removes the bound > >>gadget > >> >driver which calls musb_gadget_pullup() to disable the pullup. > >> > >> I'm testing with the jz4740-musb driver. I don't unload the > >>module (it's > >> built-in) but unbind it from sysfs. > > > >I did unbind too. > > > >root@am335x-evm:/sys/bus/platform/drivers/musb-hdrc# echo > >musb-hdrc.0 > unbind > > > >or unbind the glue driver: > > > >root@am335x-evm:/sys/bus/platform/drivers/musb-dsps# echo > >47401400.usb > unbind > > > >musb_gadget_pullup() is called in both cases. > > > >[ 3880.597014] [] (musb_gadget_pullup [musb_hdrc]) from > >[] (usb_gadget_disconnect+0x3c/0xf4 [udc_core]) > >[ 3880.607959] [] (usb_gadget_disconnect [udc_core]) > >from [] (usb_gadget_remove_driver+0x4c/0x90 [udc_core]) > >[ 3880.619338] [] (usb_gadget_remove_driver [udc_core]) > >from [] (usb_del_gadget_udc+0x5c/0xc0 [udc_core]) > > In my case this stops here, usb_del_gadget_udc() does not call > usb_gadget_remove_driver(), that's why the pullup is never disabled. > > I guess that's because udc->driver is NULL; I'm testing with then the pullup should be disable by now. > CONFIG_USB_CONFIGFS, > and I don't configure anything in sysfs before unbinding the driver. I didn't check on this, but I could imagine that - when a configfs gadget is bound to the udc, .pullup() is called; - when the configfs gadget is unbound from the udc, .pullup should be called again to disable the pullup. -Bin.