All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 00/11] driver model bring-up of dwc3 usb peripheral
@ 2017-05-23 11:55 Vignesh R
  2017-05-23 11:55 ` [U-Boot] [PATCH 01/11] drivers: usb: dwc3: remove devm_zalloc from linux_compact Vignesh R
                   ` (10 more replies)
  0 siblings, 11 replies; 23+ messages in thread
From: Vignesh R @ 2017-05-23 11:55 UTC (permalink / raw)
  To: u-boot

This patch series enables ti dwc3 usb peripherial driver to adopt driver
model and DT. And also adds support for to USB device boot using RNDIS
for AM437x.

Tested on AM437x GP EVM in USB RNDIS boot mode. ROM downloads SPL, SPL
loads U-Boot via usb ether and then U-Boot loads kernel image using the
same interface.

Based on previous work submitted by Mugunthan here:
https://lists.denx.de/pipermail/u-boot/2016-March/250115.html

Mugunthan V N (7):
  drivers: usb: dwc3: remove devm_zalloc from linux_compact
  drivers: usb: dwc3-omap: move usb_gadget_handle_interrupts from board
    files to drivers
  am437x: board: do not register usb devices when CONFIG_DM_USB is
    defined
  omap5/am57xx/dra7xx: board: do not register usb devices when
    CONFIG_DM_USB is defined
  drivers: usb: dwc3: add ti dwc3 misc driver for wrapper
  drivers: usb: common: add support to get maximum speed from dt
  drivers: usb: dwc3: add ti dwc3 peripheral driver with driver model
    support

Vignesh R (4):
  dwc3: Add support for USB device boot
  am43xx: Add USB device boot support
  configs: am43xx: Enable configs to support USB device boot
  ARM: am437x-gp-evm-u-boot.dtsi: Enable nodes for USB device boot

 arch/arm/dts/am437x-gp-evm-u-boot.dtsi    |  20 +++
 arch/arm/mach-omap2/boot-common.c         |   3 +-
 board/ti/am43xx/board.c                   |  41 +++---
 board/ti/am57xx/board.c                   |  13 +-
 board/ti/dra7xx/evm.c                     |  13 +-
 board/ti/omap5_uevm/evm.c                 |  13 +-
 configs/am43xx_evm_defconfig              |  13 +-
 configs/am43xx_evm_usbhost_boot_defconfig |   1 +
 drivers/usb/common/common.c               |  29 ++++
 drivers/usb/dwc3/core.c                   |  64 ++++++++-
 drivers/usb/dwc3/core.h                   |   6 +
 drivers/usb/dwc3/dwc3-omap.c              | 232 +++++++++++++++++++++++++++++-
 drivers/usb/dwc3/gadget.c                 |   2 +-
 drivers/usb/dwc3/linux-compat.h           |   5 -
 drivers/usb/dwc3/ti_usb_phy.c             |   1 +
 drivers/usb/gadget/ether.c                |   9 +-
 drivers/usb/gadget/gadget_chips.h         |   2 +
 include/configs/am43xx_evm.h              |  27 ++--
 include/linux/usb/otg.h                   |   9 ++
 scripts/Makefile.spl                      |   1 +
 20 files changed, 418 insertions(+), 86 deletions(-)

-- 
2.13.0

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH 01/11] drivers: usb: dwc3: remove devm_zalloc from linux_compact
  2017-05-23 11:55 [U-Boot] [PATCH 00/11] driver model bring-up of dwc3 usb peripheral Vignesh R
@ 2017-05-23 11:55 ` Vignesh R
  2017-05-31  3:50   ` Simon Glass
  2017-05-23 11:55 ` [U-Boot] [PATCH 02/11] drivers: usb: dwc3-omap: move usb_gadget_handle_interrupts from board files to drivers Vignesh R
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Vignesh R @ 2017-05-23 11:55 UTC (permalink / raw)
  To: u-boot

From: Mugunthan V N <mugunthanvnm@ti.com>

devm_zalloc() is already defined in dm/device.h header, so
devm_zalloc can be removed from linux_compact.h beader file.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: Vignesh R <vigneshr@ti.com>
---
 drivers/usb/dwc3/core.c         | 7 +++++--
 drivers/usb/dwc3/dwc3-omap.c    | 3 ++-
 drivers/usb/dwc3/linux-compat.h | 5 -----
 drivers/usb/dwc3/ti_usb_phy.c   | 1 +
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 87b9c87edf6a..98102bd6b00a 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -19,6 +19,7 @@
 #include <dwc3-uboot.h>
 #include <asm/dma-mapping.h>
 #include <linux/ioport.h>
+#include <dm.h>
 
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
@@ -111,7 +112,8 @@ static struct dwc3_event_buffer *dwc3_alloc_one_event_buffer(struct dwc3 *dwc,
 {
 	struct dwc3_event_buffer	*evt;
 
-	evt = devm_kzalloc(dwc->dev, sizeof(*evt), GFP_KERNEL);
+	evt = devm_kzalloc((struct udevice *)dwc->dev, sizeof(*evt),
+			   GFP_KERNEL);
 	if (!evt)
 		return ERR_PTR(-ENOMEM);
 
@@ -624,7 +626,8 @@ int dwc3_uboot_init(struct dwc3_device *dwc3_dev)
 
 	void			*mem;
 
-	mem = devm_kzalloc(dev, sizeof(*dwc) + DWC3_ALIGN_MASK, GFP_KERNEL);
+	mem = devm_kzalloc((struct udevice *)dev,
+			   sizeof(*dwc) + DWC3_ALIGN_MASK, GFP_KERNEL);
 	if (!mem)
 		return -ENOMEM;
 
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 3dcc2f484777..63551e780434 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -20,6 +20,7 @@
 #include <dwc3-omap-uboot.h>
 #include <linux/usb/dwc3-omap.h>
 #include <linux/ioport.h>
+#include <dm.h>
 
 #include <linux/usb/otg.h>
 #include <linux/compat.h>
@@ -377,7 +378,7 @@ int dwc3_omap_uboot_init(struct dwc3_omap_device *omap_dev)
 	struct device		*dev = NULL;
 	struct dwc3_omap	*omap;
 
-	omap = devm_kzalloc(dev, sizeof(*omap), GFP_KERNEL);
+	omap = devm_kzalloc((struct udevice *)dev, sizeof(*omap), GFP_KERNEL);
 	if (!omap)
 		return -ENOMEM;
 
diff --git a/drivers/usb/dwc3/linux-compat.h b/drivers/usb/dwc3/linux-compat.h
index 9e944a31be11..f95d6152b7fe 100644
--- a/drivers/usb/dwc3/linux-compat.h
+++ b/drivers/usb/dwc3/linux-compat.h
@@ -23,9 +23,4 @@ static inline size_t strlcat(char *dest, const char *src, size_t n)
 	return strlen(dest) + strlen(src);
 }
 
-static inline void *devm_kzalloc(struct device *dev, unsigned int size,
-				 unsigned int flags)
-{
-	return kzalloc(size, flags);
-}
 #endif
diff --git a/drivers/usb/dwc3/ti_usb_phy.c b/drivers/usb/dwc3/ti_usb_phy.c
index 218a8e586c8d..8088afc97047 100644
--- a/drivers/usb/dwc3/ti_usb_phy.c
+++ b/drivers/usb/dwc3/ti_usb_phy.c
@@ -24,6 +24,7 @@
 #include <linux/ioport.h>
 #include <asm/io.h>
 #include <asm/arch/sys_proto.h>
+#include <dm.h>
 
 #include "linux-compat.h"
 
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH 02/11] drivers: usb: dwc3-omap: move usb_gadget_handle_interrupts from board files to drivers
  2017-05-23 11:55 [U-Boot] [PATCH 00/11] driver model bring-up of dwc3 usb peripheral Vignesh R
  2017-05-23 11:55 ` [U-Boot] [PATCH 01/11] drivers: usb: dwc3: remove devm_zalloc from linux_compact Vignesh R
@ 2017-05-23 11:55 ` Vignesh R
  2017-05-31  3:50   ` Simon Glass
  2017-05-23 11:55 ` [U-Boot] [PATCH 03/11] am437x: board: do not register usb devices when CONFIG_DM_USB is defined Vignesh R
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Vignesh R @ 2017-05-23 11:55 UTC (permalink / raw)
  To: u-boot

From: Mugunthan V N <mugunthanvnm@ti.com>

In board files of am437x, dra7xx, omap5 and am5xx,
usb_gadget_handle_interrupts() is just a place holder to handle
dwc3 interrupts, nothing related to board is handled here, so
move usb_gadget_handle_interrupts() from board files to
dwc3-omap.c to avoid code duplication based on boards.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: Vignesh R <vigneshr@ti.com>
---
 board/ti/am43xx/board.c      | 11 -----------
 board/ti/dra7xx/evm.c        | 11 -----------
 board/ti/omap5_uevm/evm.c    | 11 -----------
 drivers/usb/dwc3/dwc3-omap.c | 12 ++++++++++++
 4 files changed, 12 insertions(+), 33 deletions(-)

diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index f44103d4d6fe..3797ac2adabb 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -660,17 +660,6 @@ static struct ti_usb_phy_device usb_phy2_device = {
 	.usb2_phy_power = (void *)USB2_PHY2_POWER,
 	.index = 1,
 };
-
-int usb_gadget_handle_interrupts(int index)
-{
-	u32 status;
-
-	status = dwc3_omap_uboot_interrupt_status(index);
-	if (status)
-		dwc3_uboot_handle_interrupt(index);
-
-	return 0;
-}
 #endif /* CONFIG_USB_DWC3 */
 
 #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index 8c02addd081e..a0e2ede590ec 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -802,17 +802,6 @@ int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 	disable_usb_clocks(index);
 	return 0;
 }
-
-int usb_gadget_handle_interrupts(int index)
-{
-	u32 status;
-
-	status = dwc3_omap_uboot_interrupt_status(index);
-	if (status)
-		dwc3_uboot_handle_interrupt(index);
-
-	return 0;
-}
 #endif
 
 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_OS_BOOT)
diff --git a/board/ti/omap5_uevm/evm.c b/board/ti/omap5_uevm/evm.c
index b6cc41733385..0ca22f1fde5f 100644
--- a/board/ti/omap5_uevm/evm.c
+++ b/board/ti/omap5_uevm/evm.c
@@ -117,17 +117,6 @@ int board_usb_cleanup(int index, enum usb_init_type init)
 
 	return 0;
 }
-
-int usb_gadget_handle_interrupts(int index)
-{
-	u32 status;
-
-	status = dwc3_omap_uboot_interrupt_status(index);
-	if (status)
-		dwc3_uboot_handle_interrupt(index);
-
-	return 0;
-}
 #endif
 
 /**
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 63551e780434..f18884f13392 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -24,6 +24,7 @@
 
 #include <linux/usb/otg.h>
 #include <linux/compat.h>
+#include <dwc3-uboot.h>
 
 #include "linux-compat.h"
 
@@ -446,6 +447,17 @@ int dwc3_omap_uboot_interrupt_status(int index)
 	return 0;
 }
 
+int usb_gadget_handle_interrupts(int index)
+{
+	u32 status;
+
+	status = dwc3_omap_uboot_interrupt_status(index);
+	if (status)
+		dwc3_uboot_handle_interrupt(index);
+
+	return 0;
+}
+
 MODULE_ALIAS("platform:omap-dwc3");
 MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
 MODULE_LICENSE("GPL v2");
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH 03/11] am437x: board: do not register usb devices when CONFIG_DM_USB is defined
  2017-05-23 11:55 [U-Boot] [PATCH 00/11] driver model bring-up of dwc3 usb peripheral Vignesh R
  2017-05-23 11:55 ` [U-Boot] [PATCH 01/11] drivers: usb: dwc3: remove devm_zalloc from linux_compact Vignesh R
  2017-05-23 11:55 ` [U-Boot] [PATCH 02/11] drivers: usb: dwc3-omap: move usb_gadget_handle_interrupts from board files to drivers Vignesh R
@ 2017-05-23 11:55 ` Vignesh R
  2017-05-31  3:50   ` Simon Glass
  2017-05-23 11:55 ` [U-Boot] [PATCH 04/11] omap5/am57xx/dra7xx: " Vignesh R
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Vignesh R @ 2017-05-23 11:55 UTC (permalink / raw)
  To: u-boot

From: Mugunthan V N <mugunthanvnm@ti.com>

Do not register usb devices when CONFIG_DM_USB is define.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: Vignesh R <vigneshr@ti.com>
---
 board/ti/am43xx/board.c                   | 10 ++--------
 configs/am43xx_evm_usbhost_boot_defconfig |  1 +
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index 3797ac2adabb..f6b36949f756 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -624,7 +624,7 @@ int board_late_init(void)
 }
 #endif
 
-#ifdef CONFIG_USB_DWC3
+#if defined(CONFIG_USB_DWC3) && !defined(CONFIG_DM_USB)
 static struct dwc3_device usb_otg_ss1 = {
 	.maximum_speed = USB_SPEED_HIGH,
 	.base = USB_OTG_SS1_BASE,
@@ -660,13 +660,10 @@ static struct ti_usb_phy_device usb_phy2_device = {
 	.usb2_phy_power = (void *)USB2_PHY2_POWER,
 	.index = 1,
 };
-#endif /* CONFIG_USB_DWC3 */
 
-#if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
 int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 {
 	enable_usb_clocks(index);
-#ifdef CONFIG_USB_DWC3
 	switch (index) {
 	case 0:
 		if (init == USB_INIT_DEVICE) {
@@ -689,14 +686,12 @@ int omap_xhci_board_usb_init(int index, enum usb_init_type init)
 	default:
 		printf("Invalid Controller Index\n");
 	}
-#endif
 
 	return 0;
 }
 
 int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 {
-#ifdef CONFIG_USB_DWC3
 	switch (index) {
 	case 0:
 	case 1:
@@ -709,12 +704,11 @@ int omap_xhci_board_usb_cleanup(int index, enum usb_init_type init)
 	default:
 		printf("Invalid Controller Index\n");
 	}
-#endif
 	disable_usb_clocks(index);
 
 	return 0;
 }
-#endif /* defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP) */
+#endif /* defined(CONFIG_USB_DWC3) && !defined(CONFIG_DM_USB) */
 
 #ifdef CONFIG_DRIVER_TI_CPSW
 
diff --git a/configs/am43xx_evm_usbhost_boot_defconfig b/configs/am43xx_evm_usbhost_boot_defconfig
index a98a97fa427c..89d2ba8d8315 100644
--- a/configs/am43xx_evm_usbhost_boot_defconfig
+++ b/configs/am43xx_evm_usbhost_boot_defconfig
@@ -69,6 +69,7 @@ CONFIG_USB_DWC3_PHY_OMAP=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_SPL_USB_GADGET_SUPPORT=y
 CONFIG_G_DNL_MANUFACTURER="Texas Instruments"
 CONFIG_G_DNL_VENDOR_NUM=0x0403
 CONFIG_G_DNL_PRODUCT_NUM=0xbd00
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH 04/11] omap5/am57xx/dra7xx: board: do not register usb devices when CONFIG_DM_USB is defined
  2017-05-23 11:55 [U-Boot] [PATCH 00/11] driver model bring-up of dwc3 usb peripheral Vignesh R
                   ` (2 preceding siblings ...)
  2017-05-23 11:55 ` [U-Boot] [PATCH 03/11] am437x: board: do not register usb devices when CONFIG_DM_USB is defined Vignesh R
@ 2017-05-23 11:55 ` Vignesh R
  2017-05-31  3:50   ` Simon Glass
  2017-05-23 11:55 ` [U-Boot] [PATCH 05/11] drivers: usb: dwc3: add ti dwc3 misc driver for wrapper Vignesh R
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Vignesh R @ 2017-05-23 11:55 UTC (permalink / raw)
  To: u-boot

From: Mugunthan V N <mugunthanvnm@ti.com>

Do not register usb devices when CONFIG_DM_USB is define.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: Vignesh R <vigneshr@ti.com>
---
 board/ti/am57xx/board.c   | 2 +-
 board/ti/dra7xx/evm.c     | 2 +-
 board/ti/omap5_uevm/evm.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index 3be697a6eaad..3566f8d94972 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -688,7 +688,7 @@ int spl_start_uboot(void)
 }
 #endif
 
-#ifdef CONFIG_USB_DWC3
+#if defined(CONFIG_USB_DWC3) && !defined(CONFIG_DM_USB)
 static struct dwc3_device usb_otg_ss2 = {
 	.maximum_speed = USB_SPEED_HIGH,
 	.base = DRA7_USB_OTG_SS2_BASE,
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index a0e2ede590ec..66f9a7252b5e 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -711,7 +711,7 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
-#ifdef CONFIG_USB_DWC3
+#if defined(CONFIG_USB_DWC3) && !defined(CONFIG_DM_USB)
 static struct dwc3_device usb_otg_ss1 = {
 	.maximum_speed = USB_SPEED_SUPER,
 	.base = DRA7_USB_OTG_SS1_BASE,
diff --git a/board/ti/omap5_uevm/evm.c b/board/ti/omap5_uevm/evm.c
index 0ca22f1fde5f..ea4083c23ad1 100644
--- a/board/ti/omap5_uevm/evm.c
+++ b/board/ti/omap5_uevm/evm.c
@@ -59,7 +59,7 @@ struct tca642x_bank_info tca642x_init[] = {
 	  .configuration_reg = 0x40 },
 };
 
-#ifdef CONFIG_USB_DWC3
+#if defined(CONFIG_USB_DWC3) && !defined(CONFIG_DM_USB)
 static struct dwc3_device usb_otg_ss = {
 	.maximum_speed = USB_SPEED_SUPER,
 	.base = OMAP5XX_USB_OTG_SS_BASE,
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH 05/11] drivers: usb: dwc3: add ti dwc3 misc driver for wrapper
  2017-05-23 11:55 [U-Boot] [PATCH 00/11] driver model bring-up of dwc3 usb peripheral Vignesh R
                   ` (3 preceding siblings ...)
  2017-05-23 11:55 ` [U-Boot] [PATCH 04/11] omap5/am57xx/dra7xx: " Vignesh R
@ 2017-05-23 11:55 ` Vignesh R
  2017-05-31  3:50   ` Simon Glass
  2017-05-23 11:55 ` [U-Boot] [PATCH 06/11] drivers: usb: common: add support to get maximum speed from dt Vignesh R
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Vignesh R @ 2017-05-23 11:55 UTC (permalink / raw)
  To: u-boot

From: Mugunthan V N <mugunthanvnm@ti.com>

Add a misc driver for DWC3 wrapper, so that based on dr_mode the
USB devices can bind to USB host or USB device drivers.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: Vignesh R <vigneshr@ti.com>
---
 board/ti/am57xx/board.c      | 11 ----------
 drivers/usb/dwc3/core.h      |  4 ++++
 drivers/usb/dwc3/dwc3-omap.c | 52 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/dwc3/gadget.c    |  2 +-
 4 files changed, 57 insertions(+), 12 deletions(-)

diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index 3566f8d94972..6137601588a2 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -706,17 +706,6 @@ static struct ti_usb_phy_device usb_phy2_device = {
 	.usb2_phy_power = (void *)DRA7_USB2_PHY2_POWER,
 	.index = 1,
 };
-
-int usb_gadget_handle_interrupts(int index)
-{
-	u32 status;
-
-	status = dwc3_omap_uboot_interrupt_status(index);
-	if (status)
-		dwc3_uboot_handle_interrupt(index);
-
-	return 0;
-}
 #endif /* CONFIG_USB_DWC3 */
 
 #if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 72d2fcdd3f42..24f03e484fd5 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -713,7 +713,11 @@ struct dwc3 {
 	/* device lock */
 	spinlock_t		lock;
 
+#ifndef CONFIG_DM_USB
 	struct device		*dev;
+#else
+	struct udevice		*dev;
+#endif
 
 	struct platform_device	*xhci;
 	struct resource		xhci_resources[DWC3_XHCI_RESOURCES_NUM];
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index f18884f13392..10b93eed5793 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -28,6 +28,11 @@
 
 #include "linux-compat.h"
 
+#include <libfdt.h>
+#include <dm/device.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
 /*
  * All these registers belong to OMAP's Wrapper around the
  * DesignWare USB3 Core.
@@ -135,6 +140,8 @@ struct dwc3_omap {
 	u32			index;
 };
 
+#ifndef CONFIG_DM_USB
+
 static LIST_HEAD(dwc3_omap_list);
 
 static inline u32 dwc3_omap_readl(void __iomem *base, u32 offset)
@@ -462,3 +469,48 @@ MODULE_ALIAS("platform:omap-dwc3");
 MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("DesignWare USB3 OMAP Glue Layer");
+
+#else
+
+static int ti_dwc3_wrapper_bind(struct udevice *parent)
+{
+	const void *fdt = gd->fdt_blob;
+	int node;
+
+	for (node = fdt_first_subnode(fdt, parent->of_offset); node > 0;
+	     node = fdt_next_subnode(fdt, node)) {
+		const char *name = fdt_get_name(fdt, node, NULL);
+		enum usb_dr_mode dr_mode;
+
+		if (strncmp(name, "usb@", 4))
+			continue;
+
+		dr_mode = usb_get_dr_mode(node);
+		switch (dr_mode) {
+		case USB_DR_MODE_PERIPHERAL:
+		case USB_DR_MODE_OTG:
+			/* Bind MUSB device */
+			break;
+		case USB_DR_MODE_HOST:
+			/* Bind MUSB host */
+			break;
+		default:
+			break;
+		};
+	}
+	return 0;
+}
+
+static const struct udevice_id ti_dwc3_ids[] = {
+	{ .compatible = "ti,am437x-dwc3" },
+	{ }
+};
+
+U_BOOT_DRIVER(ti_dwc3_wrapper) = {
+	.name	= "ti-dwc3-wrapper",
+	.id	= UCLASS_MISC,
+	.of_match = ti_dwc3_ids,
+	.bind = ti_dwc3_wrapper_bind,
+};
+
+#endif /* CONFIG_DM_USB */
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index e065c5aeb38d..18bbd5318e48 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2610,7 +2610,7 @@ int dwc3_gadget_init(struct dwc3 *dwc)
 	if (ret)
 		goto err4;
 
-	ret = usb_add_gadget_udc(dwc->dev, &dwc->gadget);
+	ret = usb_add_gadget_udc((struct device *)dwc->dev, &dwc->gadget);
 	if (ret) {
 		dev_err(dwc->dev, "failed to register udc\n");
 		goto err4;
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH 06/11] drivers: usb: common: add support to get maximum speed from dt
  2017-05-23 11:55 [U-Boot] [PATCH 00/11] driver model bring-up of dwc3 usb peripheral Vignesh R
                   ` (4 preceding siblings ...)
  2017-05-23 11:55 ` [U-Boot] [PATCH 05/11] drivers: usb: dwc3: add ti dwc3 misc driver for wrapper Vignesh R
@ 2017-05-23 11:55 ` Vignesh R
  2017-05-31  3:50   ` Simon Glass
  2017-05-23 11:55 ` [U-Boot] [PATCH 07/11] drivers: usb: dwc3: add ti dwc3 peripheral driver with driver model support Vignesh R
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Vignesh R @ 2017-05-23 11:55 UTC (permalink / raw)
  To: u-boot

From: Mugunthan V N <mugunthanvnm@ti.com>

Add support to get maximum speed from dt so that usb drivers
makes use of it for DT parsing.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: Vignesh R <vigneshr@ti.com>
---
 drivers/usb/common/common.c | 29 +++++++++++++++++++++++++++++
 include/linux/usb/otg.h     |  9 +++++++++
 scripts/Makefile.spl        |  1 +
 3 files changed, 39 insertions(+)

diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
index 35c2dc18d955..c11689dc36fa 100644
--- a/drivers/usb/common/common.c
+++ b/drivers/usb/common/common.c
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <libfdt.h>
 #include <linux/usb/otg.h>
+#include <linux/usb/ch9.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -38,3 +39,31 @@ enum usb_dr_mode usb_get_dr_mode(int node)
 
 	return USB_DR_MODE_UNKNOWN;
 }
+
+static const char *const speed_names[] = {
+	[USB_SPEED_UNKNOWN] = "UNKNOWN",
+	[USB_SPEED_LOW] = "low-speed",
+	[USB_SPEED_FULL] = "full-speed",
+	[USB_SPEED_HIGH] = "high-speed",
+	[USB_SPEED_WIRELESS] = "wireless",
+	[USB_SPEED_SUPER] = "super-speed",
+};
+
+enum usb_device_speed usb_get_maximum_speed(int node)
+{
+	const void *fdt = gd->fdt_blob;
+	const char *max_speed;
+	int i;
+
+	max_speed = fdt_getprop(fdt, node, "maximum-speed", NULL);
+	if (!max_speed) {
+		error("usb dr_mode not found\n");
+		return USB_DR_MODE_UNKNOWN;
+	}
+
+	for (i = 0; i < ARRAY_SIZE(speed_names); i++)
+		if (!strcmp(max_speed, speed_names[i]))
+			return i;
+
+	return USB_SPEED_UNKNOWN;
+}
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 8f8ac6aeefe3..b61ef19b22f3 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -26,4 +26,13 @@ enum usb_dr_mode {
  */
 enum usb_dr_mode usb_get_dr_mode(int node);
 
+/**
+ * usb_get_maximum_speed() - Get maximum speed for given device
+ * @node: Node offset to the given device
+ *
+ * The function gets phy interface string from property 'maximum-speed',
+ * and returns the correspondig enum usb_device_speed
+ */
+enum usb_device_speed usb_get_maximum_speed(int node);
+
 #endif /* __LINUX_USB_OTG_H */
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 135706f21de1..bba84c92f0f0 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -78,6 +78,7 @@ endif
 
 libs-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/
 libs-y += drivers/
+libs-y += drivers/usb/common/
 libs-$(CONFIG_SPL_USB_GADGET_SUPPORT) += drivers/usb/dwc3/
 libs-y += dts/
 libs-y += fs/
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH 07/11] drivers: usb: dwc3: add ti dwc3 peripheral driver with driver model support
  2017-05-23 11:55 [U-Boot] [PATCH 00/11] driver model bring-up of dwc3 usb peripheral Vignesh R
                   ` (5 preceding siblings ...)
  2017-05-23 11:55 ` [U-Boot] [PATCH 06/11] drivers: usb: common: add support to get maximum speed from dt Vignesh R
@ 2017-05-23 11:55 ` Vignesh R
  2017-05-23 11:55 ` [U-Boot] [PATCH 08/11] dwc3: Add support for USB device boot Vignesh R
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 23+ messages in thread
From: Vignesh R @ 2017-05-23 11:55 UTC (permalink / raw)
  To: u-boot

From: Mugunthan V N <mugunthanvnm@ti.com>

Add a TI DWC3 peripheral driver with driver model support and the
driver will be bound by the DWC3 wrapper driver based on the
dr_mode device tree entry.

Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: Vignesh R <vigneshr@ti.com>
---
 drivers/usb/dwc3/core.c      |  57 +++++++++++++++
 drivers/usb/dwc3/core.h      |   2 +
 drivers/usb/dwc3/dwc3-omap.c | 167 ++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 225 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 98102bd6b00a..a895f8fbddd3 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -603,6 +603,8 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)
 
 #define DWC3_ALIGN_MASK		(16 - 1)
 
+#ifndef CONFIG_DM_USB
+
 /**
  * dwc3_uboot_init - dwc3 core uboot initialization code
  * @dwc3_dev: struct dwc3_device containing initialization data
@@ -789,3 +791,58 @@ MODULE_ALIAS("platform:dwc3");
 MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("DesignWare USB3 DRD Controller Driver");
+
+#else
+
+int dwc3_init(struct dwc3 *dwc)
+{
+	int ret;
+
+	dwc3_cache_hwparams(dwc);
+
+	ret = dwc3_alloc_event_buffers(dwc, DWC3_EVENT_BUFFERS_SIZE);
+	if (ret) {
+		dev_err(dwc->dev, "failed to allocate event buffers\n");
+		return -ENOMEM;
+	}
+
+	ret = dwc3_core_init(dwc);
+	if (ret) {
+		dev_err(dev, "failed to initialize core\n");
+		goto err0;
+	}
+
+	ret = dwc3_event_buffers_setup(dwc);
+	if (ret) {
+		dev_err(dwc->dev, "failed to setup event buffers\n");
+		goto err1;
+	}
+
+	ret = dwc3_core_init_mode(dwc);
+	if (ret)
+		goto err2;
+
+	return 0;
+
+err2:
+	dwc3_event_buffers_cleanup(dwc);
+
+err1:
+	dwc3_core_exit(dwc);
+
+err0:
+	dwc3_free_event_buffers(dwc);
+
+	return ret;
+}
+
+void dwc3_remove(struct dwc3 *dwc)
+{
+	dwc3_core_exit_mode(dwc);
+	dwc3_event_buffers_cleanup(dwc);
+	dwc3_free_event_buffers(dwc);
+	dwc3_core_exit(dwc);
+	kfree(dwc->mem);
+}
+
+#endif
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 24f03e484fd5..972628751697 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -992,6 +992,8 @@ struct dwc3_gadget_ep_cmd_params {
 
 /* prototypes */
 int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc);
+int dwc3_init(struct dwc3 *dwc);
+void dwc3_remove(struct dwc3 *dwc);
 
 #ifdef CONFIG_USB_DWC3_HOST
 int dwc3_host_init(struct dwc3 *dwc);
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 10b93eed5793..e55201a5845b 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -27,9 +27,21 @@
 #include <dwc3-uboot.h>
 
 #include "linux-compat.h"
+#include <linux/usb/ch9.h>
+#include <linux/usb/gadget.h>
+#include <ti-usb-phy-uboot.h>
+#include <usb.h>
+
+#include "core.h"
 
 #include <libfdt.h>
 #include <dm/device.h>
+#include <dm/uclass.h>
+#include <dm/lists.h>
+#include <dwc3-uboot.h>
+
+#include <asm/omap_common.h>
+#include "gadget.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -140,7 +152,11 @@ struct dwc3_omap {
 	u32			index;
 };
 
-#ifndef CONFIG_DM_USB
+struct omap_dwc3_priv {
+	struct dwc3_omap omap;
+	struct dwc3 dwc3;
+	struct ti_usb_phy_device phy_device;
+};
 
 static LIST_HEAD(dwc3_omap_list);
 
@@ -369,6 +385,8 @@ static void dwc3_omap_set_utmi_mode(struct dwc3_omap *omap, int utmi_mode)
 	dwc3_omap_write_utmi_status(omap, reg);
 }
 
+#ifndef CONFIG_DM_USB
+
 /**
  * dwc3_omap_uboot_init - dwc3 omap uboot initialization code
  * @dev: struct dwc3_omap_device containing initialization data
@@ -472,15 +490,155 @@ MODULE_DESCRIPTION("DesignWare USB3 OMAP Glue Layer");
 
 #else
 
+int usb_gadget_handle_interrupts(int index)
+{
+	struct omap_dwc3_priv *priv;
+	struct dwc3_omap *omap;
+	struct dwc3 *dwc;
+	struct udevice *dev;
+	u32 status;
+	int ret;
+
+	ret = uclass_first_device(UCLASS_USB_DEV_GENERIC, &dev);
+	if (!dev || ret) {
+		error("No USB device found\n");
+		return -ENODEV;
+	}
+
+	priv = dev_get_priv(dev);
+	omap = &priv->omap;
+	dwc = &priv->dwc3;
+
+	status = dwc3_omap_interrupt(-1, omap);
+	if (status)
+		dwc3_gadget_uboot_handle_interrupt(dwc);
+
+	return 0;
+}
+
+static int dwc3_omap_peripheral_probe(struct udevice *dev)
+{
+	struct omap_dwc3_priv *priv = dev_get_priv(dev);
+	struct dwc3_omap *omap = &priv->omap;
+	struct dwc3 *dwc = &priv->dwc3;
+	u32 reg;
+	int ret;
+
+	enable_usb_clocks(0);
+
+	/* Initialize usb phy */
+	ret = ti_usb_phy_uboot_init(&priv->phy_device);
+	if (ret)
+		return ret;
+
+	dwc3_omap_map_offset(omap);
+	dwc3_omap_set_utmi_mode(omap, DWC3_OMAP_UTMI_MODE_SW);
+
+	/* check the DMA Status */
+	reg = dwc3_omap_readl(omap->base, USBOTGSS_SYSCONFIG);
+	omap->dma_status = !!(reg & USBOTGSS_SYSCONFIG_DMADISABLE);
+
+	dwc3_omap_enable_irqs(omap);
+
+	dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND);
+
+	/* default to highest possible threshold */
+	dwc->lpm_nyet_threshold = 0xff;
+	/*
+	 * default to assert utmi_sleep_n and use maximum allowed HIRD
+	 * threshold value of 0b1100
+	 */
+	dwc->hird_threshold = 12;
+	/* default to -3.5dB de-emphasis */
+	dwc->tx_de_emphasis = 1;
+
+	dwc->needs_fifo_resize = false;
+	dwc->index = 0;
+
+	return dwc3_init(dwc);
+}
+
+static int dwc3_omap_peripheral_remove(struct udevice *dev)
+{
+	struct omap_dwc3_priv *priv = dev_get_priv(dev);
+	struct dwc3_omap *omap = &priv->omap;
+	struct dwc3 *dwc = &priv->dwc3;
+
+	dwc3_omap_disable_irqs(omap);
+	dwc3_remove(dwc);
+
+	return 0;
+}
+
+static int dwc3_omap_ofdata_to_platdata(struct udevice *dev)
+{
+	struct omap_dwc3_priv *priv = dev_get_priv(dev);
+	const void *fdt = gd->fdt_blob;
+	int node = dev->of_offset;
+	int ctrlmodnode;
+	int physnode;
+
+	priv->omap.base = map_physmem(fdtdec_get_addr(fdt,
+				dev->parent->of_offset, "reg"), 0,
+				MAP_NOCACHE);
+
+	priv->dwc3.regs = dev_map_physmem(dev, 0);
+	priv->dwc3.regs += DWC3_GLOBALS_REGS_START;
+
+	physnode = fdtdec_lookup_phandle(fdt, node, "phys");
+	ctrlmodnode = fdtdec_lookup_phandle(fdt, physnode, "ctrl-module");
+	priv->phy_device.usb2_phy_power =
+		map_physmem(fdtdec_get_addr(fdt, ctrlmodnode, "reg"),
+			    0, MAP_NOCACHE);
+	priv->phy_device.index = 0;
+
+	priv->dwc3.maximum_speed = usb_get_maximum_speed(node);
+	if (priv->dwc3.maximum_speed < 0) {
+		error("Invalid usb maximum speed\n");
+		return priv->dwc3.maximum_speed;
+	}
+
+	return 0;
+}
+
+static int dwc3_omap_peripheral_ofdata_to_platdata(struct udevice *dev)
+{
+	struct omap_dwc3_priv *priv = dev_get_priv(dev);
+	int ret;
+
+	ret = dwc3_omap_ofdata_to_platdata(dev);
+	if (ret) {
+		error("platform dt parse error\n");
+		return ret;
+	}
+
+	priv->dwc3.dr_mode = USB_DR_MODE_PERIPHERAL;
+
+	return 0;
+}
+
+U_BOOT_DRIVER(dwc3_omap_peripheral) = {
+	.name	= "dwc3-omap-peripheral",
+	.id	= UCLASS_USB_DEV_GENERIC,
+	.ofdata_to_platdata = dwc3_omap_peripheral_ofdata_to_platdata,
+	.probe = dwc3_omap_peripheral_probe,
+	.remove = dwc3_omap_peripheral_remove,
+	.platdata_auto_alloc_size = sizeof(struct usb_platdata),
+	.priv_auto_alloc_size = sizeof(struct omap_dwc3_priv),
+	.flags	= DM_FLAG_ALLOC_PRIV_DMA,
+};
+
 static int ti_dwc3_wrapper_bind(struct udevice *parent)
 {
 	const void *fdt = gd->fdt_blob;
 	int node;
+	int ret;
 
 	for (node = fdt_first_subnode(fdt, parent->of_offset); node > 0;
 	     node = fdt_next_subnode(fdt, node)) {
 		const char *name = fdt_get_name(fdt, node, NULL);
 		enum usb_dr_mode dr_mode;
+		struct udevice *dev;
 
 		if (strncmp(name, "usb@", 4))
 			continue;
@@ -490,6 +648,13 @@ static int ti_dwc3_wrapper_bind(struct udevice *parent)
 		case USB_DR_MODE_PERIPHERAL:
 		case USB_DR_MODE_OTG:
 			/* Bind MUSB device */
+			ret = device_bind_driver_to_node(parent,
+							 "dwc3-omap-peripheral",
+							 name, node, &dev);
+			if (ret) {
+				error("dwc3 - not able to bind usb device node\n");
+				return ret;
+			}
 			break;
 		case USB_DR_MODE_HOST:
 			/* Bind MUSB host */
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH 08/11] dwc3: Add support for USB device boot
  2017-05-23 11:55 [U-Boot] [PATCH 00/11] driver model bring-up of dwc3 usb peripheral Vignesh R
                   ` (6 preceding siblings ...)
  2017-05-23 11:55 ` [U-Boot] [PATCH 07/11] drivers: usb: dwc3: add ti dwc3 peripheral driver with driver model support Vignesh R
@ 2017-05-23 11:55 ` Vignesh R
  2017-05-31  3:50   ` Simon Glass
  2017-05-23 11:55 ` [U-Boot] [PATCH 09/11] am43xx: Add USB device boot support Vignesh R
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 23+ messages in thread
From: Vignesh R @ 2017-05-23 11:55 UTC (permalink / raw)
  To: u-boot

Add support to for USB device boot for dwc3 gadget, so that RNDIS can be
used in SPL to download next stage.
Provide a way to read MAC address for usb_ether device from board
function.

Signed-off-by: Vignesh R <vigneshr@ti.com>
---
 drivers/usb/gadget/ether.c        | 9 ++++++++-
 drivers/usb/gadget/gadget_chips.h | 2 ++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 4137d76c42af..aa219a50dae6 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -2383,6 +2383,7 @@ static int _usb_eth_init(struct ether_priv *priv)
 #ifdef CONFIG_USBNET_HOST_ADDR
 	strlcpy(host_addr, CONFIG_USBNET_HOST_ADDR, sizeof(host_addr));
 #endif
+
 	/* Check if the user overruled the MAC addresses */
 	if (getenv("usbnet_devaddr"))
 		strlcpy(dev_addr, getenv("usbnet_devaddr"),
@@ -2619,6 +2620,10 @@ int usb_eth_initialize(bd_t *bi)
 	return 0;
 }
 #else
+void __weak board_set_usbnet_devaddr(void)
+{
+}
+
 static int usb_eth_start(struct udevice *dev)
 {
 	struct ether_priv *priv = dev_get_priv(dev);
@@ -2683,6 +2688,8 @@ static int usb_eth_probe(struct udevice *dev)
 
 	priv->netdev = dev;
 	l_priv = priv;
+	/* Get MAC address for USB ETH interface */
+	board_set_usbnet_devaddr();
 
 	get_ether_addr(CONFIG_USBNET_DEVADDR, pdata->enetaddr);
 	eth_setenv_enetaddr("usbnet_devaddr", pdata->enetaddr);
@@ -2726,6 +2733,6 @@ U_BOOT_DRIVER(eth_usb) = {
 	.ops	= &usb_eth_ops,
 	.priv_auto_alloc_size = sizeof(struct ether_priv),
 	.platdata_auto_alloc_size = sizeof(struct eth_pdata),
-	.flags = DM_FLAG_ALLOC_PRIV_DMA,
+	.flags = DM_FLAG_ALLOC_PRIV_DMA | DM_FLAG_PRE_RELOC,
 };
 #endif /* CONFIG_DM_ETH */
diff --git a/drivers/usb/gadget/gadget_chips.h b/drivers/usb/gadget/gadget_chips.h
index 973cd971ad19..c09d30e0253c 100644
--- a/drivers/usb/gadget/gadget_chips.h
+++ b/drivers/usb/gadget/gadget_chips.h
@@ -231,5 +231,7 @@ static inline int usb_gadget_controller_number(struct usb_gadget *gadget)
 		return 0x21;
 	else if (gadget_is_fotg210(gadget))
 		return 0x22;
+	else if (gadget_is_dwc3(gadget))
+		return 0x23;
 	return -ENOENT;
 }
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH 09/11] am43xx: Add USB device boot support
  2017-05-23 11:55 [U-Boot] [PATCH 00/11] driver model bring-up of dwc3 usb peripheral Vignesh R
                   ` (7 preceding siblings ...)
  2017-05-23 11:55 ` [U-Boot] [PATCH 08/11] dwc3: Add support for USB device boot Vignesh R
@ 2017-05-23 11:55 ` Vignesh R
  2017-05-23 11:55 ` [U-Boot] [PATCH 10/11] configs: am43xx: Enable configs to support USB device boot Vignesh R
  2017-05-23 11:55 ` [U-Boot] [PATCH 11/11] ARM: am437x-gp-evm-u-boot.dtsi: Enable nodes for " Vignesh R
  10 siblings, 0 replies; 23+ messages in thread
From: Vignesh R @ 2017-05-23 11:55 UTC (permalink / raw)
  To: u-boot

Add function to populate MAC address for usb ether device to support
RNDIS in SPL. Also make arch_misc_init() available when
CONFIG_SPL_USBEHT_SUPPORT is defined so that usb_ether_init() is called
for am43xx as well.

Signed-off-by: Vignesh R <vigneshr@ti.com>
---
 arch/arm/mach-omap2/boot-common.c |  3 ++-
 board/ti/am43xx/board.c           | 20 ++++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/boot-common.c b/arch/arm/mach-omap2/boot-common.c
index 29c8f231917b..fc4c935477cf 100644
--- a/arch/arm/mach-omap2/boot-common.c
+++ b/arch/arm/mach-omap2/boot-common.c
@@ -194,7 +194,8 @@ void spl_board_init(void)
 #ifdef CONFIG_SPL_I2C_SUPPORT
 	i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE);
 #endif
-#if defined(CONFIG_AM33XX) && defined(CONFIG_SPL_MUSB_NEW_SUPPORT)
+#if (defined(CONFIG_AM33XX) && defined(CONFIG_SPL_MUSB_NEW_SUPPORT)) || \
+	defined(CONFIG_SPL_USBETH_SUPPORT)
 	arch_misc_init();
 #endif
 #if defined(CONFIG_HW_WATCHDOG)
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index f6b36949f756..da72d6e58448 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -813,6 +813,26 @@ int board_eth_init(bd_t *bis)
 }
 #endif
 
+#if defined(CONFIG_DM_ETH) && defined(CONFIG_SPL_USBETH_SUPPORT)
+void board_set_usbnet_devaddr(void)
+{
+	uint8_t mac_addr[6];
+	uint32_t mac_hi, mac_lo;
+
+	mac_lo = readl(&cdev->macid0l);
+	mac_hi = readl(&cdev->macid0h);
+	mac_addr[0] = mac_hi & 0xFF;
+	mac_addr[1] = (mac_hi & 0xFF00) >> 8;
+	mac_addr[2] = (mac_hi & 0xFF0000) >> 16;
+	mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
+	mac_addr[4] = mac_lo & 0xFF;
+	mac_addr[5] = (mac_lo & 0xFF00) >> 8;
+
+	if (is_valid_ethaddr(mac_addr))
+		eth_setenv_enetaddr("usbnet_devaddr", mac_addr);
+}
+#endif
+
 #ifdef CONFIG_SPL_LOAD_FIT
 int board_fit_config_name_match(const char *name)
 {
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH 10/11] configs: am43xx: Enable configs to support USB device boot
  2017-05-23 11:55 [U-Boot] [PATCH 00/11] driver model bring-up of dwc3 usb peripheral Vignesh R
                   ` (8 preceding siblings ...)
  2017-05-23 11:55 ` [U-Boot] [PATCH 09/11] am43xx: Add USB device boot support Vignesh R
@ 2017-05-23 11:55 ` Vignesh R
  2017-05-23 11:55 ` [U-Boot] [PATCH 11/11] ARM: am437x-gp-evm-u-boot.dtsi: Enable nodes for " Vignesh R
  10 siblings, 0 replies; 23+ messages in thread
From: Vignesh R @ 2017-05-23 11:55 UTC (permalink / raw)
  To: u-boot

Clean up include/configs/am43xx_evm.h and add configs to support USB
device boot for am43xx evm.

Signed-off-by: Vignesh R <vigneshr@ti.com>
---
 configs/am43xx_evm_defconfig | 13 ++++++++++++-
 include/configs/am43xx_evm.h | 27 ++++++++-------------------
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/configs/am43xx_evm_defconfig b/configs/am43xx_evm_defconfig
index 4d9ec8841f8a..fc0bbdc4df71 100644
--- a/configs/am43xx_evm_defconfig
+++ b/configs/am43xx_evm_defconfig
@@ -22,7 +22,7 @@ CONFIG_ISO_PARTITION=y
 CONFIG_OF_CONTROL=y
 CONFIG_OF_LIST="am437x-gp-evm am437x-sk-evm am43x-epos-evm am437x-idk-evm"
 CONFIG_DM=y
-# CONFIG_BLK is not set
+CONFIG_BLK=y
 CONFIG_DFU_MMC=y
 CONFIG_DFU_RAM=y
 CONFIG_DFU_SF=y
@@ -50,3 +50,14 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_G_DNL_MANUFACTURER="Texas Instruments"
 CONFIG_G_DNL_VENDOR_NUM=0x0403
 CONFIG_G_DNL_PRODUCT_NUM=0xbd00
+CONFIG_MISC=y
+CONFIG_DM_USB=y
+CONFIG_CMD_USB=y
+CONFIG_DM_ETH=y
+CONFIG_SPL_USBETH_SUPPORT=y
+CONFIG_SPL_USB_GADGET_SUPPORT=y
+CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
+CONFIG_SPL_USB_HOST_SUPPORT=y
+CONFIG_SPL_USB_SUPPORT=y
+CONFIG_SPL_NET_SUPPORT=y
+CONFIG_SPL_NET_VCI_STRING="AM43xx U-Boot SPL"
diff --git a/include/configs/am43xx_evm.h b/include/configs/am43xx_evm.h
index 25f63e831142..8a6725cf3b6d 100644
--- a/include/configs/am43xx_evm.h
+++ b/include/configs/am43xx_evm.h
@@ -90,20 +90,6 @@
 #define CONFIG_AM437X_USB2PHY2_HOST
 #endif
 
-#if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_USBETH_SUPPORT)
-#undef CONFIG_USB_DWC3_PHY_OMAP
-#undef CONFIG_USB_DWC3_OMAP
-#undef CONFIG_USB_DWC3
-#undef CONFIG_USB_DWC3_GADGET
-
-#undef CONFIG_USB_GADGET_DOWNLOAD
-#undef CONFIG_USB_GADGET_VBUS_DRAW
-#undef CONFIG_G_DNL_MANUFACTURER
-#undef CONFIG_G_DNL_VENDOR_NUM
-#undef CONFIG_G_DNL_PRODUCT_NUM
-#undef CONFIG_USB_GADGET_DUALSPEED
-#endif
-
 /*
  * Disable MMC DM for SPL build and can be re-enabled after adding
  * DM support in SPL
@@ -258,11 +244,6 @@
 #define CONFIG_PHYLIB
 #define PHY_ANEG_TIMEOUT	8000 /* PHY needs longer aneg time at 1G */
 
-#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_ETH_SUPPORT)
-#undef CONFIG_ENV_IS_IN_FAT
-#define CONFIG_ENV_IS_NOWHERE
-#endif
-
 #define CONFIG_SYS_RX_ETH_BUFFER	64
 
 /* NAND support */
@@ -347,4 +328,12 @@
 #define NANDBOOT
 #endif /* CONFIG_NAND */
 
+#define CONFIG_ARCH_MISC_INIT
+
+#ifdef CONFIG_SPL_USBETH_SUPPORT
+#define CONFIG_USB_ETHER
+#define CONFIG_USB_ETH_RNDIS
+#define CONFIG_USBNET_HOST_ADDR "de:ad:be:af:00:00"
+#endif
+
 #endif	/* __CONFIG_AM43XX_EVM_H */
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH 11/11] ARM: am437x-gp-evm-u-boot.dtsi: Enable nodes for USB device boot
  2017-05-23 11:55 [U-Boot] [PATCH 00/11] driver model bring-up of dwc3 usb peripheral Vignesh R
                   ` (9 preceding siblings ...)
  2017-05-23 11:55 ` [U-Boot] [PATCH 10/11] configs: am43xx: Enable configs to support USB device boot Vignesh R
@ 2017-05-23 11:55 ` Vignesh R
  2017-05-24  4:25   ` Lokesh Vutla
  10 siblings, 1 reply; 23+ messages in thread
From: Vignesh R @ 2017-05-23 11:55 UTC (permalink / raw)
  To: u-boot

Enable USB nodes required to support RNDIS boot in SPL.

Signed-off-by: Vignesh R <vigneshr@ti.com>
---
 arch/arm/dts/am437x-gp-evm-u-boot.dtsi | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/dts/am437x-gp-evm-u-boot.dtsi b/arch/arm/dts/am437x-gp-evm-u-boot.dtsi
index 885a9a92dbd3..a689cd68a593 100644
--- a/arch/arm/dts/am437x-gp-evm-u-boot.dtsi
+++ b/arch/arm/dts/am437x-gp-evm-u-boot.dtsi
@@ -36,3 +36,23 @@
 &phy_sel {
 	u-boot,dm-pre-reloc;
 };
+
+&am43xx_control_usb2phy1 {
+	u-boot,dm-pre-reloc;
+};
+
+&ocp2scp0 {
+	u-boot,dm-pre-reloc;
+
+	phy at 483a8000 {
+		u-boot,dm-pre-reloc;
+	};
+};
+
+&dwc3_1 {
+	u-boot,dm-pre-reloc;
+
+	usb at 48390000 {
+		u-boot,dm-pre-reloc;
+	};
+};
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH 11/11] ARM: am437x-gp-evm-u-boot.dtsi: Enable nodes for USB device boot
  2017-05-23 11:55 ` [U-Boot] [PATCH 11/11] ARM: am437x-gp-evm-u-boot.dtsi: Enable nodes for " Vignesh R
@ 2017-05-24  4:25   ` Lokesh Vutla
  0 siblings, 0 replies; 23+ messages in thread
From: Lokesh Vutla @ 2017-05-24  4:25 UTC (permalink / raw)
  To: u-boot



On Tuesday 23 May 2017 05:25 PM, Vignesh R wrote:
> Enable USB nodes required to support RNDIS boot in SPL.
> 
> Signed-off-by: Vignesh R <vigneshr@ti.com>
> ---
>  arch/arm/dts/am437x-gp-evm-u-boot.dtsi | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/arch/arm/dts/am437x-gp-evm-u-boot.dtsi b/arch/arm/dts/am437x-gp-evm-u-boot.dtsi
> index 885a9a92dbd3..a689cd68a593 100644
> --- a/arch/arm/dts/am437x-gp-evm-u-boot.dtsi
> +++ b/arch/arm/dts/am437x-gp-evm-u-boot.dtsi
> @@ -36,3 +36,23 @@
>  &phy_sel {
>  	u-boot,dm-pre-reloc;
>  };

Can you mark all the below node as "u-boot,dm-spl" instead of
u-boot,dm-pre-reloc?

Thanks and regards,
Lokesh

> +
> +&am43xx_control_usb2phy1 {
> +	u-boot,dm-pre-reloc;
> +};
> +
> +&ocp2scp0 {
> +	u-boot,dm-pre-reloc;
> +
> +	phy at 483a8000 {
> +		u-boot,dm-pre-reloc;
> +	};
> +};
> +
> +&dwc3_1 {
> +	u-boot,dm-pre-reloc;
> +
> +	usb at 48390000 {
> +		u-boot,dm-pre-reloc;
> +	};
> +};
> 

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH 01/11] drivers: usb: dwc3: remove devm_zalloc from linux_compact
  2017-05-23 11:55 ` [U-Boot] [PATCH 01/11] drivers: usb: dwc3: remove devm_zalloc from linux_compact Vignesh R
@ 2017-05-31  3:50   ` Simon Glass
  0 siblings, 0 replies; 23+ messages in thread
From: Simon Glass @ 2017-05-31  3:50 UTC (permalink / raw)
  To: u-boot

+Masahiro

On 23 May 2017 at 05:55, Vignesh R <vigneshr@ti.com> wrote:
> From: Mugunthan V N <mugunthanvnm@ti.com>
>
> devm_zalloc() is already defined in dm/device.h header, so
> devm_zalloc can be removed from linux_compact.h beader file.
>
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
> Signed-off-by: Vignesh R <vigneshr@ti.com>
> ---
>  drivers/usb/dwc3/core.c         | 7 +++++--
>  drivers/usb/dwc3/dwc3-omap.c    | 3 ++-
>  drivers/usb/dwc3/linux-compat.h | 5 -----
>  drivers/usb/dwc3/ti_usb_phy.c   | 1 +
>  4 files changed, 8 insertions(+), 8 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH 02/11] drivers: usb: dwc3-omap: move usb_gadget_handle_interrupts from board files to drivers
  2017-05-23 11:55 ` [U-Boot] [PATCH 02/11] drivers: usb: dwc3-omap: move usb_gadget_handle_interrupts from board files to drivers Vignesh R
@ 2017-05-31  3:50   ` Simon Glass
  0 siblings, 0 replies; 23+ messages in thread
From: Simon Glass @ 2017-05-31  3:50 UTC (permalink / raw)
  To: u-boot

On 23 May 2017 at 05:55, Vignesh R <vigneshr@ti.com> wrote:
> From: Mugunthan V N <mugunthanvnm@ti.com>
>
> In board files of am437x, dra7xx, omap5 and am5xx,
> usb_gadget_handle_interrupts() is just a place holder to handle
> dwc3 interrupts, nothing related to board is handled here, so
> move usb_gadget_handle_interrupts() from board files to
> dwc3-omap.c to avoid code duplication based on boards.
>
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
> Signed-off-by: Vignesh R <vigneshr@ti.com>
> ---
>  board/ti/am43xx/board.c      | 11 -----------
>  board/ti/dra7xx/evm.c        | 11 -----------
>  board/ti/omap5_uevm/evm.c    | 11 -----------
>  drivers/usb/dwc3/dwc3-omap.c | 12 ++++++++++++
>  4 files changed, 12 insertions(+), 33 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH 04/11] omap5/am57xx/dra7xx: board: do not register usb devices when CONFIG_DM_USB is defined
  2017-05-23 11:55 ` [U-Boot] [PATCH 04/11] omap5/am57xx/dra7xx: " Vignesh R
@ 2017-05-31  3:50   ` Simon Glass
  0 siblings, 0 replies; 23+ messages in thread
From: Simon Glass @ 2017-05-31  3:50 UTC (permalink / raw)
  To: u-boot

On 23 May 2017 at 05:55, Vignesh R <vigneshr@ti.com> wrote:
> From: Mugunthan V N <mugunthanvnm@ti.com>
>
> Do not register usb devices when CONFIG_DM_USB is define.
>
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
> Signed-off-by: Vignesh R <vigneshr@ti.com>
> ---
>  board/ti/am57xx/board.c   | 2 +-
>  board/ti/dra7xx/evm.c     | 2 +-
>  board/ti/omap5_uevm/evm.c | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH 05/11] drivers: usb: dwc3: add ti dwc3 misc driver for wrapper
  2017-05-23 11:55 ` [U-Boot] [PATCH 05/11] drivers: usb: dwc3: add ti dwc3 misc driver for wrapper Vignesh R
@ 2017-05-31  3:50   ` Simon Glass
  2017-05-31  5:06     ` Vignesh R
  2017-05-31  5:06     ` Vignesh R
  0 siblings, 2 replies; 23+ messages in thread
From: Simon Glass @ 2017-05-31  3:50 UTC (permalink / raw)
  To: u-boot

On 23 May 2017 at 05:55, Vignesh R <vigneshr@ti.com> wrote:
> From: Mugunthan V N <mugunthanvnm@ti.com>
>
> Add a misc driver for DWC3 wrapper, so that based on dr_mode the
> USB devices can bind to USB host or USB device drivers.
>
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
> Signed-off-by: Vignesh R <vigneshr@ti.com>
> ---
>  board/ti/am57xx/board.c      | 11 ----------
>  drivers/usb/dwc3/core.h      |  4 ++++
>  drivers/usb/dwc3/dwc3-omap.c | 52 ++++++++++++++++++++++++++++++++++++++++++++
>  drivers/usb/dwc3/gadget.c    |  2 +-
>  4 files changed, 57 insertions(+), 12 deletions(-)

Can you explain why this is a misc driver, and how it will be instantiated?

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH 06/11] drivers: usb: common: add support to get maximum speed from dt
  2017-05-23 11:55 ` [U-Boot] [PATCH 06/11] drivers: usb: common: add support to get maximum speed from dt Vignesh R
@ 2017-05-31  3:50   ` Simon Glass
  0 siblings, 0 replies; 23+ messages in thread
From: Simon Glass @ 2017-05-31  3:50 UTC (permalink / raw)
  To: u-boot

On 23 May 2017 at 05:55, Vignesh R <vigneshr@ti.com> wrote:
> From: Mugunthan V N <mugunthanvnm@ti.com>
>
> Add support to get maximum speed from dt so that usb drivers
> makes use of it for DT parsing.
>
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
> Signed-off-by: Vignesh R <vigneshr@ti.com>
> ---
>  drivers/usb/common/common.c | 29 +++++++++++++++++++++++++++++
>  include/linux/usb/otg.h     |  9 +++++++++
>  scripts/Makefile.spl        |  1 +
>  3 files changed, 39 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH 08/11] dwc3: Add support for USB device boot
  2017-05-23 11:55 ` [U-Boot] [PATCH 08/11] dwc3: Add support for USB device boot Vignesh R
@ 2017-05-31  3:50   ` Simon Glass
  2017-05-31  6:03     ` Vignesh R
  0 siblings, 1 reply; 23+ messages in thread
From: Simon Glass @ 2017-05-31  3:50 UTC (permalink / raw)
  To: u-boot

On 23 May 2017 at 05:55, Vignesh R <vigneshr@ti.com> wrote:
> Add support to for USB device boot for dwc3 gadget, so that RNDIS can be
> used in SPL to download next stage.
> Provide a way to read MAC address for usb_ether device from board
> function.
>
> Signed-off-by: Vignesh R <vigneshr@ti.com>
> ---
>  drivers/usb/gadget/ether.c        | 9 ++++++++-
>  drivers/usb/gadget/gadget_chips.h | 2 ++
>  2 files changed, 10 insertions(+), 1 deletion(-)

It looks like there are a few changes in here and it should be split
into 2-3 patches.

Regards,
Simon

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH 03/11] am437x: board: do not register usb devices when CONFIG_DM_USB is defined
  2017-05-23 11:55 ` [U-Boot] [PATCH 03/11] am437x: board: do not register usb devices when CONFIG_DM_USB is defined Vignesh R
@ 2017-05-31  3:50   ` Simon Glass
  0 siblings, 0 replies; 23+ messages in thread
From: Simon Glass @ 2017-05-31  3:50 UTC (permalink / raw)
  To: u-boot

On 23 May 2017 at 05:55, Vignesh R <vigneshr@ti.com> wrote:
> From: Mugunthan V N <mugunthanvnm@ti.com>
>
> Do not register usb devices when CONFIG_DM_USB is define.

I suggest s/define/enabled/

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH 05/11] drivers: usb: dwc3: add ti dwc3 misc driver for wrapper
  2017-05-31  3:50   ` Simon Glass
@ 2017-05-31  5:06     ` Vignesh R
  2017-05-31  5:06     ` Vignesh R
  1 sibling, 0 replies; 23+ messages in thread
From: Vignesh R @ 2017-05-31  5:06 UTC (permalink / raw)
  To: u-boot

Hi,

On Wednesday 31 May 2017 09:20 AM, Simon Glass wrote:
> On 23 May 2017 at 05:55, Vignesh R <vigneshr@ti.com> wrote:
>> From: Mugunthan V N <mugunthanvnm@ti.com>
>>
>> Add a misc driver for DWC3 wrapper, so that based on dr_mode the
>> USB devices can bind to USB host or USB device drivers.
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>> Signed-off-by: Vignesh R <vigneshr@ti.com>
>> ---
>>  board/ti/am57xx/board.c      | 11 ----------
>>  drivers/usb/dwc3/core.h      |  4 ++++
>>  drivers/usb/dwc3/dwc3-omap.c | 52 ++++++++++++++++++++++++++++++++++++++++++++
>>  drivers/usb/dwc3/gadget.c    |  2 +-
>>  4 files changed, 57 insertions(+), 12 deletions(-)
> 
> Can you explain why this is a misc driver, and how it will be instantiated?

Based on dr_mode property, the device node needs to bind to either
"host" driver or "peripheral" driver. Therefore, this wrapper is written
for DWC3, which on bind will read dr_mode property and appropriately
associate USB DT node with DWC3 peripheral driver or host driver.

This is similar to what exists today for MUSB[1] and is instantiated by
arch_misc_init() function for am33xx and am43xx

I got these patch from U-Boot list which the author had submitted
previosuly and got Reviewed-by and did not look deep into it. But looks
like this patch really needs be read along with patch 7/10. I will
re-split and reorder this patch in the next version.


[1]https://www.mail-archive.com/u-boot at lists.denx.de/msg231076.html

-- 
Regards
Vignesh

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH 05/11] drivers: usb: dwc3: add ti dwc3 misc driver for wrapper
  2017-05-31  3:50   ` Simon Glass
  2017-05-31  5:06     ` Vignesh R
@ 2017-05-31  5:06     ` Vignesh R
  1 sibling, 0 replies; 23+ messages in thread
From: Vignesh R @ 2017-05-31  5:06 UTC (permalink / raw)
  To: u-boot

Hi,

On Wednesday 31 May 2017 09:20 AM, Simon Glass wrote:
> On 23 May 2017 at 05:55, Vignesh R <vigneshr@ti.com> wrote:
>> From: Mugunthan V N <mugunthanvnm@ti.com>
>>
>> Add a misc driver for DWC3 wrapper, so that based on dr_mode the
>> USB devices can bind to USB host or USB device drivers.
>>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
>> Signed-off-by: Vignesh R <vigneshr@ti.com>
>> ---
>>  board/ti/am57xx/board.c      | 11 ----------
>>  drivers/usb/dwc3/core.h      |  4 ++++
>>  drivers/usb/dwc3/dwc3-omap.c | 52 ++++++++++++++++++++++++++++++++++++++++++++
>>  drivers/usb/dwc3/gadget.c    |  2 +-
>>  4 files changed, 57 insertions(+), 12 deletions(-)
> 
> Can you explain why this is a misc driver, and how it will be instantiated?

Based on dr_mode property, the device node needs to bind to either
"host" driver or "peripheral" driver. Therefore, this wrapper is written
for DWC3, which on bind will read dr_mode property and appropriately
associate USB DT node with DWC3 peripheral driver or host driver.

This is similar to what exists today for MUSB[1] and is instantiated by
arch_misc_init() function for am33xx and am43xx

I got these patch from U-Boot list which the author had submitted
previously and got Reviewed-by and did not look deep into it. But looks
like this patch really needs be read along with patch 7/10. I will
re-split and reorder this patch in the next version.


[1]https://www.mail-archive.com/u-boot at lists.denx.de/msg231076.html

-- 
Regards
Vignesh

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [U-Boot] [PATCH 08/11] dwc3: Add support for USB device boot
  2017-05-31  3:50   ` Simon Glass
@ 2017-05-31  6:03     ` Vignesh R
  0 siblings, 0 replies; 23+ messages in thread
From: Vignesh R @ 2017-05-31  6:03 UTC (permalink / raw)
  To: u-boot



On Wednesday 31 May 2017 09:20 AM, Simon Glass wrote:
> On 23 May 2017 at 05:55, Vignesh R <vigneshr@ti.com> wrote:
>> Add support to for USB device boot for dwc3 gadget, so that RNDIS can be
>> used in SPL to download next stage.
>> Provide a way to read MAC address for usb_ether device from board
>> function.
>>
>> Signed-off-by: Vignesh R <vigneshr@ti.com>
>> ---
>>  drivers/usb/gadget/ether.c        | 9 ++++++++-
>>  drivers/usb/gadget/gadget_chips.h | 2 ++
>>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> It looks like there are a few changes in here and it should be split
> into 2-3 patches.
> 

Ok, will do.


-- 
Regards
Vignesh

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2017-05-31  6:03 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-23 11:55 [U-Boot] [PATCH 00/11] driver model bring-up of dwc3 usb peripheral Vignesh R
2017-05-23 11:55 ` [U-Boot] [PATCH 01/11] drivers: usb: dwc3: remove devm_zalloc from linux_compact Vignesh R
2017-05-31  3:50   ` Simon Glass
2017-05-23 11:55 ` [U-Boot] [PATCH 02/11] drivers: usb: dwc3-omap: move usb_gadget_handle_interrupts from board files to drivers Vignesh R
2017-05-31  3:50   ` Simon Glass
2017-05-23 11:55 ` [U-Boot] [PATCH 03/11] am437x: board: do not register usb devices when CONFIG_DM_USB is defined Vignesh R
2017-05-31  3:50   ` Simon Glass
2017-05-23 11:55 ` [U-Boot] [PATCH 04/11] omap5/am57xx/dra7xx: " Vignesh R
2017-05-31  3:50   ` Simon Glass
2017-05-23 11:55 ` [U-Boot] [PATCH 05/11] drivers: usb: dwc3: add ti dwc3 misc driver for wrapper Vignesh R
2017-05-31  3:50   ` Simon Glass
2017-05-31  5:06     ` Vignesh R
2017-05-31  5:06     ` Vignesh R
2017-05-23 11:55 ` [U-Boot] [PATCH 06/11] drivers: usb: common: add support to get maximum speed from dt Vignesh R
2017-05-31  3:50   ` Simon Glass
2017-05-23 11:55 ` [U-Boot] [PATCH 07/11] drivers: usb: dwc3: add ti dwc3 peripheral driver with driver model support Vignesh R
2017-05-23 11:55 ` [U-Boot] [PATCH 08/11] dwc3: Add support for USB device boot Vignesh R
2017-05-31  3:50   ` Simon Glass
2017-05-31  6:03     ` Vignesh R
2017-05-23 11:55 ` [U-Boot] [PATCH 09/11] am43xx: Add USB device boot support Vignesh R
2017-05-23 11:55 ` [U-Boot] [PATCH 10/11] configs: am43xx: Enable configs to support USB device boot Vignesh R
2017-05-23 11:55 ` [U-Boot] [PATCH 11/11] ARM: am437x-gp-evm-u-boot.dtsi: Enable nodes for " Vignesh R
2017-05-24  4:25   ` Lokesh Vutla

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.