OpenCloudOS-Kernel/drivers/usb/renesas_usbhs
Yoshihiro Shimoda b1d25e6ee5 usb: renesas_usbhs: Clear PIPECFG for re-enabling pipe with other EPNUM
According to the datasheet, this controller has a restriction
which "set an endpoint number so that combinations of the DIR bit and
the EPNUM bits do not overlap.". However, since the udc core driver is
possible to assign a bulk pipe as an interrupt endpoint, an endpoint
number may not match the pipe number. After that, when user rebinds
another gadget driver, this driver broke the restriction because
the driver didn't clear any configuration in usb_ep_disable().

Example:
 # modprobe g_ncm
 Then, EP3 = pipe 3, EP4 = pipe 4, EP5 = pipe 6
 # rmmod g_ncm
 # modprobe g_hid
 Then, EP3 = pipe 6, EP4 = pipe 7.
 So, pipe 3 and pipe 6 are set as EP3.

So, clear PIPECFG register in usbhs_pipe_free().

Fixes: dfb87b8bfe ("usb: renesas_usbhs: gadget: fix re-enabling pipe without re-connecting")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Link: https://lore.kernel.org/r/1615168538-26101-1-git-send-email-yoshihiro.shimoda.uh@renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10 09:36:13 +01:00
..
Kconfig usb: remove redundant 'default n' from Kconfig-s 2019-05-21 10:06:22 +02:00
Makefile usb: renesas_usbhs: Add support for RZ/A2 2019-05-21 10:25:59 +02:00
common.c usb: renesas_usbhs: Switch to GPIO descriptor 2019-12-30 20:37:42 +01:00
common.h usb: renesas_usbhs: Use the correct style for SPDX License Identifier 2020-04-23 15:28:14 +02:00
fifo.c usb: renesas_usbhs: Clear pipe running flag in usbhs_pkt_pop() 2021-02-01 14:09:46 +01:00
fifo.h usb: renesas_usbhs: getting residue from callback_result 2020-06-24 17:14:44 +02:00
mod.c usb: renesas_usbhs: enable DVSE interrupt 2019-10-04 14:16:54 +02:00
mod.h usb: renesas_usbhs: Use the correct style for SPDX License Identifier 2020-04-23 15:28:14 +02:00
mod_gadget.c usb: Use fallthrough pseudo-keyword 2020-07-10 08:55:17 +02:00
mod_host.c usb: add a HCD_DMA flag instead of guestimating DMA capabilities 2019-08-21 10:03:35 -07:00
pipe.c usb: renesas_usbhs: Clear PIPECFG for re-enabling pipe with other EPNUM 2021-03-10 09:36:13 +01:00
pipe.h usb: renesas_usbhs: Use the correct style for SPDX License Identifier 2020-04-23 15:28:14 +02:00
rcar2.c phy: for 5.6 2020-01-17 07:52:26 +01:00
rcar2.h usb: renesas_usbhs: Use the correct style for SPDX License Identifier 2020-04-23 15:28:14 +02:00
rcar3.c usb: renesas_usbhs: Use renesas_usbhs_platform_info on of_device_id.data 2019-06-26 10:33:09 +08:00
rcar3.h usb: renesas_usbhs: Use the correct style for SPDX License Identifier 2020-04-23 15:28:14 +02:00
rza.c usb: renesas_usbhs: Use renesas_usbhs_platform_info on of_device_id.data 2019-06-26 10:33:09 +08:00
rza.h usb: renesas_usbhs: Use the correct style for SPDX License Identifier 2020-04-23 15:28:14 +02:00
rza2.c phy: core: Add consumer device link support 2020-01-08 12:48:47 +05:30