Skip to contentSkip to conversation

armv8/fsl-layerscape: add dwc3 gadget driver support

PATCH Superseded Rajat Srivastava 6 participants 22 messages Jun 6, 2016 – Jul 27, 2016

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover armv8/fsl-layerscape: add dwc3 gadget driver support

From: Rajesh Bhagat <[email protected]>

Adds support for dwc3 gadget driver for ARM v8 platform of layerscape series. Currently this patch has been tested for LS1043A

Rajat Srivastava (3):
usb: dwc3: Add helper functions to enable snooping and burst settings armv8/fsl-layerscape: add dwc3 gadget driver support armv8/fsl-layerscape: enable dwc3 gadget driver support

Rajesh Bhagat (1):
usb: ums: support multiple controllers using controller_index

 arch/arm/cpu/armv8/fsl-layerscape/soc.c            | 93 ++++++++++++++++++++++
 .../include/asm/arch-fsl-layerscape/immap_lsch2.h  |  6 ++
 cmd/usb_mass_storage.c                             |  2 +-
 drivers/usb/dwc3/core.c                            | 45 +++++++++++
 drivers/usb/dwc3/core.h                            |  7 ++
 drivers/usb/gadget/f_mass_storage.c                | 11 ++-
 include/configs/ls1043aqds.h                       | 15 ++++
 include/usb_mass_storage.h                         |  2 +-
 8 files changed, 177 insertions(+), 4 deletions(-)
Signature · 1 line
2.6.2.198.g614a2ac
#1 lore raw

PATCH v2 1/4 usb: ums: support multiple controllers using controller_index

From: Rajesh Bhagat <[email protected]>

Adds a new field in fsg_common namely controller_index to support multiple controllers usb gadget support.

---
Changes for v2:
- Changes type of fsg_main_thread argument to unsigned int

 cmd/usb_mass_storage.c              |  2 +-
 drivers/usb/gadget/f_mass_storage.c | 11 +++++++++--
 include/usb_mass_storage.h          |  2 +-
 3 files changed, 11 insertions(+), 4 deletions(-)
cmd/usb_mass_storage.c +1 -1
index b05913a..bf80d37 100644
@@ -214,7 +214,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
 	while (1) {
 		usb_gadget_handle_interrupts(controller_index);
 
-		rc = fsg_main_thread(NULL);
+		rc = fsg_main_thread(controller_index);
 		if (rc) {
 			/* Check I/O error */
 			if (rc == -EIO)
drivers/usb/gadget/f_mass_storage.c +9 -2
index 1ecb92a..27ca5fe 100644
@@ -362,6 +362,7 @@ struct fsg_common {
 	char inquiry_string[8 + 16 + 4 + 1];
 
 	struct kref		ref;
+	unsigned int controller_index;
 };
 
 struct fsg_config {
@@ -691,7 +692,7 @@ static int sleep_thread(struct fsg_common *common)
 			k = 0;
 		}
 
-		usb_gadget_handle_interrupts(0);
+		usb_gadget_handle_interrupts(common->controller_index);
 	}
 	common->thread_wakeup_needed = 0;
 	return rc;
@@ -2402,10 +2403,14 @@ static void handle_exception(struct fsg_common *common)
 
 /*-------------------------------------------------------------------------*/
 
-int fsg_main_thread(void *common_)
+int fsg_main_thread(unsigned int controller_index)
 {
 	int ret;
 	struct fsg_common	*common = the_fsg_common;
+
+	/* update the controller_index */
+	common->controller_index = controller_index;
+
 	/* The main loop */
 	do {
 		if (exception_in_progress(common)) {
@@ -2476,6 +2481,7 @@ static struct fsg_common *fsg_common_init(struct fsg_common *common,
 
 	common->ops = NULL;
 	common->private_data = NULL;
+	common->controller_index = 0;
 
 	common->gadget = gadget;
 	common->ep0 = gadget->ep0;
@@ -2770,6 +2776,7 @@ int fsg_add(struct usb_configuration *c)
 
 	fsg_common->ops = NULL;
 	fsg_common->private_data = NULL;
+	fsg_common->controller_index = 0;
 
 	the_fsg_common = fsg_common;
 
include/usb_mass_storage.h +1 -1
index 8229f62..f21cc7a 100644
@@ -28,6 +28,6 @@ struct ums {
 
 int fsg_init(struct ums *ums_devs, int count);
 void fsg_cleanup(void);
-int fsg_main_thread(void *);
+int fsg_main_thread(unsigned int);
 int fsg_add(struct usb_configuration *c);
 #endif /* __USB_MASS_STORAGE_H__ */
Signature · 1 line
2.6.2.198.g614a2ac
#2 lore raw

PATCH v2 1/4 usb: ums: support multiple controllers using controller_index

Hi Rajat,

First of all, sorry for late reply. I was not in the office.

Quoted 87 lines

From: Rajesh Bhagat <[email protected]>

Adds a new field in fsg_common namely controller_index to support multiple controllers usb gadget support.

---
Changes for v2:
- Changes type of fsg_main_thread argument to unsigned int

 cmd/usb_mass_storage.c              |  2 +-
 drivers/usb/gadget/f_mass_storage.c | 11 +++++++++--
 include/usb_mass_storage.h          |  2 +-
 3 files changed, 11 insertions(+), 4 deletions(-)
cmd/usb_mass_storage.c +1 -1
index b05913a..bf80d37 100644
@@ -214,7 +214,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int
 flag, while (1) {
 		usb_gadget_handle_interrupts(controller_index);
 
-		rc = fsg_main_thread(NULL);
+		rc = fsg_main_thread(controller_index);
 		if (rc) {
 			/* Check I/O error */
 			if (rc == -EIO)
(quoted diff) +0 -0

b/drivers/usb/gadget/f_mass_storage.c index 1ecb92a..27ca5fe 100644

drivers/usb/gadget/f_mass_storage.c +9 -2
@@ -362,6 +362,7 @@ struct fsg_common {
 	char inquiry_string[8 + 16 + 4 + 1];
 
 	struct kref		ref;
+	unsigned int controller_index;
 };
 
 struct fsg_config {
@@ -691,7 +692,7 @@ static int sleep_thread(struct fsg_common *common)
 			k = 0;
 		}
 
-		usb_gadget_handle_interrupts(0);
+
 usb_gadget_handle_interrupts(common->controller_index); }
 	common->thread_wakeup_needed = 0;
 	return rc;
@@ -2402,10 +2403,14 @@ static void handle_exception(struct
 fsg_common *common) 
 /*-------------------------------------------------------------------------*/
 
-int fsg_main_thread(void *common_)
+int fsg_main_thread(unsigned int controller_index)
 {
 	int ret;
 	struct fsg_common	*common = the_fsg_common;
+
+	/* update the controller_index */
+	common->controller_index = controller_index;
+
 	/* The main loop */
 	do {
 		if (exception_in_progress(common)) {
@@ -2476,6 +2481,7 @@ static struct fsg_common
 *fsg_common_init(struct fsg_common *common, 
 	common->ops = NULL;
 	common->private_data = NULL;
+	common->controller_index = 0;
 
 	common->gadget = gadget;
 	common->ep0 = gadget->ep0;
@@ -2770,6 +2776,7 @@ int fsg_add(struct usb_configuration *c)
 
 	fsg_common->ops = NULL;
 	fsg_common->private_data = NULL;
+	fsg_common->controller_index = 0;
 
 	the_fsg_common = fsg_common;
 
include/usb_mass_storage.h +0 -0
index 8229f62..f21cc7a 100644

include/usb_mass_storage.h struct ums { · line 33

Quoted 7 lines
include/usb_mass_storage.h +1 -1
@@ -28,6 +28,6 @@ struct ums {
 
 int fsg_init(struct ums *ums_devs, int count);
 void fsg_cleanup(void);
-int fsg_main_thread(void *);
+int fsg_main_thread(unsigned int);
 int fsg_add(struct usb_configuration *c);
 #endif /* __USB_MASS_STORAGE_H__ */
Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#3 lore raw

PATCH v2 2/4 usb: dwc3: Add helper functions to enable snooping and burst settings

In reply to Rajat Srivastava

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

---
Changes in v2:
- Removes SoC specific flags and added helper functions

 drivers/usb/dwc3/core.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/dwc3/core.h |  7 +++++++
 2 files changed, 52 insertions(+)
drivers/usb/dwc3/core.c +45 -0
index 85cc96a..0b3c596 100644
@@ -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 = reg | DWC3_SNOOP_ENABLE;
+		else
+			reg = 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
drivers/usb/dwc3/core.h +7 -0
index 72d2fcd..455e7fa 100644
@@ -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;
Signature · 1 line
2.6.2.198.g614a2ac
#4 lore raw

PATCH v2 2/4 usb: dwc3: Add helper functions to enable snooping and burst settings

Quoted 18 lines · Rajat Srivastava

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

---
Changes in v2:
- Removes SoC specific flags and added helper functions

 drivers/usb/dwc3/core.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/dwc3/core.h |  7 +++++++
 2 files changed, 52 insertions(+)
drivers/usb/dwc3/core.c +0 -0
index 85cc96a..0b3c596 100644

drivers/usb/dwc3/core.c static void dwc3_core_exit_mode(struct dwc3 *dwc) · line 608

Quoted 10 lines
drivers/usb/dwc3/core.c +7 -0
@@ -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) {

Why is this iterating over a list of all controllers ? Should this be enabled on per-controller basis by some DT prop ?

Quoted 60 lines
drivers/usb/dwc3/core.c +38 -0
+		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 = reg | DWC3_SNOOP_ENABLE;
+		else
+			reg = 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
drivers/usb/dwc3/core.h +7 -0
index 72d2fcd..455e7fa 100644
@@ -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;
Signature · 2 lines
Best regards,
Marek Vasut
#5 lore raw

PATCH v2 2/4 usb: dwc3: Add helper functions to enable snooping and burst settings

Quoted 36 lines

-----Original Message-----
From: Marek Vasut [mailto:marex at denx.de]
Sent: Monday, June 06, 2016 6:24 PM
To: Rajat Srivastava <[email protected]>; u-boot at lists.denx.de
Cc: l.majewski at samsung.com; sjg at chromium.org; albert.u.boot at aribaud.net; prabhakar at freescale.com; york sun <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; michal.simek at xilinx.com; felipe.balbi at linux.intel.com
Subject: Re: [PATCH v2 2/4] usb: dwc3: Add helper functions to enable snooping and burst settings

Quoted 22 lines · Rajat Srivastava

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

---
Changes in v2:
- Removes SoC specific flags and added helper functions

 drivers/usb/dwc3/core.c | 45
+++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/dwc3/core.h |  7 +++++++
 2 files changed, 52 insertions(+)
drivers/usb/dwc3/core.c index renamed from drivers/usb/dwc3/core.c +0 -0

85cc96a..0b3c596 100644

drivers/usb/dwc3/core.c +0 -0
@@ -599,6 +599,51 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)
 
 #define DWC3_ALIGN_MASK		(16 - 1)
 
Quoted 8 lines

drivers/usb/dwc3/core.c static void dwc3_core_exit_mode(struct dwc3 *dwc) · line 608

Quoted 7 lines
drivers/usb/dwc3/core.c +7 -0
+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) {

Hello Marek,

Quoted 1 line

Why is this iterating over a list of all controllers ?

This function has to be called from Soc specific code to pass some register settings. And dwc pointer would not be available there. Hence, index is passed to determine dwc pointer.

Quoted 2 lines

Should this be enabled on per-controller basis by some DT prop ?

We are using dwc3 driver with non DT support.

Best Regards,
Rajesh Bhagat

Quoted 64 lines
Quoted 49 lines
drivers/usb/dwc3/core.c +37 -1
+		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 = reg | DWC3_SNOOP_ENABLE;
+		else
+			reg = 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

drivers/usb/dwc3/core.h +0 -0
@@ -593,6 +593,13 @@ struct dwc3_hwparams {
 /* HWPARAMS7 */
 #define DWC3_RAM1_DEPTH(n)	((n) & 0xffff)
 

drivers/usb/dwc3/core.h struct dwc3_hwparams { · line 605

Quoted 10 lines
drivers/usb/dwc3/core.h +7 -0
+/* 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;

--
Best regards,
Marek Vasut

#6 lore raw

PATCH v2 2/4 usb: dwc3: Add helper functions to enable snooping and burst settings

Quoted 49 lines · Rajesh Bhagat
Quoted 36 lines

-----Original Message-----
From: Marek Vasut [mailto:marex at denx.de]
Sent: Monday, June 06, 2016 6:24 PM
To: Rajat Srivastava <[email protected]>; u-boot at lists.denx.de
Cc: l.majewski at samsung.com; sjg at chromium.org; albert.u.boot at aribaud.net; prabhakar at freescale.com; york sun <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; michal.simek at xilinx.com; felipe.balbi at linux.intel.com
Subject: Re: [PATCH v2 2/4] usb: dwc3: Add helper functions to enable snooping and burst settings

Quoted 22 lines · Rajat Srivastava

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

---
Changes in v2:
- Removes SoC specific flags and added helper functions

 drivers/usb/dwc3/core.c | 45
+++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/dwc3/core.h |  7 +++++++
 2 files changed, 52 insertions(+)
drivers/usb/dwc3/core.c index renamed from drivers/usb/dwc3/core.c +0 -0

85cc96a..0b3c596 100644

drivers/usb/dwc3/core.c +0 -0
@@ -599,6 +599,51 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)
 
 #define DWC3_ALIGN_MASK		(16 - 1)
 
Quoted 8 lines

drivers/usb/dwc3/core.c static void dwc3_core_exit_mode(struct dwc3 *dwc) · line 608

Quoted 7 lines
drivers/usb/dwc3/core.c +7 -0
+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) {

Hello Marek,

Quoted 1 line

Why is this iterating over a list of all controllers ?

Quoted 7 lines

This function has to be called from Soc specific code to pass some register settings. And dwc pointer would not be available there. Hence, index is passed to determine dwc pointer.

Quoted 2 lines

Should this be enabled on per-controller basis by some DT prop ?

We are using dwc3 driver with non DT support.

That's real unfortunate.

Quoted 68 lines

Best Regards,
Rajesh Bhagat

Quoted 64 lines
Quoted 49 lines
drivers/usb/dwc3/core.c +37 -1
+		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 = reg | DWC3_SNOOP_ENABLE;
+		else
+			reg = 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

drivers/usb/dwc3/core.h +0 -0
@@ -593,6 +593,13 @@ struct dwc3_hwparams {
 /* HWPARAMS7 */
 #define DWC3_RAM1_DEPTH(n)	((n) & 0xffff)
 

drivers/usb/dwc3/core.h struct dwc3_hwparams { · line 605

Quoted 10 lines
drivers/usb/dwc3/core.h +7 -0
+/* 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;

--
Best regards,
Marek Vasut

Signature · 2 lines
Best regards,
Marek Vasut
#7 lore raw

PATCH v2 2/4 usb: dwc3: Add helper functions to enable snooping and burst settings

In reply to Rajat Srivastava

Hi,

Quoted 18 lines · Rajat Srivastava

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

---
Changes in v2:
- Removes SoC specific flags and added helper functions

 drivers/usb/dwc3/core.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/dwc3/core.h |  7 +++++++
 2 files changed, 52 insertions(+)
drivers/usb/dwc3/core.c +0 -0
index 85cc96a..0b3c596 100644

drivers/usb/dwc3/core.c static void dwc3_core_exit_mode(struct dwc3 *dwc) · line 608

Quoted 10 lines
drivers/usb/dwc3/core.c +7 -0
@@ -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) {

Ick - can this be converted to use driver model?

Quoted 60 lines
drivers/usb/dwc3/core.c +38 -0
+               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 = reg | DWC3_SNOOP_ENABLE;
+               else
+                       reg = 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
drivers/usb/dwc3/core.h +7 -1
index 72d2fcd..455e7fa 100644
@@ -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;
--
Quoted 2 lines

2.6.2.198.g614a2ac

Regards,
Simon

#8 lore raw

PATCH v2 2/4 usb: dwc3: Add helper functions to enable snooping and burst settings

Quoted 38 lines

-----Original Message-----
From: sjg at google.com [mailto:sjg at google.com] On Behalf Of Simon Glass
Sent: Friday, June 10, 2016 6:05 AM
To: Rajat Srivastava <[email protected]>
Cc: U-Boot Mailing List <[email protected]>; Lukasz Majewski <[email protected]>; Marek Va?ut <[email protected]>; Albert ARIBAUD <[email protected]>; Prabhakar Kushwaha <[email protected]>; york sun <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Michal Simek <[email protected]>; felipe.balbi at linux.intel.com
Subject: Re: [PATCH v2 2/4] usb: dwc3: Add helper functions to enable snooping and burst settings

Hi,

Quoted 20 lines · Rajat Srivastava

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

---
Changes in v2:
- Removes SoC specific flags and added helper functions

 drivers/usb/dwc3/core.c | 45
+++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/dwc3/core.h |  7 +++++++
 2 files changed, 52 insertions(+)
drivers/usb/dwc3/core.c index renamed from drivers/usb/dwc3/core.c +0 -0

85cc96a..0b3c596 100644

drivers/usb/dwc3/core.c +0 -0
@@ -599,6 +599,51 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)
 
Quoted 8 lines

drivers/usb/dwc3/core.c static void dwc3_core_exit_mode(struct dwc3 *dwc) · line 608

Quoted 8 lines
drivers/usb/dwc3/core.c +6 -0
 #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) {

Hello Simon,

Quoted 3 lines

Ick - can this be converted to use driver model?

We have not moved to use driver model yet :( . Is it possible to pass these register settings by some other mechanism ?

Best Regards,
Rajesh Bhagat

Quoted 64 lines
Quoted 59 lines
drivers/usb/dwc3/core.c +37 -1
+               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 = reg | DWC3_SNOOP_ENABLE;
+               else
+                       reg = 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

drivers/usb/dwc3/core.h +7 -1
@@ -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;
--
Quoted 2 lines

2.6.2.198.g614a2ac

Regards,
Simon

#9 lore raw

PATCH v2 2/4 usb: dwc3: Add helper functions to enable snooping and burst settings

Hi Rajesh,

Quoted 50 lines · Rajesh Bhagat
Quoted 38 lines

-----Original Message-----
From: sjg at google.com [mailto:sjg at google.com] On Behalf Of Simon Glass
Sent: Friday, June 10, 2016 6:05 AM
To: Rajat Srivastava <[email protected]>
Cc: U-Boot Mailing List <[email protected]>; Lukasz Majewski <[email protected]>; Marek Va?ut <[email protected]>; Albert ARIBAUD <[email protected]>; Prabhakar Kushwaha <[email protected]>; york sun <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Michal Simek <[email protected]>; felipe.balbi at linux.intel.com
Subject: Re: [PATCH v2 2/4] usb: dwc3: Add helper functions to enable snooping and burst settings

Hi,

Quoted 20 lines · Rajat Srivastava

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

---
Changes in v2:
- Removes SoC specific flags and added helper functions

 drivers/usb/dwc3/core.c | 45
+++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/dwc3/core.h |  7 +++++++
 2 files changed, 52 insertions(+)
drivers/usb/dwc3/core.c index renamed from drivers/usb/dwc3/core.c +0 -0

85cc96a..0b3c596 100644

drivers/usb/dwc3/core.c +0 -0
@@ -599,6 +599,51 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)
 
Quoted 8 lines

drivers/usb/dwc3/core.c static void dwc3_core_exit_mode(struct dwc3 *dwc) · line 608

Quoted 8 lines
drivers/usb/dwc3/core.c +6 -0
 #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) {

Hello Simon,

Quoted 1 line
Quoted 5 lines
Quoted 2 lines

Ick - can this be converted to use driver model?

We have not moved to use driver model yet :( . Is it possible to pass these register settings by some other mechanism ?

Not that I know of - is there any reason not to convert to driver model now?

Quoted 68 lines

Best Regards,
Rajesh Bhagat

Quoted 64 lines
Quoted 59 lines
drivers/usb/dwc3/core.c +37 -1
+               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 = reg | DWC3_SNOOP_ENABLE;
+               else
+                       reg = 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

drivers/usb/dwc3/core.h +7 -1
@@ -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;
--
Quoted 2 lines

2.6.2.198.g614a2ac

Regards,
Simon

Regards,
Simon

#10 lore raw

PATCH v2 2/4 usb: dwc3: Add helper functions to enable snooping and burst settings

Quoted 15 lines

-----Original Message-----
From: sjg at google.com [mailto:sjg at google.com] On Behalf Of Simon Glass
Sent: Friday, June 17, 2016 9:22 AM
To: Rajesh Bhagat <[email protected]>
Cc: Rajat Srivastava <[email protected]>; U-Boot Mailing List <u- boot at lists.denx.de>; Lukasz Majewski <[email protected]>; Marek Va?ut <[email protected]>; Albert ARIBAUD <[email protected]>; Prabhakar Kushwaha <[email protected]>; york sun <[email protected]>; Mingkai Hu <[email protected]>; Michal Simek <[email protected]>; felipe.balbi at linux.intel.com
Subject: Re: [PATCH v2 2/4] usb: dwc3: Add helper functions to enable snooping and burst settings

Quoted 61 lines

Hi Rajesh,

Quoted 57 lines · Rajesh Bhagat
Quoted 40 lines

-----Original Message-----
From: sjg at google.com [mailto:sjg at google.com] On Behalf Of Simon Glass
Sent: Friday, June 10, 2016 6:05 AM
To: Rajat Srivastava <[email protected]>
Cc: U-Boot Mailing List <[email protected]>; Lukasz Majewski <[email protected]>; Marek Va?ut <[email protected]>; Albert ARIBAUD <[email protected]>; Prabhakar Kushwaha <[email protected]>; york sun <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Michal Simek <[email protected]>; felipe.balbi at linux.intel.com
Subject: Re: [PATCH v2 2/4] usb: dwc3: Add helper functions to enable snooping and burst settings

Hi,

Quoted 22 lines · Rajat Srivastava

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

---
Changes in v2:
- Removes SoC specific flags and added helper functions

 drivers/usb/dwc3/core.c | 45
+++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/dwc3/core.h |  7 +++++++
 2 files changed, 52 insertions(+)
drivers/usb/dwc3/core.c +0 -0

index
85cc96a..0b3c596 100644

drivers/usb/dwc3/core.c +0 -0
@@ -599,6 +599,51 @@ static void dwc3_core_exit_mode(struct dwc3
 *dwc)
 
Quoted 8 lines

drivers/usb/dwc3/core.c static void dwc3_core_exit_mode(struct dwc3 *dwc) · line 608

Quoted 8 lines
drivers/usb/dwc3/core.c +6 -0
 #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) {

Hello Simon,

Quoted 3 lines

Ick - can this be converted to use driver model?

We have not moved to use driver model yet :( . Is it possible to pass these register settings by some other mechanism ?

Hello Simon,

Quoted 2 lines

Not that I know of - is there any reason not to convert to driver model now?

Reason is, the dwc3 driver itself as not moved to CONFIG_DM_USB, and seems to be in progress by patch "driver model bring-up of dwc3 usb peripheral" (sent by Mugunthan V N).

Best Regards,
Rajesh Bhagat

Quoted 71 lines
Quoted 68 lines

Best Regards,
Rajesh Bhagat

Quoted 64 lines
Quoted 59 lines
drivers/usb/dwc3/core.c +37 -0
+               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 = reg | DWC3_SNOOP_ENABLE;
+               else
+                       reg = 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
drivers/usb/dwc3/core.h +7 -1
index 72d2fcd..455e7fa 100644
@@ -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;
--
Quoted 2 lines

2.6.2.198.g614a2ac

Regards,
Simon

Regards,
Simon

#11 lore raw

PATCH v2 2/4 usb: dwc3: Add helper functions to enable snooping and burst settings

In reply to Rajat Srivastava

Hi Rajat,

Quoted 50 lines

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

---
Changes in v2:
- Removes SoC specific flags and added helper functions

 drivers/usb/dwc3/core.c | 45

+++++++++++++++++++++++++++++++++++++++++++++ drivers/usb/dwc3/core.h | 7 +++++++ 2 files changed, 52 insertions(+)

drivers/usb/dwc3/core.c +28 -0
index 85cc96a..0b3c596 100644
@@ -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;

drivers/usb/dwc3/core.c static void dwc3_core_exit_mode(struct dwc3 *dwc) · line 640

Quoted 10 lines
drivers/usb/dwc3/core.c +10 -0
+	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 = reg | DWC3_SNOOP_ENABLE;

You can replace the above line with reg |= DWC3_SNOOP_ENABLE

drivers/usb/dwc3/core.c static void dwc3_core_exit_mode(struct dwc3 *dwc) · line 641

Quoted 2 lines
drivers/usb/dwc3/core.c +2 -0
+		else
+			reg = reg & ~DWC3_SNOOP_ENABLE;

The same here - req &= ~DWC3_SNOOP_ENABLE

Quoted 26 lines
drivers/usb/dwc3/core.c +5 -0
+		dwc3_writel(dwc->regs, DWC3_GSBUSCFG0, reg);
+		break;
+	}
+}
+
 /**
  * dwc3_uboot_init - dwc3 core uboot initialization code

* @dwc3_dev: struct dwc3_device containing initialization data

drivers/usb/dwc3/core.h +7 -0
index 72d2fcd..455e7fa 100644
@@ -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;
Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#12 lore raw

PATCH v2 2/4 usb: dwc3: Add helper functions to enable snooping and burst settings

Quoted 67 lines

-----Original Message-----
From: Lukasz Majewski [mailto:l.majewski at samsung.com]
Sent: Thursday, June 23, 2016 8:23 PM
To: Rajat Srivastava <[email protected]>
Cc: u-boot at lists.denx.de; sjg at chromium.org; marex at denx.de; albert.u.boot at aribaud.net; prabhakar at freescale.com; york sun <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; michal.simek at xilinx.com; felipe.balbi at linux.intel.com
Subject: Re: [PATCH v2 2/4] usb: dwc3: Add helper functions to enable snooping and burst settings

Hi Rajat,

Quoted 11 lines

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

---
Changes in v2:
- Removes SoC specific flags and added helper functions

 drivers/usb/dwc3/core.c | 45

+++++++++++++++++++++++++++++++++++++++++++++

drivers/usb/dwc3/core.h

Quoted 40 lines

| 7 +++++++ 2 files changed, 52 insertions(+)

drivers/usb/dwc3/core.c index renamed from drivers/usb/dwc3/core.c +0 -0

85cc96a..0b3c596 100644

drivers/usb/dwc3/core.c +29 -0
@@ -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;
+
Quoted 8 lines

drivers/usb/dwc3/core.c static void dwc3_core_exit_mode(struct dwc3 *dwc) · line 639

Quoted 8 lines
drivers/usb/dwc3/core.c +8 -0
+	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 = reg | DWC3_SNOOP_ENABLE;

Hello Lukasz,

Quoted 3 lines

You can replace the above line with reg |= DWC3_SNOOP_ENABLE

Will take care in v3.

Quoted 5 lines

drivers/usb/dwc3/core.c static void dwc3_core_exit_mode(struct dwc3 *dwc) · line 641

Quoted 2 lines
drivers/usb/dwc3/core.c +2 -0
+		else
+			reg = reg & ~DWC3_SNOOP_ENABLE;

The same here - req &= ~DWC3_SNOOP_ENABLE

Will take care in v3.

Quoted 16 lines
Quoted 16 lines
drivers/usb/dwc3/core.c +5 -1
+		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

drivers/usb/dwc3/core.h +0 -0
@@ -593,6 +593,13 @@ struct dwc3_hwparams {
 /* HWPARAMS7 */
 #define DWC3_RAM1_DEPTH(n)	((n) & 0xffff)
 
Quoted 12 lines

drivers/usb/dwc3/core.h struct dwc3_hwparams { · line 605

Quoted 10 lines
drivers/usb/dwc3/core.h +7 -0
+/* 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;

Best Regards,
Rajesh Bhagat

Quoted 7 lines

--
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

#13 lore raw

PATCH v2 2/4 usb: dwc3: Add helper functions to enable snooping and burst settings

Quoted 4 lines · Rajesh Bhagat

Will take care in v3.

Did you send v3 patch set?

York

#14 lore raw

PATCH v2 3/4 armv8/fsl-layerscape: add dwc3 gadget driver support

In reply to Rajat Srivastava

Implements the dwc3 gadget driver support for LS1043 platform, and performs below operations:
1. Enables snooping support for DWC3 controller.
2. Enables cache coherency in LS1043 platform.

---
Changes in v2:
- Moves DWC3 driver specific code to helper functions
- Calls helper functions in SoC specific implementation

 arch/arm/cpu/armv8/fsl-layerscape/soc.c            | 93 ++++++++++++++++++++++
 .../include/asm/arch-fsl-layerscape/immap_lsch2.h  |  6 ++
 2 files changed, 99 insertions(+)
arch/arm/cpu/armv8/fsl-layerscape/soc.c +93 -0
index 0fb5c7f..cc07524 100644
@@ -17,6 +17,10 @@
 #ifdef CONFIG_CHAIN_OF_TRUST
 #include <fsl_validate.h>
 #endif
+#include <usb.h>
+#include <dwc3-uboot.h>
+#include <linux/usb/xhci-fsl.h>
+
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -318,9 +322,18 @@ void fsl_lsch2_early_init_f(void)
 #if defined(CONFIG_FSL_QSPI) && !defined(CONFIG_QSPI_BOOT)
 	out_be32(&scfg->qspi_cfg, SCFG_QSPI_CLKSEL);
 #endif
+	/* Make SEC and USB reads and writes snoopable */
+#if defined(CONFIG_LS1043A)
+	setbits_be32(&scfg->snpcnfgcr, SCFG_SNPCNFGCR_SECRDSNP |
+		     SCFG_SNPCNFGCR_SECWRSNP | SCFG_SNPCNFGCR_USB1RDSNP |
+		     SCFG_SNPCNFGCR_USB1WRSNP | SCFG_SNPCNFGCR_USB2RDSNP |
+		     SCFG_SNPCNFGCR_USB2WRSNP | SCFG_SNPCNFGCR_USB3RDSNP |
+		     SCFG_SNPCNFGCR_USB3WRSNP);
+#else
 	/* Make SEC reads and writes snoopable */
 	setbits_be32(&scfg->snpcnfgcr, SCFG_SNPCNFGCR_SECRDSNP |
 		     SCFG_SNPCNFGCR_SECWRSNP);
+#endif
 
 	/*
 	 * Enable snoop requests and DVM message requests for
@@ -336,6 +349,86 @@ void fsl_lsch2_early_init_f(void)
 }
 #endif
 
+#ifdef CONFIG_USB_DWC3
+
+#if defined(CONFIG_LS1043A)
+static struct dwc3_device dwc3_device_data0 = {
+	.maximum_speed = USB_SPEED_HIGH,
+	.base = CONFIG_SYS_FSL_XHCI_USB1_ADDR,
+	.dr_mode = USB_DR_MODE_PERIPHERAL,
+	.index = 0,
+};
+
+static struct dwc3_device dwc3_device_data1 = {
+	.maximum_speed = USB_SPEED_HIGH,
+	.base = CONFIG_SYS_FSL_XHCI_USB2_ADDR,
+	.dr_mode = USB_DR_MODE_PERIPHERAL,
+	.index = 1,
+};
+
+static struct dwc3_device dwc3_device_data2 = {
+	.maximum_speed = USB_SPEED_HIGH,
+	.base = CONFIG_SYS_FSL_XHCI_USB3_ADDR,
+	.dr_mode = USB_DR_MODE_PERIPHERAL,
+	.index = 2,
+};
+
+int usb_gadget_handle_interrupts(int index)
+{
+	dwc3_uboot_handle_interrupt(index);
+	return 0;
+}
+#endif
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+	switch (init) {
+	case USB_INIT_DEVICE:
+		switch (index) {
+#if defined(CONFIG_LS1043A)
+		case 0:
+			dwc3_uboot_init(&dwc3_device_data0);
+			break;
+		case 1:
+			dwc3_uboot_init(&dwc3_device_data1);
+			break;
+		case 2:
+			dwc3_uboot_init(&dwc3_device_data2);
+			break;
+#endif
+		default:
+			printf("Invalid Controller Index\n");
+			return -1;
+		}
+#if defined(CONFIG_LS1043A)
+		dwc3_core_incr_burst_enable(index, 0xf, 0xf);
+		dwc3_core_set_snooping(index, true);
+#endif
+		break;
+	default:
+		break;
+	}
+
+	return 0;
+}
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+	switch (init) {
+	case USB_INIT_DEVICE:
+#if defined(CONFIG_LS1043A)
+		dwc3_uboot_exit(index);
+#endif
+		break;
+	default:
+		break;
+	}
+	return 0;
+}
+#endif
+
+
+
 #ifdef CONFIG_BOARD_LATE_INIT
 int board_late_init(void)
 {
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h +6 -0
index 57b99d4..13ba1a6 100644
@@ -328,6 +328,12 @@ struct ccsr_gur {
 
 #define SCFG_SNPCNFGCR_SECRDSNP		0x80000000
 #define SCFG_SNPCNFGCR_SECWRSNP		0x40000000
+#define SCFG_SNPCNFGCR_USB1RDSNP	0x00200000
+#define SCFG_SNPCNFGCR_USB1WRSNP	0x00100000
+#define SCFG_SNPCNFGCR_USB2RDSNP	0x00008000
+#define SCFG_SNPCNFGCR_USB2WRSNP	0x00010000
+#define SCFG_SNPCNFGCR_USB3RDSNP	0x00002000
+#define SCFG_SNPCNFGCR_USB3WRSNP	0x00004000
 
 /* Supplemental Configuration Unit */
 struct ccsr_scfg {
Signature · 1 line
2.6.2.198.g614a2ac
#15 lore raw

PATCH v2 3/4 armv8/fsl-layerscape: add dwc3 gadget driver support

Hi,

Quoted 92 lines · Rajat Srivastava

Implements the dwc3 gadget driver support for LS1043 platform, and performs below operations:
1. Enables snooping support for DWC3 controller.
2. Enables cache coherency in LS1043 platform.

---
Changes in v2:
- Moves DWC3 driver specific code to helper functions
- Calls helper functions in SoC specific implementation

 arch/arm/cpu/armv8/fsl-layerscape/soc.c            | 93 ++++++++++++++++++++++
 .../include/asm/arch-fsl-layerscape/immap_lsch2.h  |  6 ++
 2 files changed, 99 insertions(+)
arch/arm/cpu/armv8/fsl-layerscape/soc.c +50 -0
index 0fb5c7f..cc07524 100644
@@ -17,6 +17,10 @@
 #ifdef CONFIG_CHAIN_OF_TRUST
 #include <fsl_validate.h>
 #endif
+#include <usb.h>
+#include <dwc3-uboot.h>
+#include <linux/usb/xhci-fsl.h>
+
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -318,9 +322,18 @@ void fsl_lsch2_early_init_f(void)
 #if defined(CONFIG_FSL_QSPI) && !defined(CONFIG_QSPI_BOOT)
        out_be32(&scfg->qspi_cfg, SCFG_QSPI_CLKSEL);
 #endif
+       /* Make SEC and USB reads and writes snoopable */
+#if defined(CONFIG_LS1043A)
+       setbits_be32(&scfg->snpcnfgcr, SCFG_SNPCNFGCR_SECRDSNP |
+                    SCFG_SNPCNFGCR_SECWRSNP | SCFG_SNPCNFGCR_USB1RDSNP |
+                    SCFG_SNPCNFGCR_USB1WRSNP | SCFG_SNPCNFGCR_USB2RDSNP |
+                    SCFG_SNPCNFGCR_USB2WRSNP | SCFG_SNPCNFGCR_USB3RDSNP |
+                    SCFG_SNPCNFGCR_USB3WRSNP);
+#else
        /* Make SEC reads and writes snoopable */
        setbits_be32(&scfg->snpcnfgcr, SCFG_SNPCNFGCR_SECRDSNP |
                     SCFG_SNPCNFGCR_SECWRSNP);
+#endif
 
        /*
         * Enable snoop requests and DVM message requests for
@@ -336,6 +349,86 @@ void fsl_lsch2_early_init_f(void)
 }
 #endif
 
+#ifdef CONFIG_USB_DWC3
+
+#if defined(CONFIG_LS1043A)
+static struct dwc3_device dwc3_device_data0 = {
+       .maximum_speed = USB_SPEED_HIGH,
+       .base = CONFIG_SYS_FSL_XHCI_USB1_ADDR,
+       .dr_mode = USB_DR_MODE_PERIPHERAL,
+       .index = 0,
+};
+
+static struct dwc3_device dwc3_device_data1 = {
+       .maximum_speed = USB_SPEED_HIGH,
+       .base = CONFIG_SYS_FSL_XHCI_USB2_ADDR,
+       .dr_mode = USB_DR_MODE_PERIPHERAL,
+       .index = 1,
+};
+
+static struct dwc3_device dwc3_device_data2 = {
+       .maximum_speed = USB_SPEED_HIGH,
+       .base = CONFIG_SYS_FSL_XHCI_USB3_ADDR,
+       .dr_mode = USB_DR_MODE_PERIPHERAL,
+       .index = 2,
+};
+
+int usb_gadget_handle_interrupts(int index)
+{
+       dwc3_uboot_handle_interrupt(index);
+       return 0;
+}
+#endif
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+       switch (init) {
+       case USB_INIT_DEVICE:
+               switch (index) {
+#if defined(CONFIG_LS1043A)

arch/arm/cpu/armv8/fsl-layerscape/soc.c void fsl_lsch2_early_init_f(void) · line 398

Quoted 10 lines
arch/arm/cpu/armv8/fsl-layerscape/soc.c +10 -0
+               case 0:
+                       dwc3_uboot_init(&dwc3_device_data0);
+                       break;
+               case 1:
+                       dwc3_uboot_init(&dwc3_device_data1);
+                       break;
+               case 2:
+                       dwc3_uboot_init(&dwc3_device_data2);
+                       break;
+#endif

Can this use driver model? It seems odd to be adding new code like this.

Quoted 54 lines
arch/arm/cpu/armv8/fsl-layerscape/soc.c +33 -0
+               default:
+                       printf("Invalid Controller Index\n");
+                       return -1;
+               }
+#if defined(CONFIG_LS1043A)
+               dwc3_core_incr_burst_enable(index, 0xf, 0xf);
+               dwc3_core_set_snooping(index, true);
+#endif
+               break;
+       default:
+               break;
+       }
+
+       return 0;
+}
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+       switch (init) {
+       case USB_INIT_DEVICE:
+#if defined(CONFIG_LS1043A)
+               dwc3_uboot_exit(index);
+#endif
+               break;
+       default:
+               break;
+       }
+       return 0;
+}
+#endif
+
+
+
 #ifdef CONFIG_BOARD_LATE_INIT
 int board_late_init(void)
 {
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h +6 -1
index 57b99d4..13ba1a6 100644
@@ -328,6 +328,12 @@ struct ccsr_gur {
 
 #define SCFG_SNPCNFGCR_SECRDSNP                0x80000000
 #define SCFG_SNPCNFGCR_SECWRSNP                0x40000000
+#define SCFG_SNPCNFGCR_USB1RDSNP       0x00200000
+#define SCFG_SNPCNFGCR_USB1WRSNP       0x00100000
+#define SCFG_SNPCNFGCR_USB2RDSNP       0x00008000
+#define SCFG_SNPCNFGCR_USB2WRSNP       0x00010000
+#define SCFG_SNPCNFGCR_USB3RDSNP       0x00002000
+#define SCFG_SNPCNFGCR_USB3WRSNP       0x00004000
 
 /* Supplemental Configuration Unit */
 struct ccsr_scfg {
--
Quoted 2 lines

2.6.2.198.g614a2ac

Regards,
Simon

#16 lore raw

PATCH v2 3/4 armv8/fsl-layerscape: add dwc3 gadget driver support

Quoted 109 lines

-----Original Message-----
From: sjg at google.com [mailto:sjg at google.com] On Behalf Of Simon Glass
Sent: Friday, June 10, 2016 6:05 AM
To: Rajat Srivastava <[email protected]>
Cc: U-Boot Mailing List <[email protected]>; Lukasz Majewski <[email protected]>; Marek Va?ut <[email protected]>; Albert ARIBAUD <[email protected]>; Prabhakar Kushwaha <[email protected]>; york sun <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; Michal Simek <[email protected]>; felipe.balbi at linux.intel.com
Subject: Re: [PATCH v2 3/4] armv8/fsl-layerscape: add dwc3 gadget driver support

Hi,

Quoted 8 lines · Rajat Srivastava

Implements the dwc3 gadget driver support for LS1043 platform, and performs below operations:
1. Enables snooping support for DWC3 controller.
2. Enables cache coherency in LS1043 platform.

Quoted 6 lines

---
Changes in v2:
- Moves DWC3 driver specific code to helper functions
- Calls helper functions in SoC specific implementation

 arch/arm/cpu/armv8/fsl-layerscape/soc.c            | 93

++++++++++++++++++++++

Quoted 20 lines
 .../include/asm/arch-fsl-layerscape/immap_lsch2.h  |  6 ++
 2 files changed, 99 insertions(+)
arch/arm/cpu/armv8/fsl-layerscape/soc.c +4 -0
index 0fb5c7f..cc07524 100644
@@ -17,6 +17,10 @@
 #ifdef CONFIG_CHAIN_OF_TRUST
 #include <fsl_validate.h>
 #endif
+#include <usb.h>
+#include <dwc3-uboot.h>
+#include <linux/usb/xhci-fsl.h>
+
 
 DECLARE_GLOBAL_DATA_PTR;
 

arch/arm/cpu/armv8/fsl-layerscape/soc.c void fsl_lsch2_early_init_f(void) #if · line 328

Quoted 7 lines
arch/arm/cpu/armv8/fsl-layerscape/soc.c +5 -0
@@ -318,9 +322,18 @@ void fsl_lsch2_early_init_f(void)  #if
 defined(CONFIG_FSL_QSPI) && !defined(CONFIG_QSPI_BOOT)
        out_be32(&scfg->qspi_cfg, SCFG_QSPI_CLKSEL);  #endif
+       /* Make SEC and USB reads and writes snoopable */ #if
+defined(CONFIG_LS1043A)
+       setbits_be32(&scfg->snpcnfgcr, SCFG_SNPCNFGCR_SECRDSNP |
+                    SCFG_SNPCNFGCR_SECWRSNP | SCFG_SNPCNFGCR_USB1RDSNP |
+                    SCFG_SNPCNFGCR_USB1WRSNP | SCFG_SNPCNFGCR_USB2RDSNP

|

arch/arm/cpu/armv8/fsl-layerscape/soc.c void fsl_lsch2_early_init_f(void) #if · line 329

Quoted 1 line
arch/arm/cpu/armv8/fsl-layerscape/soc.c +1 -0
+                    SCFG_SNPCNFGCR_USB2WRSNP | SCFG_SNPCNFGCR_USB3RDSNP

|

Quoted 47 lines
arch/arm/cpu/armv8/fsl-layerscape/soc.c +39 -1
+                    SCFG_SNPCNFGCR_USB3WRSNP); #else
        /* Make SEC reads and writes snoopable */
        setbits_be32(&scfg->snpcnfgcr, SCFG_SNPCNFGCR_SECRDSNP |
                     SCFG_SNPCNFGCR_SECWRSNP);
+#endif
 
        /*
         * Enable snoop requests and DVM message requests for @@
-336,6 +349,86 @@ void fsl_lsch2_early_init_f(void)  }  #endif
 
+#ifdef CONFIG_USB_DWC3
+
+#if defined(CONFIG_LS1043A)
+static struct dwc3_device dwc3_device_data0 = {
+       .maximum_speed = USB_SPEED_HIGH,
+       .base = CONFIG_SYS_FSL_XHCI_USB1_ADDR,
+       .dr_mode = USB_DR_MODE_PERIPHERAL,
+       .index = 0,
+};
+
+static struct dwc3_device dwc3_device_data1 = {
+       .maximum_speed = USB_SPEED_HIGH,
+       .base = CONFIG_SYS_FSL_XHCI_USB2_ADDR,
+       .dr_mode = USB_DR_MODE_PERIPHERAL,
+       .index = 1,
+};
+
+static struct dwc3_device dwc3_device_data2 = {
+       .maximum_speed = USB_SPEED_HIGH,
+       .base = CONFIG_SYS_FSL_XHCI_USB3_ADDR,
+       .dr_mode = USB_DR_MODE_PERIPHERAL,
+       .index = 2,
+};
+
+int usb_gadget_handle_interrupts(int index) {
+       dwc3_uboot_handle_interrupt(index);
+       return 0;
+}
+#endif
+
+int board_usb_init(int index, enum usb_init_type init) {
+       switch (init) {
+       case USB_INIT_DEVICE:
+               switch (index) {
+#if defined(CONFIG_LS1043A)
+               case 0:
+                       dwc3_uboot_init(&dwc3_device_data0);
Quoted 9 lines

arch/arm/cpu/armv8/fsl-layerscape/soc.c void fsl_lsch2_early_init_f(void) · line 398

Quoted 8 lines
arch/arm/cpu/armv8/fsl-layerscape/soc.c +8 -0
+                       break;
+               case 1:
+                       dwc3_uboot_init(&dwc3_device_data1);
+                       break;
+               case 2:
+                       dwc3_uboot_init(&dwc3_device_data2);
+                       break;
+#endif

Hello Simon,

Quoted 2 lines

Can this use driver model? It seems odd to be adding new code like this.

Will it be OK to pass below values in dwc3_uboot_init function instead, if DM is not used?

Best Regards,
Rajesh Bhagat

Quoted 56 lines
Quoted 51 lines
arch/arm/cpu/armv8/fsl-layerscape/soc.c +30 -0
+               default:
+                       printf("Invalid Controller Index\n");
+                       return -1;
+               }
+#if defined(CONFIG_LS1043A)
+               dwc3_core_incr_burst_enable(index, 0xf, 0xf);
+               dwc3_core_set_snooping(index, true); #endif
+               break;
+       default:
+               break;
+       }
+
+       return 0;
+}
+
+int board_usb_cleanup(int index, enum usb_init_type init) {
+       switch (init) {
+       case USB_INIT_DEVICE:
+#if defined(CONFIG_LS1043A)
+               dwc3_uboot_exit(index); #endif
+               break;
+       default:
+               break;
+       }
+       return 0;
+}
+#endif
+
+
+
 #ifdef CONFIG_BOARD_LATE_INIT
 int board_late_init(void)
 {
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h +6 -1
index 57b99d4..13ba1a6 100644
@@ -328,6 +328,12 @@ struct ccsr_gur {
 
 #define SCFG_SNPCNFGCR_SECRDSNP                0x80000000
 #define SCFG_SNPCNFGCR_SECWRSNP                0x40000000
+#define SCFG_SNPCNFGCR_USB1RDSNP       0x00200000
+#define SCFG_SNPCNFGCR_USB1WRSNP       0x00100000
+#define SCFG_SNPCNFGCR_USB2RDSNP       0x00008000
+#define SCFG_SNPCNFGCR_USB2WRSNP       0x00010000
+#define SCFG_SNPCNFGCR_USB3RDSNP       0x00002000
+#define SCFG_SNPCNFGCR_USB3WRSNP       0x00004000
 
 /* Supplemental Configuration Unit */  struct ccsr_scfg {
--
Quoted 2 lines

2.6.2.198.g614a2ac

Regards,
Simon

#17 lore raw

PATCH v2 3/4 armv8/fsl-layerscape: add dwc3 gadget driver support

In reply to Rajat Srivastava

Hi Rajat,

Quoted 80 lines

Implements the dwc3 gadget driver support for LS1043 platform, and performs below operations:
1. Enables snooping support for DWC3 controller.
2. Enables cache coherency in LS1043 platform.

---
Changes in v2:
- Moves DWC3 driver specific code to helper functions
- Calls helper functions in SoC specific implementation

 arch/arm/cpu/armv8/fsl-layerscape/soc.c            | 93

++++++++++++++++++++++ .../include/asm/arch-fsl-layerscape/immap_lsch2.h | 6 ++ 2 files changed, 99 insertions(+)

(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl-layerscape/soc.c index 0fb5c7f..cc07524 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c +++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c

arch/arm/cpu/armv8/fsl-layerscape/soc.c +8 -0
@@ -17,6 +17,10 @@
 #ifdef CONFIG_CHAIN_OF_TRUST
 #include <fsl_validate.h>
 #endif
+#include <usb.h>
+#include <dwc3-uboot.h>
+#include <linux/usb/xhci-fsl.h>
+
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -318,9 +322,18 @@ void fsl_lsch2_early_init_f(void)
 #if defined(CONFIG_FSL_QSPI) && !defined(CONFIG_QSPI_BOOT)
 	out_be32(&scfg->qspi_cfg, SCFG_QSPI_CLKSEL);
 #endif
+	/* Make SEC and USB reads and writes snoopable */
+#if defined(CONFIG_LS1043A)
+	setbits_be32(&scfg->snpcnfgcr, SCFG_SNPCNFGCR_SECRDSNP |
+		     SCFG_SNPCNFGCR_SECWRSNP |

SCFG_SNPCNFGCR_USB1RDSNP |

(quoted diff) +1 -0
+		     SCFG_SNPCNFGCR_USB1WRSNP |

SCFG_SNPCNFGCR_USB2RDSNP |

(quoted diff) +1 -0
+		     SCFG_SNPCNFGCR_USB2WRSNP |

SCFG_SNPCNFGCR_USB3RDSNP |

arch/arm/cpu/armv8/fsl-layerscape/soc.c +25 -0
+		     SCFG_SNPCNFGCR_USB3WRSNP);
+#else
 	/* Make SEC reads and writes snoopable */
 	setbits_be32(&scfg->snpcnfgcr, SCFG_SNPCNFGCR_SECRDSNP |
 		     SCFG_SNPCNFGCR_SECWRSNP);
+#endif
 
 	/*
 	 * Enable snoop requests and DVM message requests for
@@ -336,6 +349,86 @@ void fsl_lsch2_early_init_f(void)
 }
 #endif
 
+#ifdef CONFIG_USB_DWC3
+
+#if defined(CONFIG_LS1043A)
+static struct dwc3_device dwc3_device_data0 = {
+	.maximum_speed = USB_SPEED_HIGH,
+	.base = CONFIG_SYS_FSL_XHCI_USB1_ADDR,
+	.dr_mode = USB_DR_MODE_PERIPHERAL,
+	.index = 0,
+};
+
+static struct dwc3_device dwc3_device_data1 = {
+	.maximum_speed = USB_SPEED_HIGH,
+	.base = CONFIG_SYS_FSL_XHCI_USB2_ADDR,
+	.dr_mode = USB_DR_MODE_PERIPHERAL,
+	.index = 1,
+};
+
+static struct dwc3_device dwc3_device_data2 = {
+	.maximum_speed = USB_SPEED_HIGH,
+	.base = CONFIG_SYS_FSL_XHCI_USB3_ADDR,
+	.dr_mode = USB_DR_MODE_PERIPHERAL,
+	.index = 2,

arch/arm/cpu/armv8/fsl-layerscape/soc.c void fsl_lsch2_early_init_f(void) · line 383

Quoted 10 lines
arch/arm/cpu/armv8/fsl-layerscape/soc.c +10 -0
+};
+
+int usb_gadget_handle_interrupts(int index)
+{
+	dwc3_uboot_handle_interrupt(index);
+	return 0;
+}
+#endif
+
+int board_usb_init(int index, enum usb_init_type init)

Are those usb related functions generic? To ask in another way, would it be possible to reuse those functions for other armv8 boards?

Please correct me if I'm wrong, but it seems that LS1043 is a single board. Maybe it would be better to place this code in a separate ./board/nxp/ls1043 directory?

Quoted 68 lines
arch/arm/cpu/armv8/fsl-layerscape/soc.c +48 -0
+{
+	switch (init) {
+	case USB_INIT_DEVICE:
+		switch (index) {
+#if defined(CONFIG_LS1043A)
+		case 0:
+			dwc3_uboot_init(&dwc3_device_data0);
+			break;
+		case 1:
+			dwc3_uboot_init(&dwc3_device_data1);
+			break;
+		case 2:
+			dwc3_uboot_init(&dwc3_device_data2);
+			break;
+#endif
+		default:
+			printf("Invalid Controller Index\n");
+			return -1;
+		}
+#if defined(CONFIG_LS1043A)
+		dwc3_core_incr_burst_enable(index, 0xf, 0xf);
+		dwc3_core_set_snooping(index, true);
+#endif
+		break;
+	default:
+		break;
+	}
+
+	return 0;
+}
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+	switch (init) {
+	case USB_INIT_DEVICE:
+#if defined(CONFIG_LS1043A)
+		dwc3_uboot_exit(index);
+#endif
+		break;
+	default:
+		break;
+	}
+	return 0;
+}
+#endif
+
+
+
 #ifdef CONFIG_BOARD_LATE_INIT
 int board_late_init(void)
 {
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h index 57b99d4..13ba1a6 100644 --- a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h +++ b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h @@ -328,6 +328,12 @@ struct ccsr_gur {
#define SCFG_SNPCNFGCR_SECRDSNP 0x80000000
#define SCFG_SNPCNFGCR_SECWRSNP 0x40000000

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h +6 -0
+#define SCFG_SNPCNFGCR_USB1RDSNP	0x00200000
+#define SCFG_SNPCNFGCR_USB1WRSNP	0x00100000
+#define SCFG_SNPCNFGCR_USB2RDSNP	0x00008000
+#define SCFG_SNPCNFGCR_USB2WRSNP	0x00010000
+#define SCFG_SNPCNFGCR_USB3RDSNP	0x00002000
+#define SCFG_SNPCNFGCR_USB3WRSNP	0x00004000
 
 /* Supplemental Configuration Unit */
 struct ccsr_scfg {
Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#18 lore raw

PATCH v2 3/4 armv8/fsl-layerscape: add dwc3 gadget driver support

Quoted 94 lines

-----Original Message-----
From: Lukasz Majewski [mailto:l.majewski at samsung.com]
Sent: Thursday, June 23, 2016 8:27 PM
To: Rajat Srivastava <[email protected]>
Cc: u-boot at lists.denx.de; sjg at chromium.org; marex at denx.de; albert.u.boot at aribaud.net; prabhakar at freescale.com; york sun <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; michal.simek at xilinx.com; felipe.balbi at linux.intel.com
Subject: Re: [PATCH v2 3/4] armv8/fsl-layerscape: add dwc3 gadget driver support

Hi Rajat,

Quoted 8 lines

Implements the dwc3 gadget driver support for LS1043 platform, and performs below operations:
1. Enables snooping support for DWC3 controller.
2. Enables cache coherency in LS1043 platform.

Quoted 7 lines

---
Changes in v2:
- Moves DWC3 driver specific code to helper functions
- Calls helper functions in SoC specific implementation

 arch/arm/cpu/armv8/fsl-layerscape/soc.c            | 93

++++++++++++++++++++++ .../include/asm/arch-fsl-

layerscape/immap_lsch2

Quoted 64 lines

++++++++++++++++++++++ .h
| 6 ++ 2 files changed, 99 insertions(+)

(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl-layerscape/soc.c index 0fb5c7f..cc07524 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c +++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c

arch/arm/cpu/armv8/fsl-layerscape/soc.c +8 -0
@@ -17,6 +17,10 @@
 #ifdef CONFIG_CHAIN_OF_TRUST
 #include <fsl_validate.h>
 #endif
+#include <usb.h>
+#include <dwc3-uboot.h>
+#include <linux/usb/xhci-fsl.h>
+
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -318,9 +322,18 @@ void fsl_lsch2_early_init_f(void)  #if
 defined(CONFIG_FSL_QSPI) && !defined(CONFIG_QSPI_BOOT)
 	out_be32(&scfg->qspi_cfg, SCFG_QSPI_CLKSEL);  #endif
+	/* Make SEC and USB reads and writes snoopable */ #if
+defined(CONFIG_LS1043A)
+	setbits_be32(&scfg->snpcnfgcr, SCFG_SNPCNFGCR_SECRDSNP |
+		     SCFG_SNPCNFGCR_SECWRSNP |

SCFG_SNPCNFGCR_USB1RDSNP |

(quoted diff) +1 -0
+		     SCFG_SNPCNFGCR_USB1WRSNP |

SCFG_SNPCNFGCR_USB2RDSNP |

(quoted diff) +1 -0
+		     SCFG_SNPCNFGCR_USB2WRSNP |

SCFG_SNPCNFGCR_USB3RDSNP |

(quoted diff) +27 -0
+		     SCFG_SNPCNFGCR_USB3WRSNP);
+#else
 	/* Make SEC reads and writes snoopable */
 	setbits_be32(&scfg->snpcnfgcr, SCFG_SNPCNFGCR_SECRDSNP |
 		     SCFG_SNPCNFGCR_SECWRSNP);
+#endif
 
 	/*
 	 * Enable snoop requests and DVM message requests for @@ -336,6
+349,86 @@ void fsl_lsch2_early_init_f(void)  }  #endif
 
+#ifdef CONFIG_USB_DWC3
+
+#if defined(CONFIG_LS1043A)
+static struct dwc3_device dwc3_device_data0 = {
+	.maximum_speed = USB_SPEED_HIGH,
+	.base = CONFIG_SYS_FSL_XHCI_USB1_ADDR,
+	.dr_mode = USB_DR_MODE_PERIPHERAL,
+	.index = 0,
+};
+
+static struct dwc3_device dwc3_device_data1 = {
+	.maximum_speed = USB_SPEED_HIGH,
+	.base = CONFIG_SYS_FSL_XHCI_USB2_ADDR,
+	.dr_mode = USB_DR_MODE_PERIPHERAL,
+	.index = 1,
+};
+
+static struct dwc3_device dwc3_device_data2 = {
+	.maximum_speed = USB_SPEED_HIGH,
+	.base = CONFIG_SYS_FSL_XHCI_USB3_ADDR,
+	.dr_mode = USB_DR_MODE_PERIPHERAL,
+	.index = 2,
+};
Quoted 9 lines

arch/arm/cpu/armv8/fsl-layerscape/soc.c void fsl_lsch2_early_init_f(void) · line 383

Quoted 8 lines
arch/arm/cpu/armv8/fsl-layerscape/soc.c +8 -0
+
+int usb_gadget_handle_interrupts(int index) {
+	dwc3_uboot_handle_interrupt(index);
+	return 0;
+}
+#endif
+
+int board_usb_init(int index, enum usb_init_type init)

Hello Lukasz,

Quoted 3 lines

Are those usb related functions generic? To ask in another way, would it be possible to reuse those functions for other armv8 boards?

We are planning to use the above code for all the armv8 boards, e.g. LS1043A and LS1012A as they use the same chasis. Hence kept the code in armv8 specific file instead of board files.

Best Regards,
Rajesh Bhagat

Quoted 77 lines

Please correct me if I'm wrong, but it seems that LS1043 is a single board. Maybe it would be better to place this code in a separate ./board/nxp/ls1043 directory?

Quoted 57 lines
arch/arm/cpu/armv8/fsl-layerscape/soc.c +46 -0
+{
+	switch (init) {
+	case USB_INIT_DEVICE:
+		switch (index) {
+#if defined(CONFIG_LS1043A)
+		case 0:
+			dwc3_uboot_init(&dwc3_device_data0);
+			break;
+		case 1:
+			dwc3_uboot_init(&dwc3_device_data1);
+			break;
+		case 2:
+			dwc3_uboot_init(&dwc3_device_data2);
+			break;
+#endif
+		default:
+			printf("Invalid Controller Index\n");
+			return -1;
+		}
+#if defined(CONFIG_LS1043A)
+		dwc3_core_incr_burst_enable(index, 0xf, 0xf);
+		dwc3_core_set_snooping(index, true); #endif
+		break;
+	default:
+		break;
+	}
+
+	return 0;
+}
+
+int board_usb_cleanup(int index, enum usb_init_type init) {
+	switch (init) {
+	case USB_INIT_DEVICE:
+#if defined(CONFIG_LS1043A)
+		dwc3_uboot_exit(index);
+#endif
+		break;
+	default:
+		break;
+	}
+	return 0;
+}
+#endif
+
+
+
 #ifdef CONFIG_BOARD_LATE_INIT
 int board_late_init(void)
 {
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h index 57b99d4..13ba1a6 100644 --- a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h +++ b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h @@ -328,6 +328,12 @@ struct ccsr_gur {
#define SCFG_SNPCNFGCR_SECRDSNP 0x80000000
#define SCFG_SNPCNFGCR_SECWRSNP 0x40000000

arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h struct ccsr_gur {

Quoted 8 lines
arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h +6 -0
+#define SCFG_SNPCNFGCR_USB1RDSNP	0x00200000
+#define SCFG_SNPCNFGCR_USB1WRSNP	0x00100000
+#define SCFG_SNPCNFGCR_USB2RDSNP	0x00008000
+#define SCFG_SNPCNFGCR_USB2WRSNP	0x00010000
+#define SCFG_SNPCNFGCR_USB3RDSNP	0x00002000
+#define SCFG_SNPCNFGCR_USB3WRSNP	0x00004000
 
 /* Supplemental Configuration Unit */  struct ccsr_scfg {

--
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

#19 lore raw

PATCH v2 3/4 armv8/fsl-layerscape: add dwc3 gadget driver support

Hi Rajesh,

Quoted 107 lines
Quoted 95 lines

-----Original Message-----
From: Lukasz Majewski [mailto:l.majewski at samsung.com]
Sent: Thursday, June 23, 2016 8:27 PM
To: Rajat Srivastava <[email protected]>
Cc: u-boot at lists.denx.de; sjg at chromium.org; marex at denx.de; albert.u.boot at aribaud.net; prabhakar at freescale.com; york sun <[email protected]>; Mingkai Hu <[email protected]>; Rajesh Bhagat <[email protected]>; michal.simek at xilinx.com; felipe.balbi at linux.intel.com Subject: Re: [PATCH v2 3/4] armv8/fsl-layerscape: add dwc3 gadget driver support

Hi Rajat,

Quoted 8 lines

Implements the dwc3 gadget driver support for LS1043 platform, and performs below operations:
1. Enables snooping support for DWC3 controller.
2. Enables cache coherency in LS1043 platform.

Quoted 7 lines

---
Changes in v2:
- Moves DWC3 driver specific code to helper functions
- Calls helper functions in SoC specific implementation

 arch/arm/cpu/armv8/fsl-layerscape/soc.c            | 93

++++++++++++++++++++++ .../include/asm/arch-fsl-

layerscape/immap_lsch2

Quoted 64 lines

++++++++++++++++++++++ .h
| 6 ++ 2 files changed, 99 insertions(+)

(quoted diff) +0 -0

b/arch/arm/cpu/armv8/fsl-layerscape/soc.c index 0fb5c7f..cc07524 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c +++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c

arch/arm/cpu/armv8/fsl-layerscape/soc.c +8 -0
@@ -17,6 +17,10 @@
 #ifdef CONFIG_CHAIN_OF_TRUST
 #include <fsl_validate.h>
 #endif
+#include <usb.h>
+#include <dwc3-uboot.h>
+#include <linux/usb/xhci-fsl.h>
+
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -318,9 +322,18 @@ void fsl_lsch2_early_init_f(void)  #if
 defined(CONFIG_FSL_QSPI) && !defined(CONFIG_QSPI_BOOT)
 	out_be32(&scfg->qspi_cfg, SCFG_QSPI_CLKSEL);  #endif
+	/* Make SEC and USB reads and writes snoopable */ #if
+defined(CONFIG_LS1043A)
+	setbits_be32(&scfg->snpcnfgcr, SCFG_SNPCNFGCR_SECRDSNP |
+		     SCFG_SNPCNFGCR_SECWRSNP |

SCFG_SNPCNFGCR_USB1RDSNP |

(quoted diff) +1 -0
+		     SCFG_SNPCNFGCR_USB1WRSNP |

SCFG_SNPCNFGCR_USB2RDSNP |

(quoted diff) +1 -0
+		     SCFG_SNPCNFGCR_USB2WRSNP |

SCFG_SNPCNFGCR_USB3RDSNP |

(quoted diff) +26 -1
+		     SCFG_SNPCNFGCR_USB3WRSNP);
+#else
 	/* Make SEC reads and writes snoopable */
 	setbits_be32(&scfg->snpcnfgcr, SCFG_SNPCNFGCR_SECRDSNP |
 		     SCFG_SNPCNFGCR_SECWRSNP);
+#endif
 
 	/*
 	 * Enable snoop requests and DVM message requests for @@
-336,6 +349,86 @@ void fsl_lsch2_early_init_f(void)  }  #endif
 
+#ifdef CONFIG_USB_DWC3
+
+#if defined(CONFIG_LS1043A)
+static struct dwc3_device dwc3_device_data0 = {
+	.maximum_speed = USB_SPEED_HIGH,
+	.base = CONFIG_SYS_FSL_XHCI_USB1_ADDR,
+	.dr_mode = USB_DR_MODE_PERIPHERAL,
+	.index = 0,
+};
+
+static struct dwc3_device dwc3_device_data1 = {
+	.maximum_speed = USB_SPEED_HIGH,
+	.base = CONFIG_SYS_FSL_XHCI_USB2_ADDR,
+	.dr_mode = USB_DR_MODE_PERIPHERAL,
+	.index = 1,
+};
+
+static struct dwc3_device dwc3_device_data2 = {
+	.maximum_speed = USB_SPEED_HIGH,
+	.base = CONFIG_SYS_FSL_XHCI_USB3_ADDR,
+	.dr_mode = USB_DR_MODE_PERIPHERAL,
+	.index = 2,
+};
Quoted 9 lines

arch/arm/cpu/armv8/fsl-layerscape/soc.c void fsl_lsch2_early_init_f(void) · line 383

Quoted 8 lines
arch/arm/cpu/armv8/fsl-layerscape/soc.c +8 -0
+
+int usb_gadget_handle_interrupts(int index) {
+	dwc3_uboot_handle_interrupt(index);
+	return 0;
+}
+#endif
+
+int board_usb_init(int index, enum usb_init_type init)

Hello Lukasz,

Quoted 8 lines
Quoted 4 lines

Are those usb related functions generic? To ask in another way, would it be possible to reuse those functions for other armv8 boards?

We are planning to use the above code for all the armv8 boards, e.g. LS1043A and LS1012A as they use the same chasis. Hence kept the code in armv8 specific file instead of board files.

Ok, thanks for clarification.

Quoted 84 lines

Best Regards,
Rajesh Bhagat

Quoted 79 lines

Please correct me if I'm wrong, but it seems that LS1043 is a single board. Maybe it would be better to place this code in a separate ./board/nxp/ls1043 directory?

Quoted 65 lines
arch/arm/cpu/armv8/fsl-layerscape/soc.c +46 -0
+{
+	switch (init) {
+	case USB_INIT_DEVICE:
+		switch (index) {
+#if defined(CONFIG_LS1043A)
+		case 0:
+			dwc3_uboot_init(&dwc3_device_data0);
+			break;
+		case 1:
+			dwc3_uboot_init(&dwc3_device_data1);
+			break;
+		case 2:
+			dwc3_uboot_init(&dwc3_device_data2);
+			break;
+#endif
+		default:
+			printf("Invalid Controller Index\n");
+			return -1;
+		}
+#if defined(CONFIG_LS1043A)
+		dwc3_core_incr_burst_enable(index, 0xf, 0xf);
+		dwc3_core_set_snooping(index, true); #endif
+		break;
+	default:
+		break;
+	}
+
+	return 0;
+}
+
+int board_usb_cleanup(int index, enum usb_init_type init) {
+	switch (init) {
+	case USB_INIT_DEVICE:
+#if defined(CONFIG_LS1043A)
+		dwc3_uboot_exit(index);
+#endif
+		break;
+	default:
+		break;
+	}
+	return 0;
+}
+#endif
+
+
+
 #ifdef CONFIG_BOARD_LATE_INIT
 int board_late_init(void)
 {

diff --git a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h index 57b99d4..13ba1a6 100644 --- a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h +++ b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h @@ -328,6 +328,12 @@ struct ccsr_gur { #define
SCFG_SNPCNFGCR_SECRDSNP 0x80000000 #define
SCFG_SNPCNFGCR_SECWRSNP 0x40000000 +#define
SCFG_SNPCNFGCR_USB1RDSNP 0x00200000 +#define
SCFG_SNPCNFGCR_USB1WRSNP 0x00100000 +#define
SCFG_SNPCNFGCR_USB2RDSNP 0x00008000 +#define
SCFG_SNPCNFGCR_USB2WRSNP 0x00010000 +#define
SCFG_SNPCNFGCR_USB3RDSNP 0x00002000 +#define
SCFG_SNPCNFGCR_USB3WRSNP 0x00004000

Quoted 1 line

/* Supplemental Configuration Unit */ struct ccsr_scfg {

--
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#20 lore raw

PATCH v2 4/4 armv8/fsl-layerscape: enable dwc3 gadget driver support

In reply to Rajat Srivastava

Enables dwc3 gadget driver support on LS1043QDS platform.

---
Changes in v2:
- None

 include/configs/ls1043aqds.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
include/configs/ls1043aqds.h +15 -0
index af1f73d..8c99641 100644
@@ -394,6 +394,21 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_USB_MAX_CONTROLLER_COUNT		3
 #define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS	2
 #define CONFIG_USB_STORAGE
+
+#define CONFIG_USB_DWC3
+#define CONFIG_USB_DWC3_GADGET
+
+#define CONFIG_USB_GADGET
+#define CONFIG_USB_FUNCTION_MASS_STORAGE
+#define CONFIG_USB_GADGET_DOWNLOAD
+#define CONFIG_USB_GADGET_VBUS_DRAW 2
+#define CONFIG_G_DNL_MANUFACTURER "NXP Semiconductor"
+#define CONFIG_G_DNL_VENDOR_NUM 0x0471
+#define CONFIG_G_DNL_PRODUCT_NUM 0x1234
+#define CONFIG_USB_GADGET_DUALSPEED
+
+/* USB Gadget ums command */
+#define CONFIG_CMD_USB_MASS_STORAGE
 #endif
 
 /*
Signature · 1 line
2.6.2.198.g614a2ac
#21 lore raw

PATCH v2 4/4 armv8/fsl-layerscape: enable dwc3 gadget driver support

Hi Rajat,

Quoted 27 lines

Enables dwc3 gadget driver support on LS1043QDS platform.

---
Changes in v2:
- None

 include/configs/ls1043aqds.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
(quoted diff) +0 -0

b/include/configs/ls1043aqds.h index af1f73d..8c99641 100644

include/configs/ls1043aqds.h +8 -0
@@ -394,6 +394,21 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_USB_MAX_CONTROLLER_COUNT		3
 #define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS	2
 #define CONFIG_USB_STORAGE
+
+#define CONFIG_USB_DWC3
+#define CONFIG_USB_DWC3_GADGET
+
+#define CONFIG_USB_GADGET
+#define CONFIG_USB_FUNCTION_MASS_STORAGE
+#define CONFIG_USB_GADGET_DOWNLOAD
+#define CONFIG_USB_GADGET_VBUS_DRAW 2

include/configs/ls1043aqds.h unsigned long get_board_ddr_clk(void); · line 414

Quoted 10 lines
include/configs/ls1043aqds.h +7 -0
+#define CONFIG_G_DNL_MANUFACTURER "NXP Semiconductor"
+#define CONFIG_G_DNL_VENDOR_NUM 0x0471
+#define CONFIG_G_DNL_PRODUCT_NUM 0x1234
+#define CONFIG_USB_GADGET_DUALSPEED
+
+/* USB Gadget ums command */
+#define CONFIG_CMD_USB_MASS_STORAGE
 #endif
 
 /*
Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group