Skip to content

Commit b1d25e6

Browse files
shimodaygregkh
authored andcommitted
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: dfb87b8 ("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>
1 parent 2664deb commit b1d25e6

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

  • drivers/usb/renesas_usbhs

drivers/usb/renesas_usbhs/pipe.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,8 @@ struct usbhs_pipe *usbhs_pipe_malloc(struct usbhs_priv *priv,
746746

747747
void usbhs_pipe_free(struct usbhs_pipe *pipe)
748748
{
749+
usbhsp_pipe_select(pipe);
750+
usbhsp_pipe_cfg_set(pipe, 0xFFFF, 0);
749751
usbhsp_put_pipe(pipe);
750752
}
751753

0 commit comments

Comments
 (0)