Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp540205yba; Mon, 1 Apr 2019 11:22:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxV5tt93rjwvLnCGnMpebKrZXmvZrGlSRl/iaL3xWpx5Vrttq2REqBu+AntsXjevMkCnGQO X-Received: by 2002:a62:e80f:: with SMTP id c15mr63336694pfi.93.1554142959819; Mon, 01 Apr 2019 11:22:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554142959; cv=none; d=google.com; s=arc-20160816; b=KMwgVJktOj9XH0Xa/o+5YJNNPMEQiEtTUHj53rPwBtsHhx1F/7L3nXI/X7wBEfMesi aOGLaoQDqC/+e15zR90WwUyp1pdmHvJlPh3c2nC8lRl0uCdFBVvO92CRGtrkcXp5k72z mpuhKa5QGPdECksClP1/iP1WiRP4/zVSkzuWPGJsTl+9C2rV+vjFrupNxI66h+4YEK/X JnZHZZHfwOTURZKswf1MI8/+uKBY1yG1ijFc1W9X35vEw7d/h58Sg6OF6/sSb0co9z8j VUqiU8cwxCjFZFSiwmSQIURuexLLu6kwoVZoYJFIX91R3ORDQIM+myym30QwbUGtzJqv 2O9g== 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=hKLKhAj1bb69DV25Byjd5WkAHfiQxIydUOjBsP+D5yE=; b=0+LwCeI6AucsODrR0+lpeo7dPNOVm0RJtRa522tzBYkuDmo4Ses63xsxMHiKbllcvL b88QJENm6MeL1RpnUKXh2wz3tMc9Q+qZuL1zWoRCQsH1OCaOQegNsbI4UHyVwSbc0UiW b23j34VfQb3jnxWBTtZVbvA8iQGK2cj/yAEaDJJwISWlr79Psp0dX0gh7lTWlGpRi78v Ze7opDaCyfK/CCzhjrdY+6d+1timuefUP0ngz6KTfrgRAWuOmkC2wIOxf5rOfcOp2Mwy O6yzp0vHmg94E/Z1fGHUc7XfYmsJm9K2/7Mj0uR7zPbC8aI4qzru8SS1tBNMDTH4g85v G8bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=RcLnIFoM; 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 t194si7713728pgb.316.2019.04.01.11.22.24; Mon, 01 Apr 2019 11:22:39 -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=RcLnIFoM; 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 S1728971AbfDASUO (ORCPT + 99 others); Mon, 1 Apr 2019 14:20:14 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:39606 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728670AbfDASUO (ORCPT ); Mon, 1 Apr 2019 14:20:14 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x31IK9O5011727; Mon, 1 Apr 2019 13:20:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1554142809; bh=hKLKhAj1bb69DV25Byjd5WkAHfiQxIydUOjBsP+D5yE=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=RcLnIFoMJL5iuG5m+Y/pv149AbYi9ngvSCwzLAIycxNCTaQ7IAP2MA0WQlozH/4Va 9wAnMxZHxGtxwiWhnwuHT/dhSZkKt/0NuRSfY0IRmgmGIJMxuPYHZjxXXm/qMOA9UU WGhEviQrTbSsZzvSlR2RyzbP21aIhBTzGvreBTTE= Received: from DFLE102.ent.ti.com (dfle102.ent.ti.com [10.64.6.23]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x31IK9hJ041243 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 1 Apr 2019 13:20:09 -0500 Received: from DFLE103.ent.ti.com (10.64.6.24) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 1 Apr 2019 13:20:08 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) 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.1713.5 via Frontend Transport; Mon, 1 Apr 2019 13:20:08 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id x31IK85n048717; Mon, 1 Apr 2019 13:20:08 -0500 Date: Mon, 1 Apr 2019 13:20:08 -0500 From: Bin Liu To: Paul Cercueil CC: , , Subject: Re: [PATCH] usb: musb: Force-disable pullup on shutdown Message-ID: <20190401182008.GL25852@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> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1554140782.10471.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 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]) [ 3880.630471] [] (usb_del_gadget_udc [udc_core]) from [] (musb_remove+0x50/0x134 [musb_hdrc]) [ 3880.640648] [] (musb_remove [musb_hdrc]) from [] (platform_drv_remove+0x28/0x48) [ 3880.649831] [] (platform_drv_remove) from [] (device_release_driver_internal+0xe4/0x1b4) [ 3880.659708] [] (device_release_driver_internal) from [] (bus_remove_device+0xe0/0x140) [ 3880.669409] [] (bus_remove_device) from [] (device_del+0x140/0x374) [ 3880.677455] [] (device_del) from [] (platform_device_del.part.3+0x18/0x80) [ 3880.686110] [] (platform_device_del.part.3) from [] (platform_device_unregister+0x24/0x30) [ 3880.696170] [] (platform_device_unregister) from [] (dsps_remove+0x1c/0x38 [musb_dsps]) [ 3880.706010] [] (dsps_remove [musb_dsps]) from [] (platform_drv_remove+0x28/0x48) [ 3880.715190] [] (platform_drv_remove) from [] (device_release_driver_internal+0xe4/0x1b4) [ 3880.725065] [] (device_release_driver_internal) from [] (unbind_store+0x64/0xd8) [ 3880.734253] [] (unbind_store) from [] (kernfs_fop_write+0xf4/0x1cc) Regards, -Bin.