All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bin Liu <b-liu@ti.com>
To: Paul Cercueil <paul@crapouillou.net>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, od@zcrc.me
Subject: usb: musb: Force-disable pullup on shutdown
Date: Mon, 1 Apr 2019 13:20:08 -0500	[thread overview]
Message-ID: <20190401182008.GL25852@uda0271908> (raw)

On Mon, Apr 01, 2019 at 07:46:22PM +0200, Paul Cercueil wrote:
> 
> 
> Le lun. 1 avril 2019 à 19:17, Bin Liu <b-liu@ti.com> 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] [<bf444ab0>] (musb_gadget_pullup [musb_hdrc]) from [<bf402cbc>] (usb_gadget_disconnect+0x3c/0xf4 [udc_core])
[ 3880.607959] [<bf402cbc>] (usb_gadget_disconnect [udc_core]) from [<bf403b28>] (usb_gadget_remove_driver+0x4c/0x90 [udc_core])
[ 3880.619338] [<bf403b28>] (usb_gadget_remove_driver [udc_core]) from [<bf403d20>] (usb_del_gadget_udc+0x5c/0xc0 [udc_core])
[ 3880.630471] [<bf403d20>] (usb_del_gadget_udc [udc_core]) from [<bf439ff8>] (musb_remove+0x50/0x134 [musb_hdrc])
[ 3880.640648] [<bf439ff8>] (musb_remove [musb_hdrc]) from [<c05668cc>] (platform_drv_remove+0x28/0x48)
[ 3880.649831] [<c05668cc>] (platform_drv_remove) from [<c0564e3c>] (device_release_driver_internal+0xe4/0x1b4)
[ 3880.659708] [<c0564e3c>] (device_release_driver_internal) from [<c05633e4>] (bus_remove_device+0xe0/0x140)
[ 3880.669409] [<c05633e4>] (bus_remove_device) from [<c055f358>] (device_del+0x140/0x374)
[ 3880.677455] [<c055f358>] (device_del) from [<c0566ff0>] (platform_device_del.part.3+0x18/0x80)
[ 3880.686110] [<c0566ff0>] (platform_device_del.part.3) from [<c0567098>] (platform_device_unregister+0x24/0x30)
[ 3880.696170] [<c0567098>] (platform_device_unregister) from [<bf48c3e0>] (dsps_remove+0x1c/0x38 [musb_dsps])
[ 3880.706010] [<bf48c3e0>] (dsps_remove [musb_dsps]) from [<c05668cc>] (platform_drv_remove+0x28/0x48)
[ 3880.715190] [<c05668cc>] (platform_drv_remove) from [<c0564e3c>] (device_release_driver_internal+0xe4/0x1b4)
[ 3880.725065] [<c0564e3c>] (device_release_driver_internal) from [<c0562b2c>] (unbind_store+0x64/0xd8)
[ 3880.734253] [<c0562b2c>] (unbind_store) from [<c0350c58>] (kernfs_fop_write+0xf4/0x1cc)

Regards,
-Bin.

WARNING: multiple messages have this Message-ID (diff)
From: Bin Liu <b-liu@ti.com>
To: Paul Cercueil <paul@crapouillou.net>
Cc: <linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<od@zcrc.me>
Subject: Re: [PATCH] usb: musb: Force-disable pullup on shutdown
Date: Mon, 1 Apr 2019 13:20:08 -0500	[thread overview]
Message-ID: <20190401182008.GL25852@uda0271908> (raw)
In-Reply-To: <1554140782.10471.0@crapouillou.net>

On Mon, Apr 01, 2019 at 07:46:22PM +0200, Paul Cercueil wrote:
> 
> 
> Le lun. 1 avril 2019 à 19:17, Bin Liu <b-liu@ti.com> 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] [<bf444ab0>] (musb_gadget_pullup [musb_hdrc]) from [<bf402cbc>] (usb_gadget_disconnect+0x3c/0xf4 [udc_core])
[ 3880.607959] [<bf402cbc>] (usb_gadget_disconnect [udc_core]) from [<bf403b28>] (usb_gadget_remove_driver+0x4c/0x90 [udc_core])
[ 3880.619338] [<bf403b28>] (usb_gadget_remove_driver [udc_core]) from [<bf403d20>] (usb_del_gadget_udc+0x5c/0xc0 [udc_core])
[ 3880.630471] [<bf403d20>] (usb_del_gadget_udc [udc_core]) from [<bf439ff8>] (musb_remove+0x50/0x134 [musb_hdrc])
[ 3880.640648] [<bf439ff8>] (musb_remove [musb_hdrc]) from [<c05668cc>] (platform_drv_remove+0x28/0x48)
[ 3880.649831] [<c05668cc>] (platform_drv_remove) from [<c0564e3c>] (device_release_driver_internal+0xe4/0x1b4)
[ 3880.659708] [<c0564e3c>] (device_release_driver_internal) from [<c05633e4>] (bus_remove_device+0xe0/0x140)
[ 3880.669409] [<c05633e4>] (bus_remove_device) from [<c055f358>] (device_del+0x140/0x374)
[ 3880.677455] [<c055f358>] (device_del) from [<c0566ff0>] (platform_device_del.part.3+0x18/0x80)
[ 3880.686110] [<c0566ff0>] (platform_device_del.part.3) from [<c0567098>] (platform_device_unregister+0x24/0x30)
[ 3880.696170] [<c0567098>] (platform_device_unregister) from [<bf48c3e0>] (dsps_remove+0x1c/0x38 [musb_dsps])
[ 3880.706010] [<bf48c3e0>] (dsps_remove [musb_dsps]) from [<c05668cc>] (platform_drv_remove+0x28/0x48)
[ 3880.715190] [<c05668cc>] (platform_drv_remove) from [<c0564e3c>] (device_release_driver_internal+0xe4/0x1b4)
[ 3880.725065] [<c0564e3c>] (device_release_driver_internal) from [<c0562b2c>] (unbind_store+0x64/0xd8)
[ 3880.734253] [<c0562b2c>] (unbind_store) from [<c0350c58>] (kernfs_fop_write+0xf4/0x1cc)

Regards,
-Bin.



             reply	other threads:[~2019-04-01 18:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-01 18:20 Bin Liu [this message]
2019-04-01 18:20 ` [PATCH] usb: musb: Force-disable pullup on shutdown Bin Liu
  -- strict thread matches above, loose matches on Subject: below --
2019-04-03 18:54 Bin Liu
2019-04-03 18:54 ` [PATCH] " Bin Liu
2019-04-03 15:52 Paul Cercueil
2019-04-03 15:52 ` [PATCH] " Paul Cercueil
2019-04-03 15:46 Bin Liu
2019-04-03 15:46 ` [PATCH] " Bin Liu
2019-04-03 15:31 Paul Cercueil
2019-04-03 15:31 ` [PATCH] " Paul Cercueil
2019-04-03 13:26 Bin Liu
2019-04-03 13:26 ` [PATCH] " Bin Liu
2019-04-02 19:58 Paul Cercueil
2019-04-02 19:58 ` [PATCH] " Paul Cercueil
2019-04-01 17:46 Paul Cercueil
2019-04-01 17:46 ` [PATCH] " Paul Cercueil
2019-04-01 17:17 Bin Liu
2019-04-01 17:17 ` [PATCH] " Bin Liu
2019-03-21 14:42 Paul Cercueil
2019-03-21 14:42 ` [PATCH] " Paul Cercueil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190401182008.GL25852@uda0271908 \
    --to=b-liu@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=od@zcrc.me \
    --cc=paul@crapouillou.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.