[U-Boot] [PATCH 00/10] driver model bring-up of dwc3 usb peripheral

This patch series enables dwc3 usb driver to adopt driver model. This has been tested on AM437x evm sk (logs [1]) by loading kernel through usb ether
Also pushed a branch for testing [2]
[1] - http://pastebin.ubuntu.com/15391169/ [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git dm-dwc3
Kishon Vijay Abraham I (1): configs: am43xx: Add am43xx_evm_usbspl_defconfig
Mugunthan V N (8): 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 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 defconfig: am437x_sk_evm: enable usb driver model
Tom Rini (1): am43xx: Add USB device boot support to SPL
board/ti/am43xx/MAINTAINERS | 1 + board/ti/am43xx/board.c | 52 +++++--- board/ti/am57xx/board.c | 11 -- board/ti/dra7xx/evm.c | 13 +- configs/am437x_sk_evm_defconfig | 4 + configs/am43xx_evm_usbspl_defconfig | 9 ++ drivers/Makefile | 2 + drivers/usb/common/common.c | 29 +++++ drivers/usb/dwc3/core.c | 64 +++++++++- drivers/usb/dwc3/core.h | 6 + drivers/usb/dwc3/dwc3-omap.c | 230 +++++++++++++++++++++++++++++++++++- drivers/usb/dwc3/gadget.c | 2 +- drivers/usb/dwc3/linux-compat.h | 5 - drivers/usb/dwc3/ti_usb_phy.c | 1 + drivers/usb/gadget/gadget_chips.h | 2 + include/configs/am43xx_evm.h | 13 ++ include/linux/usb/otg.h | 9 ++ 17 files changed, 406 insertions(+), 47 deletions(-) create mode 100644 configs/am43xx_evm_usbspl_defconfig

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 --- drivers/usb/dwc3/core.c | 7 +++++-- drivers/usb/dwc3/dwc3-omap.c | 2 +- drivers/usb/dwc3/linux-compat.h | 5 ----- drivers/usb/dwc3/ti_usb_phy.c | 1 + 4 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 85cc96a..c599d0b 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);
@@ -622,7 +624,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 3dcc2f4..afbd845 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c @@ -377,7 +377,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 9e944a3..f95d615 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 4159e5a..3cc415d 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"

On Tue, Mar 15, 2016 at 05:44:10PM +0530, Mugunthan V N wrote:
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
Reviewed-by: Tom Rini trini@konsulko.com

Hi Mugunthan,
On 15 March 2016 at 07:59, Tom Rini trini@konsulko.com wrote:
On Tue, Mar 15, 2016 at 05:44:10PM +0530, Mugunthan V N wrote:
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
Reviewed-by: Tom Rini trini@konsulko.com
-- Tom
Unfortunately I still cannot apply this as there are build errors. Can you please take a look and resend the entire series (along with the lonely patch) rebased to u-boot-dm/master?
09: drivers: usb: dwc3: remove devm_zalloc from linux_compact arm: + omap5_uevm + omap = devm_kzalloc((struct udevice *)dev, sizeof(*omap), GFP_KERNEL); + ^ + ^ +drivers/usb/dwc3/built-in.o: In function `dwc3_omap_uboot_init': +build/../drivers/usb/dwc3/dwc3-omap.c:380: undefined reference to `devm_kzalloc' +arm-unknown-linux-gnueabi-ld.bfd: BFD (GNU Binutils) 2.24 assertion fail /home/tony/buildall/src/binutils/bfd/elf32-arm.c:7696 +arm-unknown-linux-gnueabi-ld.bfd: error: required section '.rel.plt' not found in the linker script +arm-unknown-linux-gnueabi-ld.bfd: final link failed: Invalid operation +make[1]: *** [u-boot] Error 1 +make: *** [sub-make] Error 2 w+../drivers/usb/dwc3/dwc3-omap.c: In function 'dwc3_omap_uboot_init': w+../drivers/usb/dwc3/dwc3-omap.c:380:2: warning: implicit declaration of function 'devm_kzalloc' [-Wimplicit-function-declaration] w+../drivers/usb/dwc3/dwc3-omap.c:380:7: warning: assignment makes pointer from integer without a cast 10: drivers: usb: dwc3-omap: move usb_gadget_handle_interrupts from board files to drivers -build/../drivers/usb/dwc3/dwc3-omap.c:380: undefined reference to `devm_kzalloc' +drivers/usb/dwc3/built-in.o: In function `usb_gadget_handle_interrupts': +:(.text.usb_gadget_handle_interrupts+0x0): multiple definition of `usb_gadget_handle_interrupts' +board/ti/omap5_uevm/built-in.o:build/../board/ti/omap5_uevm/evm.c:122: first defined here +:(.text.dwc3_omap_uboot_init+0xa): undefined reference to `devm_kzalloc' w-../drivers/usb/dwc3/dwc3-omap.c:380:2: warning: implicit declaration of function 'devm_kzalloc' [-Wimplicit-function-declaration] w-../drivers/usb/dwc3/dwc3-omap.c:380:7: warning: assignment makes pointer from integer without a cast w+../drivers/usb/dwc3/dwc3-omap.c:381:2: warning: implicit declaration of function 'devm_kzalloc' [-Wimplicit-function-declaration] w+../drivers/usb/dwc3/dwc3-omap.c:381:7: warning: assignment makes pointer from integer without a cast 11: am437x: board: do not register usb devices when CONFIG_DM_USB is defined 12: dra7xx: board: do not register usb devices when CONFIG_DM_USB is defined 13: drivers: usb: dwc3: add ti dwc3 misc driver for wrapper - omap = devm_kzalloc((struct udevice *)dev, sizeof(*omap), GFP_KERNEL); - ^ - ^ -drivers/usb/dwc3/built-in.o: In function `dwc3_omap_uboot_init': -:(.text.dwc3_omap_uboot_init+0xa): undefined reference to `devm_kzalloc' -arm-unknown-linux-gnueabi-ld.bfd: BFD (GNU Binutils) 2.24 assertion fail /home/tony/buildall/src/binutils/bfd/elf32-arm.c:7696 -arm-unknown-linux-gnueabi-ld.bfd: error: required section '.rel.plt' not found in the linker script -arm-unknown-linux-gnueabi-ld.bfd: final link failed: Invalid operation w-../drivers/usb/dwc3/dwc3-omap.c: In function 'dwc3_omap_uboot_init': w-../drivers/usb/dwc3/dwc3-omap.c:381:2: warning: implicit declaration of function 'devm_kzalloc' [-Wimplicit-function-declaration] w-../drivers/usb/dwc3/dwc3-omap.c:381:7: warning: assignment makes pointer from integer without a cast 14: drivers: usb: common: add support to get maximum speed from dt 15: drivers: usb: dwc3: add ti dwc3 peripheral driver with driver model support arm: + odroid-xu3 +board/samsung/common/built-in.o: In function `board_usb_cleanup': +build/../board/samsung/common/board.c:382: undefined reference to `dwc3_uboot_exit' +board/samsung/common/built-in.o: In function `usb_gadget_handle_interrupts': +build/../board/samsung/common/exynos5-dt.c:318: undefined reference to `dwc3_uboot_handle_interrupt' +board/samsung/common/built-in.o: In function `board_usb_init': +build/../board/samsung/common/exynos5-dt.c:335: undefined reference to `dwc3_uboot_init' +arm-unknown-linux-gnueabi-ld.bfd: BFD (GNU Binutils) 2.24 assertion fail /home/tony/buildall/src/binutils/bfd/elf32-arm.c:7696 +arm-unknown-linux-gnueabi-ld.bfd: error: required section '.rel.plt' not found in the linker script +arm-unknown-linux-gnueabi-ld.bfd: final link failed: Invalid operation 16: am43xx: Add USB device boot support to SPL
Regards, Simon

On Friday 15 April 2016 07:43 PM, Simon Glass wrote:
Hi Mugunthan,
On 15 March 2016 at 07:59, Tom Rini trini@konsulko.com wrote:
On Tue, Mar 15, 2016 at 05:44:10PM +0530, Mugunthan V N wrote:
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
Reviewed-by: Tom Rini trini@konsulko.com
-- Tom
Unfortunately I still cannot apply this as there are build errors. Can you please take a look and resend the entire series (along with the lonely patch) rebased to u-boot-dm/master?
09: drivers: usb: dwc3: remove devm_zalloc from linux_compact arm: + omap5_uevm
- omap = devm_kzalloc((struct udevice *)dev, sizeof(*omap), GFP_KERNEL);
- ^
^
+drivers/usb/dwc3/built-in.o: In function `dwc3_omap_uboot_init': +build/../drivers/usb/dwc3/dwc3-omap.c:380: undefined reference to `devm_kzalloc'
I didn't get this error when I built, is this error with incremental build?
I tried this command "./tools/buildman/buildman -c 7 -v -C -j 32 arm" but I am not seeing buildman does a test build for each commit, am I missing something?
+arm-unknown-linux-gnueabi-ld.bfd: BFD (GNU Binutils) 2.24 assertion fail /home/tony/buildall/src/binutils/bfd/elf32-arm.c:7696 +arm-unknown-linux-gnueabi-ld.bfd: error: required section '.rel.plt' not found in the linker script +arm-unknown-linux-gnueabi-ld.bfd: final link failed: Invalid operation +make[1]: *** [u-boot] Error 1 +make: *** [sub-make] Error 2 w+../drivers/usb/dwc3/dwc3-omap.c: In function 'dwc3_omap_uboot_init': w+../drivers/usb/dwc3/dwc3-omap.c:380:2: warning: implicit declaration of function 'devm_kzalloc' [-Wimplicit-function-declaration] w+../drivers/usb/dwc3/dwc3-omap.c:380:7: warning: assignment makes pointer from integer without a cast 10: drivers: usb: dwc3-omap: move usb_gadget_handle_interrupts from board files to drivers -build/../drivers/usb/dwc3/dwc3-omap.c:380: undefined reference to `devm_kzalloc' +drivers/usb/dwc3/built-in.o: In function `usb_gadget_handle_interrupts': +:(.text.usb_gadget_handle_interrupts+0x0): multiple definition of `usb_gadget_handle_interrupts' +board/ti/omap5_uevm/built-in.o:build/../board/ti/omap5_uevm/evm.c:122: first defined here +:(.text.dwc3_omap_uboot_init+0xa): undefined reference to `devm_kzalloc' w-../drivers/usb/dwc3/dwc3-omap.c:380:2: warning: implicit declaration of function 'devm_kzalloc' [-Wimplicit-function-declaration] w-../drivers/usb/dwc3/dwc3-omap.c:380:7: warning: assignment makes pointer from integer without a cast w+../drivers/usb/dwc3/dwc3-omap.c:381:2: warning: implicit declaration of function 'devm_kzalloc' [-Wimplicit-function-declaration] w+../drivers/usb/dwc3/dwc3-omap.c:381:7: warning: assignment makes pointer from integer without a cast 11: am437x: board: do not register usb devices when CONFIG_DM_USB is defined 12: dra7xx: board: do not register usb devices when CONFIG_DM_USB is defined 13: drivers: usb: dwc3: add ti dwc3 misc driver for wrapper
- omap = devm_kzalloc((struct udevice *)dev, sizeof(*omap), GFP_KERNEL);
- ^
^
-drivers/usb/dwc3/built-in.o: In function `dwc3_omap_uboot_init': -:(.text.dwc3_omap_uboot_init+0xa): undefined reference to `devm_kzalloc' -arm-unknown-linux-gnueabi-ld.bfd: BFD (GNU Binutils) 2.24 assertion fail /home/tony/buildall/src/binutils/bfd/elf32-arm.c:7696 -arm-unknown-linux-gnueabi-ld.bfd: error: required section '.rel.plt' not found in the linker script -arm-unknown-linux-gnueabi-ld.bfd: final link failed: Invalid operation w-../drivers/usb/dwc3/dwc3-omap.c: In function 'dwc3_omap_uboot_init': w-../drivers/usb/dwc3/dwc3-omap.c:381:2: warning: implicit declaration of function 'devm_kzalloc' [-Wimplicit-function-declaration] w-../drivers/usb/dwc3/dwc3-omap.c:381:7: warning: assignment makes pointer from integer without a cast 14: drivers: usb: common: add support to get maximum speed from dt 15: drivers: usb: dwc3: add ti dwc3 peripheral driver with driver model support arm: + odroid-xu3 +board/samsung/common/built-in.o: In function `board_usb_cleanup': +build/../board/samsung/common/board.c:382: undefined reference to `dwc3_uboot_exit' +board/samsung/common/built-in.o: In function `usb_gadget_handle_interrupts': +build/../board/samsung/common/exynos5-dt.c:318: undefined reference to `dwc3_uboot_handle_interrupt' +board/samsung/common/built-in.o: In function `board_usb_init': +build/../board/samsung/common/exynos5-dt.c:335: undefined reference to `dwc3_uboot_init' +arm-unknown-linux-gnueabi-ld.bfd: BFD (GNU Binutils) 2.24 assertion fail /home/tony/buildall/src/binutils/bfd/elf32-arm.c:7696 +arm-unknown-linux-gnueabi-ld.bfd: error: required section '.rel.plt' not found in the linker script +arm-unknown-linux-gnueabi-ld.bfd: final link failed: Invalid operation 16: am43xx: Add USB device boot support to SPL
Oops, I forgot to run buildman test before submitting, will send v2 ASAP.
Regards Mugunthan V N

Hi Mugunthan,
On 18 April 2016 at 00:36, Mugunthan V N mugunthanvnm@ti.com wrote:
On Friday 15 April 2016 07:43 PM, Simon Glass wrote:
Hi Mugunthan,
On 15 March 2016 at 07:59, Tom Rini trini@konsulko.com wrote:
On Tue, Mar 15, 2016 at 05:44:10PM +0530, Mugunthan V N wrote:
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
Reviewed-by: Tom Rini trini@konsulko.com
-- Tom
Unfortunately I still cannot apply this as there are build errors. Can you please take a look and resend the entire series (along with the lonely patch) rebased to u-boot-dm/master?
09: drivers: usb: dwc3: remove devm_zalloc from linux_compact arm: + omap5_uevm
- omap = devm_kzalloc((struct udevice *)dev, sizeof(*omap), GFP_KERNEL);
- ^
^
+drivers/usb/dwc3/built-in.o: In function `dwc3_omap_uboot_init': +build/../drivers/usb/dwc3/dwc3-omap.c:380: undefined reference to `devm_kzalloc'
I didn't get this error when I built, is this error with incremental build?
Yes, although it doesn't matter, since buildman will automatically reconfigure and retry (non-incrementally) if it gets a failure.
I tried this command "./tools/buildman/buildman -c 7 -v -C -j 32 arm" but I am not seeing buildman does a test build for each commit, am I missing something?
+arm-unknown-linux-gnueabi-ld.bfd: BFD (GNU Binutils) 2.24 assertion fail /home/tony/buildall/src/binutils/bfd/elf32-arm.c:7696 +arm-unknown-linux-gnueabi-ld.bfd: error: required section '.rel.plt' not found in the linker script +arm-unknown-linux-gnueabi-ld.bfd: final link failed: Invalid operation +make[1]: *** [u-boot] Error 1 +make: *** [sub-make] Error 2 w+../drivers/usb/dwc3/dwc3-omap.c: In function 'dwc3_omap_uboot_init': w+../drivers/usb/dwc3/dwc3-omap.c:380:2: warning: implicit declaration of function 'devm_kzalloc' [-Wimplicit-function-declaration] w+../drivers/usb/dwc3/dwc3-omap.c:380:7: warning: assignment makes pointer from integer without a cast 10: drivers: usb: dwc3-omap: move usb_gadget_handle_interrupts from board files to drivers -build/../drivers/usb/dwc3/dwc3-omap.c:380: undefined reference to `devm_kzalloc' +drivers/usb/dwc3/built-in.o: In function `usb_gadget_handle_interrupts': +:(.text.usb_gadget_handle_interrupts+0x0): multiple definition of `usb_gadget_handle_interrupts' +board/ti/omap5_uevm/built-in.o:build/../board/ti/omap5_uevm/evm.c:122: first defined here +:(.text.dwc3_omap_uboot_init+0xa): undefined reference to `devm_kzalloc' w-../drivers/usb/dwc3/dwc3-omap.c:380:2: warning: implicit declaration of function 'devm_kzalloc' [-Wimplicit-function-declaration] w-../drivers/usb/dwc3/dwc3-omap.c:380:7: warning: assignment makes pointer from integer without a cast w+../drivers/usb/dwc3/dwc3-omap.c:381:2: warning: implicit declaration of function 'devm_kzalloc' [-Wimplicit-function-declaration] w+../drivers/usb/dwc3/dwc3-omap.c:381:7: warning: assignment makes pointer from integer without a cast 11: am437x: board: do not register usb devices when CONFIG_DM_USB is defined 12: dra7xx: board: do not register usb devices when CONFIG_DM_USB is defined 13: drivers: usb: dwc3: add ti dwc3 misc driver for wrapper
- omap = devm_kzalloc((struct udevice *)dev, sizeof(*omap), GFP_KERNEL);
- ^
^
-drivers/usb/dwc3/built-in.o: In function `dwc3_omap_uboot_init': -:(.text.dwc3_omap_uboot_init+0xa): undefined reference to `devm_kzalloc' -arm-unknown-linux-gnueabi-ld.bfd: BFD (GNU Binutils) 2.24 assertion fail /home/tony/buildall/src/binutils/bfd/elf32-arm.c:7696 -arm-unknown-linux-gnueabi-ld.bfd: error: required section '.rel.plt' not found in the linker script -arm-unknown-linux-gnueabi-ld.bfd: final link failed: Invalid operation w-../drivers/usb/dwc3/dwc3-omap.c: In function 'dwc3_omap_uboot_init': w-../drivers/usb/dwc3/dwc3-omap.c:381:2: warning: implicit declaration of function 'devm_kzalloc' [-Wimplicit-function-declaration] w-../drivers/usb/dwc3/dwc3-omap.c:381:7: warning: assignment makes pointer from integer without a cast 14: drivers: usb: common: add support to get maximum speed from dt 15: drivers: usb: dwc3: add ti dwc3 peripheral driver with driver model support arm: + odroid-xu3 +board/samsung/common/built-in.o: In function `board_usb_cleanup': +build/../board/samsung/common/board.c:382: undefined reference to `dwc3_uboot_exit' +board/samsung/common/built-in.o: In function `usb_gadget_handle_interrupts': +build/../board/samsung/common/exynos5-dt.c:318: undefined reference to `dwc3_uboot_handle_interrupt' +board/samsung/common/built-in.o: In function `board_usb_init': +build/../board/samsung/common/exynos5-dt.c:335: undefined reference to `dwc3_uboot_init' +arm-unknown-linux-gnueabi-ld.bfd: BFD (GNU Binutils) 2.24 assertion fail /home/tony/buildall/src/binutils/bfd/elf32-arm.c:7696 +arm-unknown-linux-gnueabi-ld.bfd: error: required section '.rel.plt' not found in the linker script +arm-unknown-linux-gnueabi-ld.bfd: final link failed: Invalid operation 16: am43xx: Add USB device boot support to SPL
Oops, I forgot to run buildman test before submitting, will send v2 ASAP.
OK thanks. Please do include all patches in one series, rebased to mainline.
Regards, Simon

In board files of am437x, dra7xx 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 --- board/ti/am43xx/board.c | 11 ----------- board/ti/am57xx/board.c | 11 ----------- board/ti/dra7xx/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 770726c..16bbbd1 100644 --- a/board/ti/am43xx/board.c +++ b/board/ti/am43xx/board.c @@ -764,17 +764,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
#ifdef CONFIG_DRIVER_TI_CPSW diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c index 042f9ab..0e9664a 100644 --- a/board/ti/am57xx/board.c +++ b/board/ti/am57xx/board.c @@ -411,17 +411,6 @@ int 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
#ifdef CONFIG_DRIVER_TI_CPSW diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c index eebec88..50a9b72 100644 --- a/board/ti/dra7xx/evm.c +++ b/board/ti/dra7xx/evm.c @@ -209,17 +209,6 @@ int 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/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index afbd845..31d15f5 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c @@ -23,6 +23,7 @@
#include <linux/usb/otg.h> #include <linux/compat.h> +#include <dwc3-uboot.h>
#include "linux-compat.h"
@@ -445,6 +446,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");

On Tue, Mar 15, 2016 at 05:44:11PM +0530, Mugunthan V N wrote:
In board files of am437x, dra7xx 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
Reviewed-by: Tom Rini trini@konsulko.com

Do not register usb devices when CONFIG_DM_USB is define.
Signed-off-by: Mugunthan V N mugunthanvnm@ti.com --- board/ti/am43xx/board.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c index 16bbbd1..c75ef53 100644 --- a/board/ti/am43xx/board.c +++ b/board/ti/am43xx/board.c @@ -674,7 +674,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,

On Tue, Mar 15, 2016 at 05:44:12PM +0530, Mugunthan V N wrote:
Do not register usb devices when CONFIG_DM_USB is define.
Signed-off-by: Mugunthan V N mugunthanvnm@ti.com
Reviewed-by: Tom Rini trini@konsulko.com

Do not register usb devices when CONFIG_DM_USB is define.
Signed-off-by: Mugunthan V N mugunthanvnm@ti.com --- board/ti/dra7xx/evm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c index 50a9b72..f9e829b 100644 --- a/board/ti/dra7xx/evm.c +++ b/board/ti/dra7xx/evm.c @@ -118,7 +118,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,

On Tue, Mar 15, 2016 at 05:44:13PM +0530, Mugunthan V N wrote:
Do not register usb devices when CONFIG_DM_USB is define.
Signed-off-by: Mugunthan V N mugunthanvnm@ti.com
Reviewed-by: Tom Rini trini@konsulko.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 --- drivers/usb/dwc3/core.h | 4 ++++ drivers/usb/dwc3/dwc3-omap.c | 52 ++++++++++++++++++++++++++++++++++++++++++++ drivers/usb/dwc3/gadget.c | 2 +- 3 files changed, 57 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 72d2fcd..24f03e4 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 31d15f5..fef7deb 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c @@ -27,6 +27,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. @@ -134,6 +139,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) @@ -461,3 +468,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 25ccc01..d6fcea7 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2611,7 +2611,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;

On Tue, Mar 15, 2016 at 05:44:14PM +0530, Mugunthan V N wrote:
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
Reviewed-by: Tom Rini trini@konsulko.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 --- drivers/usb/common/common.c | 29 +++++++++++++++++++++++++++++ include/linux/usb/otg.h | 9 +++++++++ 2 files changed, 38 insertions(+)
diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c index ed9d993..040708e 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 8f8ac6a..b61ef19 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 */

On Tue, Mar 15, 2016 at 05:44:15PM +0530, Mugunthan V N wrote:
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
Reviewed-by: Tom Rini trini@konsulko.com

Hi,
On 15 March 2016 at 06:14, Mugunthan V N mugunthanvnm@ti.com wrote:
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
drivers/usb/common/common.c | 29 +++++++++++++++++++++++++++++
This file does not existing in mainline. Is there a dependent series for this series?
I can't apply it as is.
include/linux/usb/otg.h | 9 +++++++++ 2 files changed, 38 insertions(+)
[snip]
Regards, Simon

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 --- drivers/usb/dwc3/core.c | 57 +++++++++++++++ drivers/usb/dwc3/core.h | 2 + drivers/usb/dwc3/dwc3-omap.c | 166 ++++++++++++++++++++++++++++++++++++++++++- include/configs/am43xx_evm.h | 1 + 4 files changed, 225 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index c599d0b..0ad4a02 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -601,6 +601,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 @@ -787,3 +789,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 24f03e4..9726287 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 fef7deb..560748d 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c @@ -26,9 +26,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;
@@ -139,7 +151,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);
@@ -368,6 +384,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 @@ -471,15 +489,154 @@ 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 = (void *)fdtdec_get_addr(fdt, dev->parent->of_offset, + "reg"); + + priv->dwc3.regs = (void *)dev_get_addr(dev); + 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 = (void *)fdtdec_get_addr(fdt, + ctrlmodnode, + "reg"); + 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; @@ -489,6 +646,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 */ diff --git a/include/configs/am43xx_evm.h b/include/configs/am43xx_evm.h index 1428aa9..7d2a93e 100644 --- a/include/configs/am43xx_evm.h +++ b/include/configs/am43xx_evm.h @@ -102,6 +102,7 @@
#define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/omap-common/u-boot-spl.lds"
+#define CONFIG_ARCH_MISC_INIT /* SPL USB Support */ #ifdef CONFIG_SPL_USB_HOST_SUPPORT #define CONFIG_SPL_USB_SUPPORT

On Tue, Mar 15, 2016 at 05:44:16PM +0530, Mugunthan V N wrote:
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
Reviewed-by: Tom Rini trini@konsulko.com

From: Tom Rini trini@ti.com
Add in code to initialize the DWC3 gadget controller so that we can do RNDIS in SPL on these platforms.
Signed-off-by: Tom Rini trini@ti.com Signed-off-by: Kishon Vijay Abraham I kishon@ti.com Signed-off-by: Mugunthan V N mugunthanvnm@ti.com --- board/ti/am43xx/board.c | 39 ++++++++++++++++++++++++++++++++++++--- drivers/Makefile | 2 ++ drivers/usb/gadget/gadget_chips.h | 2 ++ include/configs/am43xx_evm.h | 12 ++++++++++++ 4 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c index c75ef53..e71d86e 100644 --- a/board/ti/am43xx/board.c +++ b/board/ti/am43xx/board.c @@ -766,8 +766,8 @@ int board_usb_cleanup(int index, enum usb_init_type init) } #endif
-#ifdef CONFIG_DRIVER_TI_CPSW - +#if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \ + (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD)) static void cpsw_control(int enabled) { /* Additional controls can be added here */ @@ -805,7 +805,24 @@ static struct cpsw_platform_data cpsw_data = { .host_port_num = 0, .version = CPSW_CTRL_VERSION_2, }; +#endif
+/* + * This function will: + * Read the eFuse for MAC addresses, and set ethaddr/eth1addr/usbnet_devaddr + * in the environment + * Perform fixups to the PHY present on certain boards. We only need this + * function in: + * - SPL with either CPSW or USB ethernet support + * - Full U-Boot, with either CPSW or USB ethernet + * Build in only these cases to avoid warnings about unused variables + * when we build an SPL that has neither option but full U-Boot will. + */ +#if ((defined(CONFIG_SPL_ETH_SUPPORT) || \ + defined(CONFIG_SPL_USBETH_SUPPORT)) && \ + defined(CONFIG_SPL_BUILD)) || \ + ((defined(CONFIG_DRIVER_TI_CPSW) || \ + defined(CONFIG_USB_ETHER)) && !defined(CONFIG_SPL_BUILD)) int board_eth_init(bd_t *bis) { int rv; @@ -822,12 +839,15 @@ int board_eth_init(bd_t *bis) mac_addr[4] = mac_lo & 0xFF; mac_addr[5] = (mac_lo & 0xFF00) >> 8;
+#if (defined(CONFIG_DRIVER_TI_CPSW) && !defined(CONFIG_SPL_BUILD)) || \ + (defined(CONFIG_SPL_ETH_SUPPORT) && defined(CONFIG_SPL_BUILD)) if (!getenv("ethaddr")) { puts("<ethaddr> not set. Validating first E-fuse MAC\n"); if (is_valid_ethaddr(mac_addr)) eth_setenv_enetaddr("ethaddr", mac_addr); }
+#ifndef CONFIG_SPL_BUILD mac_lo = readl(&cdev->macid1l); mac_hi = readl(&cdev->macid1h); mac_addr[0] = mac_hi & 0xFF; @@ -841,6 +861,7 @@ int board_eth_init(bd_t *bis) if (is_valid_ethaddr(mac_addr)) eth_setenv_enetaddr("eth1addr", mac_addr); } +#endif
if (board_is_eposevm()) { writel(RMII_MODE_ENABLE | RMII_CHIPCKL_ENABLE, &cdev->miisel); @@ -862,8 +883,20 @@ int board_eth_init(bd_t *bis) }
rv = cpsw_register(&cpsw_data); - if (rv < 0) + if (rv < 0) { printf("Error %d registering CPSW switch\n", rv); + return rv; + } +#endif +#if defined(CONFIG_USB_ETHER) && \ + (!defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_USBETH_SUPPORT)) + if (is_valid_ethaddr(mac_addr)) + eth_setenv_enetaddr("usbnet_devaddr", mac_addr); + + rv = usb_eth_initialize(bis); + if (rv < 0) + printf("Error %d registering USB_ETHER\n", rv); +#endif
return rv; } diff --git a/drivers/Makefile b/drivers/Makefile index e7eab66..35319b5 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -31,6 +31,8 @@ obj-$(CONFIG_SPL_ETH_SUPPORT) += net/ obj-$(CONFIG_SPL_ETH_SUPPORT) += net/phy/ obj-$(CONFIG_SPL_USBETH_SUPPORT) += net/phy/ obj-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += usb/musb-new/ +obj-$(CONFIG_USB_DWC3_GADGET) += usb/dwc3/ +obj-$(CONFIG_USB_DWC3_GADGET) += usb/gadget/udc/ obj-$(CONFIG_SPL_USBETH_SUPPORT) += usb/gadget/ obj-$(CONFIG_SPL_WATCHDOG_SUPPORT) += watchdog/ obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += usb/host/ diff --git a/drivers/usb/gadget/gadget_chips.h b/drivers/usb/gadget/gadget_chips.h index 973cd97..c09d30e 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; } diff --git a/include/configs/am43xx_evm.h b/include/configs/am43xx_evm.h index 7d2a93e..546cc09 100644 --- a/include/configs/am43xx_evm.h +++ b/include/configs/am43xx_evm.h @@ -129,6 +129,9 @@ #define CONFIG_USB_DWC3_GADGET
#define CONFIG_USB_GADGET +#define CONFIG_USB_ETHER +#define CONFIG_USB_ETH_RNDIS +#define CONFIG_USBNET_HOST_ADDR "de:ad:be:af:00:00" #define CONFIG_USB_GADGET_DOWNLOAD #define CONFIG_USB_GADGET_VBUS_DRAW 2 #define CONFIG_G_DNL_MANUFACTURER "Texas Instruments" @@ -148,6 +151,15 @@ #undef CONFIG_TIMER #endif
+#if (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_USBETH_SUPPORT)) +#undef CONFIG_ENV_IS_IN_FAT +#define CONFIG_ENV_IS_NOWHERE +#endif + +#if defined(CONFIG_SPL_USBETH_SUPPORT) || defined(CONFIG_SPL_ETH_SUPPORT) +#define CONFIG_SPL_NET_SUPPORT +#endif + #ifndef CONFIG_SPL_BUILD /* USB Device Firmware Update support */ #define CONFIG_USB_FUNCTION_DFU

On Tue, Mar 15, 2016 at 05:44:17PM +0530, Mugunthan V N wrote:
From: Tom Rini trini@ti.com
Add in code to initialize the DWC3 gadget controller so that we can do RNDIS in SPL on these platforms.
Signed-off-by: Tom Rini trini@ti.com Signed-off-by: Kishon Vijay Abraham I kishon@ti.com Signed-off-by: Mugunthan V N mugunthanvnm@ti.com
Reviewed-by: Tom Rini trini@konsulko.com

From: Kishon Vijay Abraham I kishon@ti.com
Add a new config to support usb rndis boot for am43xx.
Signed-off-by: Kishon Vijay Abraham I kishon@ti.com Signed-off-by: Mugunthan V N mugunthanvnm@ti.com --- board/ti/am43xx/MAINTAINERS | 1 + configs/am43xx_evm_usbspl_defconfig | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 configs/am43xx_evm_usbspl_defconfig
diff --git a/board/ti/am43xx/MAINTAINERS b/board/ti/am43xx/MAINTAINERS index 96ef85b..ed3add7 100644 --- a/board/ti/am43xx/MAINTAINERS +++ b/board/ti/am43xx/MAINTAINERS @@ -9,3 +9,4 @@ F: configs/am43xx_evm_ethboot_defconfig F: configs/am43xx_evm_usbhost_boot_defconfig F: configs/am437x_gp_evm_defconfig F: configs/am437x_sk_evm_defconfig +F: configs/am43xx_evm_usbspl_defconfig diff --git a/configs/am43xx_evm_usbspl_defconfig b/configs/am43xx_evm_usbspl_defconfig new file mode 100644 index 0000000..d83a4da --- /dev/null +++ b/configs/am43xx_evm_usbspl_defconfig @@ -0,0 +1,9 @@ +CONFIG_ARM=y +CONFIG_TARGET_AM43XX_EVM=y +CONFIG_SPL=y +CONFIG_SYS_EXTRA_OPTIONS="SERIAL1,CONS_INDEX=1,NAND,SPL_USBETH_SUPPORT" +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_FLASH is not set +# CONFIG_CMD_SETEXPR is not set +CONFIG_SPI_FLASH_BAR=y +CONFIG_SPI_FLASH=y

On Tue, Mar 15, 2016 at 05:44:18PM +0530, Mugunthan V N wrote:
From: Kishon Vijay Abraham I kishon@ti.com
Add a new config to support usb rndis boot for am43xx.
Signed-off-by: Kishon Vijay Abraham I kishon@ti.com Signed-off-by: Mugunthan V N mugunthanvnm@ti.com
Reviewed-by: Tom Rini trini@konsulko.com

enable usb driver model for am437x sk evm as dwc3 supports driver model
Signed-off-by: Mugunthan V N mugunthanvnm@ti.com --- configs/am437x_sk_evm_defconfig | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/configs/am437x_sk_evm_defconfig b/configs/am437x_sk_evm_defconfig index 3e916db..f643c40 100644 --- a/configs/am437x_sk_evm_defconfig +++ b/configs/am437x_sk_evm_defconfig @@ -24,3 +24,7 @@ CONFIG_SPI_FLASH_BAR=y CONFIG_TIMER=y CONFIG_OMAP_TIMER=y CONFIG_DMA=y +CONFIG_MISC=y +CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_CMD_USB=y

On Tue, Mar 15, 2016 at 05:44:19PM +0530, Mugunthan V N wrote:
enable usb driver model for am437x sk evm as dwc3 supports driver model
Signed-off-by: Mugunthan V N mugunthanvnm@ti.com
Reviewed-by: Tom Rini trini@konsulko.com

Hi Tom,
On 15.3.2016 13:14, Mugunthan V N wrote:
This patch series enables dwc3 usb driver to adopt driver model. This has been tested on AM437x evm sk (logs [1]) by loading kernel through usb ether
Also pushed a branch for testing [2]
[1] - http://pastebin.ubuntu.com/15391169/ [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git dm-dwc3
Kishon Vijay Abraham I (1): configs: am43xx: Add am43xx_evm_usbspl_defconfig
Mugunthan V N (8): 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 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 defconfig: am437x_sk_evm: enable usb driver model
Tom Rini (1): am43xx: Add USB device boot support to SPL
board/ti/am43xx/MAINTAINERS | 1 + board/ti/am43xx/board.c | 52 +++++--- board/ti/am57xx/board.c | 11 -- board/ti/dra7xx/evm.c | 13 +- configs/am437x_sk_evm_defconfig | 4 + configs/am43xx_evm_usbspl_defconfig | 9 ++ drivers/Makefile | 2 + drivers/usb/common/common.c | 29 +++++ drivers/usb/dwc3/core.c | 64 +++++++++- drivers/usb/dwc3/core.h | 6 + drivers/usb/dwc3/dwc3-omap.c | 230 +++++++++++++++++++++++++++++++++++- drivers/usb/dwc3/gadget.c | 2 +- drivers/usb/dwc3/linux-compat.h | 5 - drivers/usb/dwc3/ti_usb_phy.c | 1 + drivers/usb/gadget/gadget_chips.h | 2 + include/configs/am43xx_evm.h | 13 ++ include/linux/usb/otg.h | 9 ++ 17 files changed, 406 insertions(+), 47 deletions(-) create mode 100644 configs/am43xx_evm_usbspl_defconfig
Are you going to take this directly or this should go via USB tree?
Thanks, Michal

On Thu, Mar 31, 2016 at 04:10:49PM +0200, Michal Simek wrote:
Hi Tom,
On 15.3.2016 13:14, Mugunthan V N wrote:
This patch series enables dwc3 usb driver to adopt driver model. This has been tested on AM437x evm sk (logs [1]) by loading kernel through usb ether
Also pushed a branch for testing [2]
[1] - http://pastebin.ubuntu.com/15391169/ [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git dm-dwc3
Kishon Vijay Abraham I (1): configs: am43xx: Add am43xx_evm_usbspl_defconfig
Mugunthan V N (8): 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 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 defconfig: am437x_sk_evm: enable usb driver model
Tom Rini (1): am43xx: Add USB device boot support to SPL
board/ti/am43xx/MAINTAINERS | 1 + board/ti/am43xx/board.c | 52 +++++--- board/ti/am57xx/board.c | 11 -- board/ti/dra7xx/evm.c | 13 +- configs/am437x_sk_evm_defconfig | 4 + configs/am43xx_evm_usbspl_defconfig | 9 ++ drivers/Makefile | 2 + drivers/usb/common/common.c | 29 +++++ drivers/usb/dwc3/core.c | 64 +++++++++- drivers/usb/dwc3/core.h | 6 + drivers/usb/dwc3/dwc3-omap.c | 230 +++++++++++++++++++++++++++++++++++- drivers/usb/dwc3/gadget.c | 2 +- drivers/usb/dwc3/linux-compat.h | 5 - drivers/usb/dwc3/ti_usb_phy.c | 1 + drivers/usb/gadget/gadget_chips.h | 2 + include/configs/am43xx_evm.h | 13 ++ include/linux/usb/otg.h | 9 ++ 17 files changed, 406 insertions(+), 47 deletions(-) create mode 100644 configs/am43xx_evm_usbspl_defconfig
Are you going to take this directly or this should go via USB tree?
Marek, do you want this? Or want me to?

On 03/31/2016 05:11 PM, Tom Rini wrote:
On Thu, Mar 31, 2016 at 04:10:49PM +0200, Michal Simek wrote:
Hi Tom,
On 15.3.2016 13:14, Mugunthan V N wrote:
This patch series enables dwc3 usb driver to adopt driver model. This has been tested on AM437x evm sk (logs [1]) by loading kernel through usb ether
Also pushed a branch for testing [2]
[1] - http://pastebin.ubuntu.com/15391169/ [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git dm-dwc3
Kishon Vijay Abraham I (1): configs: am43xx: Add am43xx_evm_usbspl_defconfig
Mugunthan V N (8): 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 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 defconfig: am437x_sk_evm: enable usb driver model
Tom Rini (1): am43xx: Add USB device boot support to SPL
board/ti/am43xx/MAINTAINERS | 1 + board/ti/am43xx/board.c | 52 +++++--- board/ti/am57xx/board.c | 11 -- board/ti/dra7xx/evm.c | 13 +- configs/am437x_sk_evm_defconfig | 4 + configs/am43xx_evm_usbspl_defconfig | 9 ++ drivers/Makefile | 2 + drivers/usb/common/common.c | 29 +++++ drivers/usb/dwc3/core.c | 64 +++++++++- drivers/usb/dwc3/core.h | 6 + drivers/usb/dwc3/dwc3-omap.c | 230 +++++++++++++++++++++++++++++++++++- drivers/usb/dwc3/gadget.c | 2 +- drivers/usb/dwc3/linux-compat.h | 5 - drivers/usb/dwc3/ti_usb_phy.c | 1 + drivers/usb/gadget/gadget_chips.h | 2 + include/configs/am43xx_evm.h | 13 ++ include/linux/usb/otg.h | 9 ++ 17 files changed, 406 insertions(+), 47 deletions(-) create mode 100644 configs/am43xx_evm_usbspl_defconfig
Are you going to take this directly or this should go via USB tree?
Marek, do you want this? Or want me to?
That is Lukasz.

Hi,
On 31 March 2016 at 09:24, Marek Vasut marex@denx.de wrote:
On 03/31/2016 05:11 PM, Tom Rini wrote:
On Thu, Mar 31, 2016 at 04:10:49PM +0200, Michal Simek wrote:
Hi Tom,
On 15.3.2016 13:14, Mugunthan V N wrote:
This patch series enables dwc3 usb driver to adopt driver model. This has been tested on AM437x evm sk (logs [1]) by loading kernel through usb ether
Also pushed a branch for testing [2]
[1] - http://pastebin.ubuntu.com/15391169/ [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git dm-dwc3
Kishon Vijay Abraham I (1): configs: am43xx: Add am43xx_evm_usbspl_defconfig
Mugunthan V N (8): 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 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 defconfig: am437x_sk_evm: enable usb driver model
Tom Rini (1): am43xx: Add USB device boot support to SPL
board/ti/am43xx/MAINTAINERS | 1 + board/ti/am43xx/board.c | 52 +++++--- board/ti/am57xx/board.c | 11 -- board/ti/dra7xx/evm.c | 13 +- configs/am437x_sk_evm_defconfig | 4 + configs/am43xx_evm_usbspl_defconfig | 9 ++ drivers/Makefile | 2 + drivers/usb/common/common.c | 29 +++++ drivers/usb/dwc3/core.c | 64 +++++++++- drivers/usb/dwc3/core.h | 6 + drivers/usb/dwc3/dwc3-omap.c | 230 +++++++++++++++++++++++++++++++++++- drivers/usb/dwc3/gadget.c | 2 +- drivers/usb/dwc3/linux-compat.h | 5 - drivers/usb/dwc3/ti_usb_phy.c | 1 + drivers/usb/gadget/gadget_chips.h | 2 + include/configs/am43xx_evm.h | 13 ++ include/linux/usb/otg.h | 9 ++ 17 files changed, 406 insertions(+), 47 deletions(-) create mode 100644 configs/am43xx_evm_usbspl_defconfig
Are you going to take this directly or this should go via USB tree?
Marek, do you want this? Or want me to?
That is Lukasz.
This series has ended up in my patchwork queue, but there seem to be quite a few unapplied, dependent patches. Tom please let me know what you'd like me to do here.
Regards, Simon

On Wed, Apr 06, 2016 at 05:16:02PM -0600, Simon Glass wrote:
Hi,
On 31 March 2016 at 09:24, Marek Vasut marex@denx.de wrote:
On 03/31/2016 05:11 PM, Tom Rini wrote:
On Thu, Mar 31, 2016 at 04:10:49PM +0200, Michal Simek wrote:
Hi Tom,
On 15.3.2016 13:14, Mugunthan V N wrote:
This patch series enables dwc3 usb driver to adopt driver model. This has been tested on AM437x evm sk (logs [1]) by loading kernel through usb ether
Also pushed a branch for testing [2]
[1] - http://pastebin.ubuntu.com/15391169/ [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git dm-dwc3
Kishon Vijay Abraham I (1): configs: am43xx: Add am43xx_evm_usbspl_defconfig
Mugunthan V N (8): 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 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 defconfig: am437x_sk_evm: enable usb driver model
Tom Rini (1): am43xx: Add USB device boot support to SPL
board/ti/am43xx/MAINTAINERS | 1 + board/ti/am43xx/board.c | 52 +++++--- board/ti/am57xx/board.c | 11 -- board/ti/dra7xx/evm.c | 13 +- configs/am437x_sk_evm_defconfig | 4 + configs/am43xx_evm_usbspl_defconfig | 9 ++ drivers/Makefile | 2 + drivers/usb/common/common.c | 29 +++++ drivers/usb/dwc3/core.c | 64 +++++++++- drivers/usb/dwc3/core.h | 6 + drivers/usb/dwc3/dwc3-omap.c | 230 +++++++++++++++++++++++++++++++++++- drivers/usb/dwc3/gadget.c | 2 +- drivers/usb/dwc3/linux-compat.h | 5 - drivers/usb/dwc3/ti_usb_phy.c | 1 + drivers/usb/gadget/gadget_chips.h | 2 + include/configs/am43xx_evm.h | 13 ++ include/linux/usb/otg.h | 9 ++ 17 files changed, 406 insertions(+), 47 deletions(-) create mode 100644 configs/am43xx_evm_usbspl_defconfig
Are you going to take this directly or this should go via USB tree?
Marek, do you want this? Or want me to?
That is Lukasz.
This series has ended up in my patchwork queue, but there seem to be quite a few unapplied, dependent patches. Tom please let me know what you'd like me to do here.
... I didn't think it depended on stuff but I do need to do another go-round from the queue and apply stuff.

+Mugunthan, who seems to have been dropped from this thread
On 8 April 2016 at 13:45, Tom Rini trini@konsulko.com wrote:
On Wed, Apr 06, 2016 at 05:16:02PM -0600, Simon Glass wrote:
Hi,
On 31 March 2016 at 09:24, Marek Vasut marex@denx.de wrote:
On 03/31/2016 05:11 PM, Tom Rini wrote:
On Thu, Mar 31, 2016 at 04:10:49PM +0200, Michal Simek wrote:
Hi Tom,
On 15.3.2016 13:14, Mugunthan V N wrote:
This patch series enables dwc3 usb driver to adopt driver model. This has been tested on AM437x evm sk (logs [1]) by loading kernel through usb ether
Also pushed a branch for testing [2]
[1] - http://pastebin.ubuntu.com/15391169/ [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git dm-dwc3
Kishon Vijay Abraham I (1): configs: am43xx: Add am43xx_evm_usbspl_defconfig
Mugunthan V N (8): 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 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 defconfig: am437x_sk_evm: enable usb driver model
Tom Rini (1): am43xx: Add USB device boot support to SPL
board/ti/am43xx/MAINTAINERS | 1 + board/ti/am43xx/board.c | 52 +++++--- board/ti/am57xx/board.c | 11 -- board/ti/dra7xx/evm.c | 13 +- configs/am437x_sk_evm_defconfig | 4 + configs/am43xx_evm_usbspl_defconfig | 9 ++ drivers/Makefile | 2 + drivers/usb/common/common.c | 29 +++++ drivers/usb/dwc3/core.c | 64 +++++++++- drivers/usb/dwc3/core.h | 6 + drivers/usb/dwc3/dwc3-omap.c | 230 +++++++++++++++++++++++++++++++++++- drivers/usb/dwc3/gadget.c | 2 +- drivers/usb/dwc3/linux-compat.h | 5 - drivers/usb/dwc3/ti_usb_phy.c | 1 + drivers/usb/gadget/gadget_chips.h | 2 + include/configs/am43xx_evm.h | 13 ++ include/linux/usb/otg.h | 9 ++ 17 files changed, 406 insertions(+), 47 deletions(-) create mode 100644 configs/am43xx_evm_usbspl_defconfig
Are you going to take this directly or this should go via USB tree?
Marek, do you want this? Or want me to?
That is Lukasz.
This series has ended up in my patchwork queue, but there seem to be quite a few unapplied, dependent patches. Tom please let me know what you'd like me to do here.
... I didn't think it depended on stuff but I do need to do another go-round from the queue and apply stuff.
Specifically it seems to be missing the patch below, from:
git://git.ti.com/~dmurphy/ti-u-boot/mugunth-ti-u-boot.git
commit 67802cd52d1c45a789ac377106267cee9d6ac2d9 Author: Mugunthan V N mugunthanvnm@ti.com Date: Tue Mar 1 16:59:22 2016 +0530
drivers: usb: common: add common code for usb drivers to use
Add common usb code which usb drivers makes use of it.
Signed-off-by: Mugunthan V N mugunthanvnm@ti.com
Makefile | 1 + drivers/usb/common/Makefile | 8 ++++++++ drivers/usb/common/common.c | 40 ++++++++++++++++++++++++++++++++++++++++ include/linux/usb/otg.h | 9 +++++++++ 4 files changed, 58 insertions(+)
Regards, Simon

On Monday 11 April 2016 05:50 PM, Simon Glass wrote:
+Mugunthan, who seems to have been dropped from this thread
On 8 April 2016 at 13:45, Tom Rini trini@konsulko.com wrote:
On Wed, Apr 06, 2016 at 05:16:02PM -0600, Simon Glass wrote:
Hi,
On 31 March 2016 at 09:24, Marek Vasut marex@denx.de wrote:
On 03/31/2016 05:11 PM, Tom Rini wrote:
On Thu, Mar 31, 2016 at 04:10:49PM +0200, Michal Simek wrote:
Hi Tom,
On 15.3.2016 13:14, Mugunthan V N wrote: > This patch series enables dwc3 usb driver to adopt driver model. > This has been tested on AM437x evm sk (logs [1]) by loading > kernel through usb ether > > Also pushed a branch for testing [2] > > [1] - http://pastebin.ubuntu.com/15391169/ > [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git dm-dwc3 > > Kishon Vijay Abraham I (1): > configs: am43xx: Add am43xx_evm_usbspl_defconfig > > Mugunthan V N (8): > 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 > 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 > defconfig: am437x_sk_evm: enable usb driver model > > Tom Rini (1): > am43xx: Add USB device boot support to SPL > > board/ti/am43xx/MAINTAINERS | 1 + > board/ti/am43xx/board.c | 52 +++++--- > board/ti/am57xx/board.c | 11 -- > board/ti/dra7xx/evm.c | 13 +- > configs/am437x_sk_evm_defconfig | 4 + > configs/am43xx_evm_usbspl_defconfig | 9 ++ > drivers/Makefile | 2 + > drivers/usb/common/common.c | 29 +++++ > drivers/usb/dwc3/core.c | 64 +++++++++- > drivers/usb/dwc3/core.h | 6 + > drivers/usb/dwc3/dwc3-omap.c | 230 +++++++++++++++++++++++++++++++++++- > drivers/usb/dwc3/gadget.c | 2 +- > drivers/usb/dwc3/linux-compat.h | 5 - > drivers/usb/dwc3/ti_usb_phy.c | 1 + > drivers/usb/gadget/gadget_chips.h | 2 + > include/configs/am43xx_evm.h | 13 ++ > include/linux/usb/otg.h | 9 ++ > 17 files changed, 406 insertions(+), 47 deletions(-) > create mode 100644 configs/am43xx_evm_usbspl_defconfig >
Are you going to take this directly or this should go via USB tree?
Marek, do you want this? Or want me to?
That is Lukasz.
This series has ended up in my patchwork queue, but there seem to be quite a few unapplied, dependent patches. Tom please let me know what you'd like me to do here.
... I didn't think it depended on stuff but I do need to do another go-round from the queue and apply stuff.
Specifically it seems to be missing the patch below, from:
git://git.ti.com/~dmurphy/ti-u-boot/mugunth-ti-u-boot.git
commit 67802cd52d1c45a789ac377106267cee9d6ac2d9 Author: Mugunthan V N mugunthanvnm@ti.com Date: Tue Mar 1 16:59:22 2016 +0530
drivers: usb: common: add common code for usb drivers to use Add common usb code which usb drivers makes use of it. Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Makefile | 1 + drivers/usb/common/Makefile | 8 ++++++++ drivers/usb/common/common.c | 40 ++++++++++++++++++++++++++++++++++++++++ include/linux/usb/otg.h | 9 +++++++++ 4 files changed, 58 insertions(+)
This was part of my musb v2 patch series, due to other priorities I didn't submitted this yet.
Simon, are you applying the series, can I send the above patch separately?
Regards Mugunthan V N

Hi Mugunthan,
On 11 April 2016 at 08:52, Mugunthan V N mugunthanvnm@ti.com wrote:
On Monday 11 April 2016 05:50 PM, Simon Glass wrote:
+Mugunthan, who seems to have been dropped from this thread
On 8 April 2016 at 13:45, Tom Rini trini@konsulko.com wrote:
On Wed, Apr 06, 2016 at 05:16:02PM -0600, Simon Glass wrote:
Hi,
On 31 March 2016 at 09:24, Marek Vasut marex@denx.de wrote:
On 03/31/2016 05:11 PM, Tom Rini wrote:
On Thu, Mar 31, 2016 at 04:10:49PM +0200, Michal Simek wrote: > Hi Tom, > > On 15.3.2016 13:14, Mugunthan V N wrote: >> This patch series enables dwc3 usb driver to adopt driver model. >> This has been tested on AM437x evm sk (logs [1]) by loading >> kernel through usb ether >> >> Also pushed a branch for testing [2] >> >> [1] - http://pastebin.ubuntu.com/15391169/ >> [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git dm-dwc3 >> >> Kishon Vijay Abraham I (1): >> configs: am43xx: Add am43xx_evm_usbspl_defconfig >> >> Mugunthan V N (8): >> 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 >> 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 >> defconfig: am437x_sk_evm: enable usb driver model >> >> Tom Rini (1): >> am43xx: Add USB device boot support to SPL >> >> board/ti/am43xx/MAINTAINERS | 1 + >> board/ti/am43xx/board.c | 52 +++++--- >> board/ti/am57xx/board.c | 11 -- >> board/ti/dra7xx/evm.c | 13 +- >> configs/am437x_sk_evm_defconfig | 4 + >> configs/am43xx_evm_usbspl_defconfig | 9 ++ >> drivers/Makefile | 2 + >> drivers/usb/common/common.c | 29 +++++ >> drivers/usb/dwc3/core.c | 64 +++++++++- >> drivers/usb/dwc3/core.h | 6 + >> drivers/usb/dwc3/dwc3-omap.c | 230 +++++++++++++++++++++++++++++++++++- >> drivers/usb/dwc3/gadget.c | 2 +- >> drivers/usb/dwc3/linux-compat.h | 5 - >> drivers/usb/dwc3/ti_usb_phy.c | 1 + >> drivers/usb/gadget/gadget_chips.h | 2 + >> include/configs/am43xx_evm.h | 13 ++ >> include/linux/usb/otg.h | 9 ++ >> 17 files changed, 406 insertions(+), 47 deletions(-) >> create mode 100644 configs/am43xx_evm_usbspl_defconfig >> > > Are you going to take this directly or this should go via USB tree?
Marek, do you want this? Or want me to?
That is Lukasz.
This series has ended up in my patchwork queue, but there seem to be quite a few unapplied, dependent patches. Tom please let me know what you'd like me to do here.
... I didn't think it depended on stuff but I do need to do another go-round from the queue and apply stuff.
Specifically it seems to be missing the patch below, from:
git://git.ti.com/~dmurphy/ti-u-boot/mugunth-ti-u-boot.git
commit 67802cd52d1c45a789ac377106267cee9d6ac2d9 Author: Mugunthan V N mugunthanvnm@ti.com Date: Tue Mar 1 16:59:22 2016 +0530
drivers: usb: common: add common code for usb drivers to use Add common usb code which usb drivers makes use of it. Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Makefile | 1 + drivers/usb/common/Makefile | 8 ++++++++ drivers/usb/common/common.c | 40 ++++++++++++++++++++++++++++++++++++++++ include/linux/usb/otg.h | 9 +++++++++ 4 files changed, 58 insertions(+)
This was part of my musb v2 patch series, due to other priorities I didn't submitted this yet.
Simon, are you applying the series, can I send the above patch separately?
If you like, yes.
Regards, Simon

Hi Simon
On Monday 11 April 2016 08:27 PM, Simon Glass wrote:
Hi Mugunthan,
On 11 April 2016 at 08:52, Mugunthan V N mugunthanvnm@ti.com wrote:
On Monday 11 April 2016 05:50 PM, Simon Glass wrote:
+Mugunthan, who seems to have been dropped from this thread
On 8 April 2016 at 13:45, Tom Rini trini@konsulko.com wrote:
On Wed, Apr 06, 2016 at 05:16:02PM -0600, Simon Glass wrote:
Hi,
On 31 March 2016 at 09:24, Marek Vasut marex@denx.de wrote:
On 03/31/2016 05:11 PM, Tom Rini wrote: > On Thu, Mar 31, 2016 at 04:10:49PM +0200, Michal Simek wrote: >> Hi Tom, >> >> On 15.3.2016 13:14, Mugunthan V N wrote: >>> This patch series enables dwc3 usb driver to adopt driver model. >>> This has been tested on AM437x evm sk (logs [1]) by loading >>> kernel through usb ether >>> >>> Also pushed a branch for testing [2] >>> >>> [1] - http://pastebin.ubuntu.com/15391169/ >>> [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/mugunth-ti-u-boot.git dm-dwc3 >>> >>> Kishon Vijay Abraham I (1): >>> configs: am43xx: Add am43xx_evm_usbspl_defconfig >>> >>> Mugunthan V N (8): >>> 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 >>> 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 >>> defconfig: am437x_sk_evm: enable usb driver model >>> >>> Tom Rini (1): >>> am43xx: Add USB device boot support to SPL >>> >>> board/ti/am43xx/MAINTAINERS | 1 + >>> board/ti/am43xx/board.c | 52 +++++--- >>> board/ti/am57xx/board.c | 11 -- >>> board/ti/dra7xx/evm.c | 13 +- >>> configs/am437x_sk_evm_defconfig | 4 + >>> configs/am43xx_evm_usbspl_defconfig | 9 ++ >>> drivers/Makefile | 2 + >>> drivers/usb/common/common.c | 29 +++++ >>> drivers/usb/dwc3/core.c | 64 +++++++++- >>> drivers/usb/dwc3/core.h | 6 + >>> drivers/usb/dwc3/dwc3-omap.c | 230 +++++++++++++++++++++++++++++++++++- >>> drivers/usb/dwc3/gadget.c | 2 +- >>> drivers/usb/dwc3/linux-compat.h | 5 - >>> drivers/usb/dwc3/ti_usb_phy.c | 1 + >>> drivers/usb/gadget/gadget_chips.h | 2 + >>> include/configs/am43xx_evm.h | 13 ++ >>> include/linux/usb/otg.h | 9 ++ >>> 17 files changed, 406 insertions(+), 47 deletions(-) >>> create mode 100644 configs/am43xx_evm_usbspl_defconfig >>> >> >> Are you going to take this directly or this should go via USB tree? > > Marek, do you want this? Or want me to? > That is Lukasz.
This series has ended up in my patchwork queue, but there seem to be quite a few unapplied, dependent patches. Tom please let me know what you'd like me to do here.
... I didn't think it depended on stuff but I do need to do another go-round from the queue and apply stuff.
Specifically it seems to be missing the patch below, from:
git://git.ti.com/~dmurphy/ti-u-boot/mugunth-ti-u-boot.git
commit 67802cd52d1c45a789ac377106267cee9d6ac2d9 Author: Mugunthan V N mugunthanvnm@ti.com Date: Tue Mar 1 16:59:22 2016 +0530
drivers: usb: common: add common code for usb drivers to use Add common usb code which usb drivers makes use of it. Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Makefile | 1 + drivers/usb/common/Makefile | 8 ++++++++ drivers/usb/common/common.c | 40 ++++++++++++++++++++++++++++++++++++++++ include/linux/usb/otg.h | 9 +++++++++ 4 files changed, 58 insertions(+)
This was part of my musb v2 patch series, due to other priorities I didn't submitted this yet.
Simon, are you applying the series, can I send the above patch separately?
If you like, yes.
I have posted the patch [1], can you apply it before applying this series to meet the dependency.
[1]: http://patchwork.ozlabs.org/patch/609333/
Regards Mugunthan V N

Hi Mugunthan,
2016-04-12 12:34 GMT+02:00 Mugunthan V N mugunthanvnm@ti.com:
Hi Simon
On Monday 11 April 2016 08:27 PM, Simon Glass wrote:
Hi Mugunthan,
On 11 April 2016 at 08:52, Mugunthan V N mugunthanvnm@ti.com wrote:
On Monday 11 April 2016 05:50 PM, Simon Glass wrote:
+Mugunthan, who seems to have been dropped from this thread
On 8 April 2016 at 13:45, Tom Rini trini@konsulko.com wrote:
On Wed, Apr 06, 2016 at 05:16:02PM -0600, Simon Glass wrote:
Hi,
On 31 March 2016 at 09:24, Marek Vasut marex@denx.de wrote: > On 03/31/2016 05:11 PM, Tom Rini wrote: >> On Thu, Mar 31, 2016 at 04:10:49PM +0200, Michal Simek wrote: >>> Hi Tom, >>> >>> On 15.3.2016 13:14, Mugunthan V N wrote: >>>> This patch series enables dwc3 usb driver to adopt driver model. >>>> This has been tested on AM437x evm sk (logs [1]) by loading >>>> kernel through usb ether >>>> >>>> Also pushed a branch for testing [2] >>>> >>>> [1] - http://pastebin.ubuntu.com/15391169/ >>>> [2] - git://git.ti.com/~mugunthanvnm/ti-u-boot/
mugunth-ti-u-boot.git dm-dwc3
>>>> >>>> Kishon Vijay Abraham I (1): >>>> configs: am43xx: Add am43xx_evm_usbspl_defconfig >>>> >>>> Mugunthan V N (8): >>>> 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 >>>> 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 >>>> defconfig: am437x_sk_evm: enable usb driver model >>>> >>>> Tom Rini (1): >>>> am43xx: Add USB device boot support to SPL >>>> >>>> board/ti/am43xx/MAINTAINERS | 1 + >>>> board/ti/am43xx/board.c | 52 +++++--- >>>> board/ti/am57xx/board.c | 11 -- >>>> board/ti/dra7xx/evm.c | 13 +- >>>> configs/am437x_sk_evm_defconfig | 4 + >>>> configs/am43xx_evm_usbspl_defconfig | 9 ++ >>>> drivers/Makefile | 2 + >>>> drivers/usb/common/common.c | 29 +++++ >>>> drivers/usb/dwc3/core.c | 64 +++++++++- >>>> drivers/usb/dwc3/core.h | 6 + >>>> drivers/usb/dwc3/dwc3-omap.c | 230
+++++++++++++++++++++++++++++++++++-
>>>> drivers/usb/dwc3/gadget.c | 2 +- >>>> drivers/usb/dwc3/linux-compat.h | 5 - >>>> drivers/usb/dwc3/ti_usb_phy.c | 1 + >>>> drivers/usb/gadget/gadget_chips.h | 2 + >>>> include/configs/am43xx_evm.h | 13 ++ >>>> include/linux/usb/otg.h | 9 ++ >>>> 17 files changed, 406 insertions(+), 47 deletions(-) >>>> create mode 100644 configs/am43xx_evm_usbspl_defconfig >>>> >>> >>> Are you going to take this directly or this should go via USB
tree?
>> >> Marek, do you want this? Or want me to? >> > That is Lukasz.
This series has ended up in my patchwork queue, but there seem to be quite a few unapplied, dependent patches. Tom please let me know what you'd like me to do here.
... I didn't think it depended on stuff but I do need to do another go-round from the queue and apply stuff.
Specifically it seems to be missing the patch below, from:
git://git.ti.com/~dmurphy/ti-u-boot/mugunth-ti-u-boot.git
commit 67802cd52d1c45a789ac377106267cee9d6ac2d9 Author: Mugunthan V N mugunthanvnm@ti.com Date: Tue Mar 1 16:59:22 2016 +0530
drivers: usb: common: add common code for usb drivers to use Add common usb code which usb drivers makes use of it. Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Makefile | 1 + drivers/usb/common/Makefile | 8 ++++++++ drivers/usb/common/common.c | 40 ++++++++++++++++++++++++++++++
++++++++++
include/linux/usb/otg.h | 9 +++++++++ 4 files changed, 58 insertions(+)
This was part of my musb v2 patch series, due to other priorities I didn't submitted this yet.
Simon, are you applying the series, can I send the above patch
separately?
If you like, yes.
I have posted the patch [1], can you apply it before applying this series to meet the dependency.
Please correct me if I am wrong. But this hasn't been applied. Did you add support for DM_USB differently?
Thanks, MIchal
participants (5)
-
Marek Vasut
-
Michal Simek
-
Mugunthan V N
-
Simon Glass
-
Tom Rini