From: Anji jonnala <anjir@xxxxxxxxxxxxxx> ITC (Interrupt Threshold Control) field is to set the maximum rate at which the device controller will issue interrupts. The maximum interrupt interval is measured in micro frames. Valid values are 0, 1, 2, 4, 8, 16, 32, 64. The default value is 8 micro frames. Set ITC to zero for MSM to gain performance. Signed-off-by: Anji jonnala <anjir@xxxxxxxxxxxxxx> Signed-off-by: Pavankumar Kondeti <pkondeti@xxxxxxxxxxxxxx> --- drivers/usb/gadget/ci13xxx_msm.c | 3 ++- drivers/usb/gadget/ci13xxx_udc.c | 11 +++++++++++ drivers/usb/gadget/ci13xxx_udc.h | 3 +++ 3 files changed, 16 insertions(+), 1 deletions(-) diff --git a/drivers/usb/gadget/ci13xxx_msm.c b/drivers/usb/gadget/ci13xxx_msm.c index 139ac94..aa8319b 100644 --- a/drivers/usb/gadget/ci13xxx_msm.c +++ b/drivers/usb/gadget/ci13xxx_msm.c @@ -64,7 +64,8 @@ static struct ci13xxx_udc_driver ci13xxx_msm_udc_driver = { .flags = CI13XXX_REGS_SHARED | CI13XXX_REQUIRE_TRANSCEIVER | CI13XXX_PULLUP_ON_VBUS | - CI13XXX_DISABLE_STREAMING, + CI13XXX_DISABLE_STREAMING | + CI13XXX_ZERO_ITC, .notify_event = ci13xxx_msm_notify_event, }; diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c index e09178b..15857e0 100644 --- a/drivers/usb/gadget/ci13xxx_udc.c +++ b/drivers/usb/gadget/ci13xxx_udc.c @@ -318,6 +318,17 @@ static int hw_device_reset(struct ci13xxx *udc) hw_cwrite(CAP_USBMODE, USBMODE_CM, USBMODE_CM_DEVICE); hw_cwrite(CAP_USBMODE, USBMODE_SLOM, USBMODE_SLOM); /* HW >= 2.3 */ + /* + * ITC (Interrupt Threshold Control) field is to set the maximum + * rate at which the device controller will issue interrupts. + * The maximum interrupt interval measured in micro frames. + * Valid values are 0, 1, 2, 4, 8, 16, 32, 64. The default value is + * 8 micro frames. If CPU can handle interrupts at faster rate, ITC + * can be set to lesser value to gain performance. + */ + if (udc->udc_driver->flags & CI13XXX_ZERO_ITC) + hw_cwrite(CAP_USBCMD, USBCMD_ITC_MASK, USBCMD_ITC(0)); + if (hw_cread(CAP_USBMODE, USBMODE_CM) != USBMODE_CM_DEVICE) { pr_err("cannot enter in device mode"); pr_err("lpm = %i", hw_bank.lpm); diff --git a/drivers/usb/gadget/ci13xxx_udc.h b/drivers/usb/gadget/ci13xxx_udc.h index 2370777..a230325 100644 --- a/drivers/usb/gadget/ci13xxx_udc.h +++ b/drivers/usb/gadget/ci13xxx_udc.h @@ -108,6 +108,7 @@ struct ci13xxx_udc_driver { #define CI13XXX_REQUIRE_TRANSCEIVER BIT(1) #define CI13XXX_PULLUP_ON_VBUS BIT(2) #define CI13XXX_DISABLE_STREAMING BIT(3) +#define CI13XXX_ZERO_ITC BIT(4) #define CI13XXX_CONTROLLER_RESET_EVENT 0 #define CI13XXX_CONTROLLER_STOPPED_EVENT 1 @@ -189,6 +190,8 @@ struct ci13xxx { #define USBMODE_CM_HOST (0x03UL << 0) #define USBMODE_SLOM BIT(3) #define USBMODE_SDIS BIT(4) +#define USBCMD_ITC(n) (n << 16) /* n = 0, 1, 2, 4, 8, 16, 32, 64 */ +#define USBCMD_ITC_MASK (0xFF << 16) /* ENDPTCTRL */ #define ENDPTCTRL_RXS BIT(0) -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum. -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html