diff mbox

[U-Boot,08/14] usb: dwc3: Add helper functions to enable snooping and burst settings

Message ID 1495022706-20200-8-git-send-email-yinbo.zhu@nxp.com
State Changes Requested
Delegated to: York Sun
Headers show

Commit Message

Yinbo Zhu May 17, 2017, 12:05 p.m. UTC
From: Rajat Srivastava <rajat.srivastava@nxp.com>

Adds helper functions to enable snooping and outstanding burst beat
settings.

Signed-off-by: Rajat Srivastava <rajat.srivastava@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
---
 drivers/usb/dwc3/core.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/dwc3/core.h |  7 +++++++
 2 files changed, 52 insertions(+)

Comments

York Sun May 25, 2017, 5:53 p.m. UTC | #1
On 05/17/2017 07:01 AM, yinbo.zhu wrote:
> From: Rajat Srivastava <rajat.srivastava@nxp.com>
> 
> Adds helper functions to enable snooping and outstanding burst beat
> settings.
> 
> Signed-off-by: Rajat Srivastava <rajat.srivastava@nxp.com>
> Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
> ---
>   drivers/usb/dwc3/core.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
>   drivers/usb/dwc3/core.h |  7 +++++++
>   2 files changed, 52 insertions(+)
> 

Yinbo,

You were posting multiple times for the same patch. You got comment on 
the other thread http://patchwork.ozlabs.org/patch/762973/. Please split 
this set to separate the SoC errata patches (first 7).

York
York Sun Sept. 14, 2017, 7:59 p.m. UTC | #2
On 05/17/2017 05:05 AM, yinbo.zhu wrote:
> From: Rajat Srivastava <rajat.srivastava@nxp.com>
> 
> Adds helper functions to enable snooping and outstanding burst beat
> settings.
> 
> Signed-off-by: Rajat Srivastava <rajat.srivastava@nxp.com>
> Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
> ---

Please re-submit this set. Some of them are accepted as separated patch set.

York
diff mbox

Patch

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 85cc96a..4ac599a 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -599,6 +599,51 @@  static void dwc3_core_exit_mode(struct dwc3 *dwc)
 
 #define DWC3_ALIGN_MASK		(16 - 1)
 
+void dwc3_core_incr_burst_enable(int index, int btype_incr_val,
+				 int breq_limit)
+{
+	struct dwc3 *dwc;
+	u32 reg;
+
+	list_for_each_entry(dwc, &dwc3_list, list) {
+		if (dwc->index != index)
+			continue;
+
+		/*
+		 * Change burst beat and outstanding pipelined
+		 * transfers requests
+		 */
+		reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);
+		reg = (reg & ~DWC3_INCR_BTYPE_MASK) | btype_incr_val;
+		dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);
+
+		reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG1);
+		reg = (reg & ~DWC3_BREQ_LIMIT_MASK) | (breq_limit << 8);
+		dwc3_writel(dwc->regs, DWC3_GSBUSCFG1, reg);
+		break;
+	}
+}
+
+void dwc3_core_set_snooping(int index, bool snoop)
+{
+	struct dwc3 *dwc;
+	u32 reg;
+
+	list_for_each_entry(dwc, &dwc3_list, list) {
+		if (dwc->index != index)
+			continue;
+
+		/* Enable/Disable snooping */
+		reg = dwc3_readl(dwc->regs, DWC3_GSBUSCFG0);
+		if (snoop)
+			reg |= DWC3_SNOOP_ENABLE;
+		else
+			reg &= ~DWC3_SNOOP_ENABLE;
+		dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);
+		break;
+	}
+}
+
 /**
  * dwc3_uboot_init - dwc3 core uboot initialization code
  * @dwc3_dev: struct dwc3_device containing initialization data
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 72d2fcd..455e7fa 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -593,6 +593,13 @@  struct dwc3_hwparams {
 /* HWPARAMS7 */
 #define DWC3_RAM1_DEPTH(n)	((n) & 0xffff)
 
+/* GSBUSCFG0 */
+#define DWC3_SNOOP_ENABLE	(0x22220000)
+#define DWC3_INCR_BTYPE_MASK	(0xff)
+
+/* GSBUSCFG1 */
+#define DWC3_BREQ_LIMIT_MASK	(0xf00)
+
 struct dwc3_request {
 	struct usb_request	request;
 	struct list_head	list;