Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38134ebe authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: dwc3: Implement interrupt moderation" into msm-4.9

parents 1443f5b0 26cac202
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1109,6 +1109,15 @@ int dwc3_core_pre_init(struct dwc3 *dwc)

#define DWC3_ALIGN_MASK		(16 - 1)

/* check whether the core supports IMOD */
bool dwc3_has_imod(struct dwc3 *dwc)
{
	return ((dwc3_is_usb3(dwc) &&
		dwc->revision >= DWC3_REVISION_300A) ||
		(dwc3_is_usb31(dwc) &&
		dwc->revision >= DWC3_USB31_REVISION_120A));
}

static int dwc3_probe(struct platform_device *pdev)
{
	struct device		*dev = &pdev->dev;
+15 −0
Original line number Diff line number Diff line
@@ -68,6 +68,7 @@
#define DWC3_DEVICE_EVENT_OVERFLOW		11

#define DWC3_GEVNTCOUNT_MASK	0xfffc
#define DWC3_GEVNTCOUNT_EHB	(1 << 31)
#define DWC3_GSNPSID_MASK	0xffff0000
#define DWC3_GSNPSREV_MASK	0xffff

@@ -150,6 +151,8 @@
#define DWC3_DEPCMDPAR0		0x08
#define DWC3_DEPCMD		0x0c

#define DWC3_DEV_IMOD(n)	(0xca00 + (n * 0x4))

/* OTG Registers */
#define DWC3_OCFG		0xcc00
#define DWC3_OCTL		0xcc04
@@ -485,6 +488,11 @@
#define DWC3_DEPCMD_TYPE_BULK		2
#define DWC3_DEPCMD_TYPE_INTR		3

#define DWC3_DEV_IMOD_COUNT_SHIFT	16
#define DWC3_DEV_IMOD_COUNT_MASK	(0xffff << 16)
#define DWC3_DEV_IMOD_INTERVAL_SHIFT	0
#define DWC3_DEV_IMOD_INTERVAL_MASK	(0xffff << 0)

#define DWC_CTRL_COUNT	10
#define NUM_LOG_PAGES	12

@@ -939,6 +947,8 @@ struct dwc3_scratchpad_array {
 * @vbus_draw: current to be drawn from USB
 * @index: dwc3 instance's number
 * @dwc_ipc_log_ctxt: dwc3 ipc log context
 * @imod_interval: set the interrupt moderation interval in 250ns
 *			increments or 0 to disable.
 */
struct dwc3 {
	struct usb_ctrlrequest	*ctrl_req;
@@ -1027,6 +1037,7 @@ struct dwc3 {
 */
#define DWC3_REVISION_IS_DWC31		0x80000000
#define DWC3_USB31_REVISION_110A	(0x3131302a | DWC3_REVISION_IS_DWC31)
#define DWC3_USB31_REVISION_120A	(0x3132302a | DWC3_REVISION_IS_DWC31)

	enum dwc3_ep0_next	ep0_next_event;
	enum dwc3_ep0_state	ep0state;
@@ -1108,6 +1119,8 @@ struct dwc3 {
	bool			b_suspend;
	unsigned int		vbus_draw;

	u16			imod_interval;

	/* IRQ timing statistics */
	int			irq;
	unsigned long		ep_cmd_timeout_cnt;
@@ -1295,6 +1308,8 @@ static inline bool dwc3_is_usb31(struct dwc3 *dwc)
	return !!(dwc->revision & DWC3_REVISION_IS_DWC31);
}

bool dwc3_has_imod(struct dwc3 *dwc);

#if IS_ENABLED(CONFIG_USB_DWC3_HOST) || IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)
int dwc3_host_init(struct dwc3 *dwc);
void dwc3_host_exit(struct dwc3 *dwc);
+16 −0
Original line number Diff line number Diff line
@@ -2099,6 +2099,18 @@ static int __dwc3_gadget_start(struct dwc3 *dwc)
	u32			reg;

	dbg_event(0xFF, "__Gadgetstart", 0);

	/*
	 * Use IMOD if enabled via dwc->imod_interval. Otherwise, if
	 * the core supports IMOD, disable it.
	 */
	if (dwc->imod_interval) {
		dwc3_writel(dwc->regs, DWC3_DEV_IMOD(0), dwc->imod_interval);
		dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), DWC3_GEVNTCOUNT_EHB);
	} else if (dwc3_has_imod(dwc)) {
		dwc3_writel(dwc->regs, DWC3_DEV_IMOD(0), 0);
	}

	reg = dwc3_readl(dwc->regs, DWC3_DCFG);
	reg &= ~(DWC3_DCFG_SPEED_MASK);

@@ -3485,6 +3497,10 @@ static irqreturn_t dwc3_process_event_buf(struct dwc3 *dwc)
	reg &= ~DWC3_GEVNTSIZ_INTMASK;
	dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(0), reg);

	if (dwc->imod_interval)
		dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0),
				DWC3_GEVNTCOUNT_EHB);

	return ret;
}