ODROID-COMMON: usb: xhci: Make sg_tablesize can be set by bootargs

Change-Id: Ic9e9db2ef3291c10bf4481791e0d38389e55f732
Signed-off-by: Joshua Yang <joshua.yang@hardkernel.com>
This commit is contained in:
Joshua Yang
2019-06-24 14:52:30 +09:00
committed by Chris KIM
parent a6ba50aec7
commit fdc846f582

View File

@@ -47,6 +47,10 @@ static unsigned int quirks;
module_param(quirks, uint, S_IRUGO);
MODULE_PARM_DESC(quirks, "Bit flags for quirks to be enabled as default");
#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON)
static unsigned int kpara_sg_tablesize;
#endif
/* TODO: copied from ehci-hcd.c - can this be refactored? */
/*
* xhci_handshake - spin reading hc until handshake completes or fails
@@ -4862,6 +4866,12 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
/* Accept arbitrarily long scatter-gather lists */
hcd->self.sg_tablesize = ~0;
#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON)
if (kpara_sg_tablesize > 0)
hcd->self.sg_tablesize = kpara_sg_tablesize;
pr_info("usb: xhci: determined sg_tablesize: %u", hcd->self.sg_tablesize);
#endif
/* support to build packet from discontinuous buffers */
hcd->self.no_sg_constraint = 1;
@@ -5093,5 +5103,20 @@ static int __init xhci_hcd_init(void)
*/
static void __exit xhci_hcd_fini(void) { }
#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON)
static int __init get_sg_tablesize(char *str)
{
int ret = kstrtouint(str, 0, &kpara_sg_tablesize);
if (ret != 0 || kpara_sg_tablesize == 0) {
pr_info("usb: xhci: [%s]: Invalid sg_tablesize on bootargs. It will use default value.", __func__);
ret = -EINVAL;
}
return ret;
}
__setup("usb-xhci.tablesize=", get_sg_tablesize);
#endif
module_init(xhci_hcd_init);
module_exit(xhci_hcd_fini);