Merge "ODROID-COMMON: usb: xhci: Make sg_tablesize can be set by bootargs" into odroidn2-4.9.y

This commit is contained in:
Dongjin Kim
2019-07-01 12:02:45 +09:00
committed by Gerrit Code Review

View File

@@ -48,6 +48,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
/*
* xhci_handshake - spin reading hc until handshake completes or fails
* @ptr: address of hc register to be read
@@ -4914,6 +4918,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;
@@ -5145,5 +5155,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);
module_exit(xhci_hcd_fini);