aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/chipidea/core.c
diff options
context:
space:
mode:
authorPeter Chen <peter.chen@freescale.com>2014-09-22 04:45:39 -0400
committerPeter Chen <peter.chen@freescale.com>2015-08-13 21:13:11 -0400
commitdf96ed8dced21426c54c7f69cf7513e75280957a (patch)
tree863774459f0a85a6487545fe8bc8c9e0a899c525 /drivers/usb/chipidea/core.c
parent1bd57127d4aaff518cf93f4809ec2f11b2baf865 (diff)
usb: chipidea: introduce ITC tuning interface
ITC (Interrupt Threshold Control) is used to set the maximum rate at which the host/device controller will issue interrupts. The default value is 8 (1ms) for it. EHCI core will modify it to 1, but device mode keeps it as default value. In some use cases like Android ADB, it only has one usb request for each direction, and maximum payload data is only 4KB, so the speed is 4MB/s at most, it needs controller to trigger interrupt as fast as possible to increase the speed. The USB performance will be better if the interrupt can be triggered faster. Reduce ITC value is benefit for USB performance, but the interrupt number is increased at the same time, it may increase cpu utilization too. Most of use case cares about performance, but some may care about cpu utilization, so, we leave a platform interface for user. We set ITC as 1 (1 micro-frame) as default value which is aligned with ehci core default value. Signed-off-by: Peter Chen <peter.chen@freescale.com>
Diffstat (limited to 'drivers/usb/chipidea/core.c')
-rw-r--r--drivers/usb/chipidea/core.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 1b1dd80897f7..845d0d7d28e6 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -425,6 +425,9 @@ void ci_platform_configure(struct ci_hdrc *ci)
425 425
426 if (ci->platdata->flags & CI_HDRC_SET_NON_ZERO_TTHA) 426 if (ci->platdata->flags & CI_HDRC_SET_NON_ZERO_TTHA)
427 hw_write(ci, OP_TTCTRL, TTCTRL_TTHA_MASK, TTCTRL_TTHA); 427 hw_write(ci, OP_TTCTRL, TTCTRL_TTHA_MASK, TTCTRL_TTHA);
428
429 hw_write(ci, OP_USBCMD, 0xff0000, ci->platdata->itc_setting << 16);
430
428} 431}
429 432
430/** 433/**
@@ -576,6 +579,8 @@ static irqreturn_t ci_irq(int irq, void *data)
576static int ci_get_platdata(struct device *dev, 579static int ci_get_platdata(struct device *dev,
577 struct ci_hdrc_platform_data *platdata) 580 struct ci_hdrc_platform_data *platdata)
578{ 581{
582 int ret;
583
579 if (!platdata->phy_mode) 584 if (!platdata->phy_mode)
580 platdata->phy_mode = of_usb_get_phy_mode(dev->of_node); 585 platdata->phy_mode = of_usb_get_phy_mode(dev->of_node);
581 586
@@ -607,6 +612,17 @@ static int ci_get_platdata(struct device *dev,
607 if (of_usb_get_maximum_speed(dev->of_node) == USB_SPEED_FULL) 612 if (of_usb_get_maximum_speed(dev->of_node) == USB_SPEED_FULL)
608 platdata->flags |= CI_HDRC_FORCE_FULLSPEED; 613 platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
609 614
615 platdata->itc_setting = 1;
616 if (of_find_property(dev->of_node, "itc-setting", NULL)) {
617 ret = of_property_read_u32(dev->of_node, "itc-setting",
618 &platdata->itc_setting);
619 if (ret) {
620 dev_err(dev,
621 "failed to get itc-setting\n");
622 return ret;
623 }
624 }
625
610 return 0; 626 return 0;
611} 627}
612 628