From e8cbb4da04bcd28c24fe9e55ecb1e4ec9652a319 Mon Sep 17 00:00:00 2001 From: Ajay Dudani Date: Mon, 20 Aug 2012 14:44:40 -0700 Subject: [PATCH] EHCI: HSIC: Pass interrupt threshold value as platform data Interrupt threshold value is the maximum rate at which HSIC controller will issue interrupts to processor. Increasing this value results in fewer interrupts which may save power as processor has to handle fewer interrupts. Side effect of increasing this value is higher data latency. For fusion3, set the ITC(interrupt threshold control) to 5 and default for other targets. Also, allow ehci stack to set ITC value per controller basis. CRs-Fixed: 374661 Change-Id: I0e6bc210679ef211c2850ffbe1dfc80da2f65bf0 Signed-off-by: Hemant Kumar Signed-off-by: Ajay Dudani --- arch/arm/mach-msm/board-8064.c | 1 + drivers/usb/host/ehci-hcd.c | 3 +-- drivers/usb/host/ehci-msm-hsic.c | 5 +++-- drivers/usb/host/ehci.h | 2 +- include/linux/usb/msm_hsusb.h | 1 + 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-msm/board-8064.c b/arch/arm/mach-msm/board-8064.c index ab9004f882a..0e05407104a 100644 --- a/arch/arm/mach-msm/board-8064.c +++ b/arch/arm/mach-msm/board-8064.c @@ -2950,6 +2950,7 @@ static void __init apq8064_common_init(void) ARRAY_SIZE(common_not_mpq_devices)); enable_ddr3_regulator(); if (machine_is_apq8064_mtp()) { + msm_hsic_pdata.log2_irq_thresh = 5, apq8064_device_hsic_host.dev.platform_data = &msm_hsic_pdata; device_initialize(&apq8064_device_hsic_host.dev); } diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 73094389dd1..8d967cd85d1 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -691,8 +691,7 @@ static int ehci_init(struct usb_hcd *hcd) hw->hw_alt_next = QTD_NEXT(ehci, ehci->async->dummy->qtd_dma); /* clear interrupt enables, set irq latency */ - if (ehci->max_log2_irq_thresh) - log2_irq_thresh = ehci->max_log2_irq_thresh; + log2_irq_thresh = ehci->log2_irq_thresh; if (log2_irq_thresh < 0 || log2_irq_thresh > 6) log2_irq_thresh = 0; diff --git a/drivers/usb/host/ehci-msm-hsic.c b/drivers/usb/host/ehci-msm-hsic.c index cf31230a5de..52089394ec0 100644 --- a/drivers/usb/host/ehci-msm-hsic.c +++ b/drivers/usb/host/ehci-msm-hsic.c @@ -1516,13 +1516,15 @@ static int __devinit ehci_hsic_msm_probe(struct platform_device *pdev) mehci = hcd_to_hsic(hcd); mehci->dev = &pdev->dev; + pdata = mehci->dev->platform_data; mehci->ehci.susp_sof_bug = 1; mehci->ehci.reset_sof_bug = 1; mehci->ehci.resume_sof_bug = 1; - mehci->ehci.max_log2_irq_thresh = 6; + if (pdata) + mehci->ehci.log2_irq_thresh = pdata->log2_irq_thresh; res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, @@ -1607,7 +1609,6 @@ static int __devinit ehci_hsic_msm_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "mode debugfs file is" "not available\n"); - pdata = mehci->dev->platform_data; if (pdata && pdata->bus_scale_table) { mehci->bus_perf_client = msm_bus_scale_register_client(pdata->bus_scale_table); diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 7d29752225b..e0e6de0c015 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h @@ -135,7 +135,7 @@ struct ehci_hcd { /* one per controller */ ktime_t last_periodic_enable; u32 command; - unsigned max_log2_irq_thresh; + unsigned log2_irq_thresh; /* SILICON QUIRKS */ unsigned no_selective_suspend:1; diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h index 54e7e97b5c3..21cb5d6ac22 100644 --- a/include/linux/usb/msm_hsusb.h +++ b/include/linux/usb/msm_hsusb.h @@ -379,6 +379,7 @@ struct msm_hsic_host_platform_data { unsigned strobe; unsigned data; struct msm_bus_scale_pdata *bus_scale_table; + unsigned log2_irq_thresh; }; struct msm_usb_host_platform_data {