Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: renesas_usbhs: Modify ep.caps.type_xxx and usb_ep_maxpacket_limit()

This patch modifies the ep.caps.type_{iso,bulk,int} setting and
the second argument of usb_ep_maxpacket_limit() using
the dparam.pipe_configs.

In the previous code, all the type_{iso,bulk,int} were set to true.
However, to avoid waste time for finding suitable pipe in usb_ep_enable(),
this driver should set correct type.
Also the second argument of usb_ep_maxpacket_limit() was set to 512
even if the pipe is isochronous or interrupt. So, this driver could
not bind a gadget driver like the g_audio driver.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>

authored by

Yoshihiro Shimoda and committed by
Felipe Balbi
64c5f48b 51f141a9

+12 -7
+12 -7
drivers/usb/renesas_usbhs/mod_gadget.c
··· 1042 1042 struct usbhsg_gpriv *gpriv; 1043 1043 struct usbhsg_uep *uep; 1044 1044 struct device *dev = usbhs_priv_to_dev(priv); 1045 + struct renesas_usbhs_driver_pipe_config *pipe_configs = 1046 + usbhs_get_dparam(priv, pipe_configs); 1045 1047 int pipe_size = usbhs_get_dparam(priv, pipe_size); 1046 1048 int i; 1047 1049 int ret; ··· 1113 1111 gpriv->gadget.ep0 = &uep->ep; 1114 1112 usb_ep_set_maxpacket_limit(&uep->ep, 64); 1115 1113 uep->ep.caps.type_control = true; 1116 - } 1117 - /* init normal pipe */ 1118 - else { 1119 - usb_ep_set_maxpacket_limit(&uep->ep, 512); 1120 - uep->ep.caps.type_iso = true; 1121 - uep->ep.caps.type_bulk = true; 1122 - uep->ep.caps.type_int = true; 1114 + } else { 1115 + /* init normal pipe */ 1116 + if (pipe_configs[i].type == USB_ENDPOINT_XFER_ISOC) 1117 + uep->ep.caps.type_iso = true; 1118 + if (pipe_configs[i].type == USB_ENDPOINT_XFER_BULK) 1119 + uep->ep.caps.type_bulk = true; 1120 + if (pipe_configs[i].type == USB_ENDPOINT_XFER_INT) 1121 + uep->ep.caps.type_int = true; 1122 + usb_ep_set_maxpacket_limit(&uep->ep, 1123 + pipe_configs[i].bufsize); 1123 1124 list_add_tail(&uep->ep.ep_list, &gpriv->gadget.ep_list); 1124 1125 } 1125 1126 uep->ep.caps.dir_in = true;