Merge "usb: xhci-plat: Add DT parameter to program xhci imod_interval"
This commit is contained in:
commit
16ee74ee09
4 changed files with 26 additions and 0 deletions
|
@ -60,6 +60,7 @@ Optional properties:
|
||||||
- snps,num-normal-evt-buffs: If present, specifies number of normal event buffers. Default is 1.
|
- snps,num-normal-evt-buffs: If present, specifies number of normal event buffers. Default is 1.
|
||||||
- snps,num-gsi-evt-buffs: If present, specifies number of GSI based hardware accelerated event buffers.
|
- snps,num-gsi-evt-buffs: If present, specifies number of GSI based hardware accelerated event buffers.
|
||||||
1 event buffer is needed per h/w accelerated endpoint.
|
1 event buffer is needed per h/w accelerated endpoint.
|
||||||
|
- xhci-imod-value: Interrupt moderation interval for host mode (in increments of 250nsec).
|
||||||
|
|
||||||
This is usually a subnode to DWC3 glue to which it is connected.
|
This is usually a subnode to DWC3 glue to which it is connected.
|
||||||
|
|
||||||
|
@ -74,4 +75,5 @@ dwc3@4a030000 {
|
||||||
tx-fifo-resize;
|
tx-fifo-resize;
|
||||||
snps,usb3-u1u2-disable;
|
snps,usb3-u1u2-disable;
|
||||||
snps,num-gsi-evt-buffs = <0x2>;
|
snps,num-gsi-evt-buffs = <0x2>;
|
||||||
|
xhci-imod-value = <4000>;
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,6 +25,7 @@ int dwc3_host_init(struct dwc3 *dwc)
|
||||||
struct platform_device *xhci;
|
struct platform_device *xhci;
|
||||||
struct usb_xhci_pdata pdata;
|
struct usb_xhci_pdata pdata;
|
||||||
int ret;
|
int ret;
|
||||||
|
struct device_node *node = dwc->dev->of_node;
|
||||||
|
|
||||||
xhci = platform_device_alloc("xhci-hcd", PLATFORM_DEVID_AUTO);
|
xhci = platform_device_alloc("xhci-hcd", PLATFORM_DEVID_AUTO);
|
||||||
if (!xhci) {
|
if (!xhci) {
|
||||||
|
@ -52,6 +53,11 @@ int dwc3_host_init(struct dwc3 *dwc)
|
||||||
|
|
||||||
pdata.usb3_lpm_capable = dwc->usb3_lpm_capable;
|
pdata.usb3_lpm_capable = dwc->usb3_lpm_capable;
|
||||||
|
|
||||||
|
ret = of_property_read_u32(node, "xhci-imod-value",
|
||||||
|
&pdata.imod_interval);
|
||||||
|
if (ret)
|
||||||
|
pdata.imod_interval = 0; /* use default xhci.c value */
|
||||||
|
|
||||||
ret = platform_device_add_data(xhci, &pdata, sizeof(pdata));
|
ret = platform_device_add_data(xhci, &pdata, sizeof(pdata));
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(dwc->dev, "couldn't add platform data to xHCI device\n");
|
dev_err(dwc->dev, "couldn't add platform data to xHCI device\n");
|
||||||
|
|
|
@ -138,6 +138,8 @@ static int xhci_plat_probe(struct platform_device *pdev)
|
||||||
struct clk *clk;
|
struct clk *clk;
|
||||||
int ret;
|
int ret;
|
||||||
int irq;
|
int irq;
|
||||||
|
u32 temp, imod;
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
if (usb_disabled())
|
if (usb_disabled())
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
@ -256,6 +258,18 @@ static int xhci_plat_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
device_wakeup_enable(&xhci->shared_hcd->self.root_hub->dev);
|
device_wakeup_enable(&xhci->shared_hcd->self.root_hub->dev);
|
||||||
|
|
||||||
|
/* override imod interval if specified */
|
||||||
|
if (pdata && pdata->imod_interval) {
|
||||||
|
imod = pdata->imod_interval & ER_IRQ_INTERVAL_MASK;
|
||||||
|
spin_lock_irqsave(&xhci->lock, flags);
|
||||||
|
temp = readl_relaxed(&xhci->ir_set->irq_control);
|
||||||
|
temp &= ~ER_IRQ_INTERVAL_MASK;
|
||||||
|
temp |= imod;
|
||||||
|
writel_relaxed(temp, &xhci->ir_set->irq_control);
|
||||||
|
spin_unlock_irqrestore(&xhci->lock, flags);
|
||||||
|
dev_dbg(&pdev->dev, "%s: imod set to %u\n", __func__, imod);
|
||||||
|
}
|
||||||
|
|
||||||
ret = device_create_file(&pdev->dev, &dev_attr_config_imod);
|
ret = device_create_file(&pdev->dev, &dev_attr_config_imod);
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_err(&pdev->dev, "%s: unable to create imod sysfs entry\n",
|
dev_err(&pdev->dev, "%s: unable to create imod sysfs entry\n",
|
||||||
|
|
|
@ -19,9 +19,13 @@
|
||||||
* @usb3_lpm_capable: determines if this xhci platform supports USB3
|
* @usb3_lpm_capable: determines if this xhci platform supports USB3
|
||||||
* LPM capability
|
* LPM capability
|
||||||
*
|
*
|
||||||
|
* @imod_interval: minimum inter-interrupt interval. Specified in
|
||||||
|
* 250nsec increments.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
struct usb_xhci_pdata {
|
struct usb_xhci_pdata {
|
||||||
unsigned usb3_lpm_capable:1;
|
unsigned usb3_lpm_capable:1;
|
||||||
|
unsigned imod_interval;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __USB_CORE_XHCI_PDRIVER_H */
|
#endif /* __USB_CORE_XHCI_PDRIVER_H */
|
||||||
|
|
Loading…
Add table
Reference in a new issue