]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
usb: dwc2: gadget: remove D+ pull-up while no vbus with usb-role-switch
authorAmelie Delaunay <amelie.delaunay@foss.st.com>
Wed, 22 Jun 2022 16:07:17 +0000 (18:07 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:45:42 +0000 (11:45 +0200)
commit9f69ec6766aa1d8e5e06ad338b293aeb59cf97a8
tree27e0a2ee9fb1f8da46e460ab452274ae1173c10d
parent0483ffc02ebb953124c592485a5c48ac4ffae5fe
usb: dwc2: gadget: remove D+ pull-up while no vbus with usb-role-switch

[ Upstream commit db638c6500abaffb8f7770b2a69c40d003d54ae1 ]

When using usb-role-switch, D+ pull-up is set as soon as DTCL_SFTDISCON is
cleared, whatever the vbus valid signal state is. The pull-up should not
be set when vbus isn't present (this is determined by the drd controller).

This patch ensures that B-Session (so Peripheral role + vbus valid signal)
is valid before clearing the DCTL_SFTDISCON bit when role switch is used.
Keep original behavior when usb-role-switch isn't used.

Acked-by: Minas Harutyunyan <hminas@synopsys.com>
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20220622160717.314580-1-fabrice.gasnier@foss.st.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/dwc2/gadget.c