DRA7xx: Add DWC3 USB driver and enable DFU
Subsystems (5)
cover DRA7xx: Add DWC3 USB driver and enable DFU
Ported DWC3 driver from linux kernel v3.16 to uboot and enabled DFU in DRA7xx. Tested only with DFU ram.
While I kept the dwc3 driver pretty much the same from linux kernel, I have created a single driver for both USB2 and USB3 PHY programming. I have also adapted udc-core from linux kernel so that we can cleanly link the gadet driver with the controller driver.
This series was created on top of
commit 61e76f53708cf082ef9061a140b57df3513b8ba1
Merge: 76b2102 3d83e67
Author: Tom Rini <[email protected]>
Date: Tue Jun 10 20:37:00 2014 -0400
Merge branch 'master' of git://git.denx.de/u-boot-usb
Let me know of any feedback and suggestions.
Known Issues:
DWC3 is not enumerating consistently.
Kishon Vijay Abraham I (13):
include: linux: preparation for porting dwc3 from linux kernel
usb: gadget: udc-core: Add minimal udc-core from linux kernel
ARM: DRA7: Enable clocks for USB OTGSS and USB PHY
usb: dwc3: Add dwc3 driver
usb: dwc3-omap: Add dwc3 glue driver for OMAP
usb: dwc3: TI PHY: PHY driver for dwc3 in TI platforms
usb: gadget: g_dnl: Explicitly set the max packet size in descriptor
common: cmd_dfu: invoke board_usb_cleanup() for cleaning up
common: cmd_dfu: add an API that takes controller index for handling
interrupts
board: ti: DRA7: added USB initializtion code
commom: usb: implement "__weak" functions to make compiler happy
include: configs: Enable DWC3 and DFU in DRA7xx
dwc3: core: Change the bounce buffer size to 4096
Makefile | 1 + arch/arm/cpu/armv7/omap5/hw_data.c | 14 + arch/arm/cpu/armv7/omap5/prcm-regs.c | 6 +- arch/arm/include/asm/arch-omap5/omap.h | 12 + arch/arm/include/asm/omap_common.h | 4 +- board/ti/dra7xx/evm.c | 106 ++ common/cmd_dfu.c | 2 + common/usb.c | 18 + drivers/usb/dwc3/Makefile | 10 + drivers/usb/dwc3/core.c | 640 +++++++ drivers/usb/dwc3/core.h | 961 +++++++++++ drivers/usb/dwc3/dwc3-omap.c | 447 +++++ drivers/usb/dwc3/ep0.c | 1045 ++++++++++++ drivers/usb/dwc3/gadget.c | 2841 ++++++++++++++++++++++++++++++++ drivers/usb/dwc3/gadget.h | 163 ++ drivers/usb/dwc3/io.h | 52 + drivers/usb/dwc3/linux-compat.h | 132 ++ drivers/usb/dwc3/ti_usb_phy.c | 269 +++ drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/composite.c | 3 +- drivers/usb/gadget/g_dnl.c | 1 + drivers/usb/gadget/udc-core.c | 229 +++ include/configs/dra7xx_evm.h | 59 + include/configs/ti_omap5_common.h | 1 + include/dwc3-omap-uboot.h | 32 + include/dwc3-uboot.h | 26 + include/linux/compat.h | 12 +- include/linux/usb/composite.h | 12 + include/linux/usb/dwc3-omap.h | 19 + include/linux/usb/gadget.h | 75 +- include/linux/usb/otg.h | 20 + include/ti-usb-phy-uboot.h | 22 + include/usb.h | 7 + include/usb/lin_gadget_compat.h | 8 +- 34 files changed, 7236 insertions(+), 14 deletions(-) create mode 100644 drivers/usb/dwc3/Makefile create mode 100644 drivers/usb/dwc3/core.c create mode 100644 drivers/usb/dwc3/core.h create mode 100644 drivers/usb/dwc3/dwc3-omap.c create mode 100644 drivers/usb/dwc3/ep0.c create mode 100644 drivers/usb/dwc3/gadget.c create mode 100644 drivers/usb/dwc3/gadget.h create mode 100644 drivers/usb/dwc3/io.h create mode 100644 drivers/usb/dwc3/linux-compat.h create mode 100644 drivers/usb/dwc3/ti_usb_phy.c create mode 100644 drivers/usb/gadget/udc-core.c create mode 100644 include/dwc3-omap-uboot.h create mode 100644 include/dwc3-uboot.h create mode 100644 include/linux/usb/dwc3-omap.h create mode 100644 include/linux/usb/otg.h create mode 100644 include/ti-usb-phy-uboot.h
Signature · 1 line
1.9.1
RFC PATCH 1/13 include: linux: preparation for porting dwc3 from linux kernel
Fixes a bunch of header files in linux/usb in order to seamlessly port dwc3 usb driver from linux kernel to uboot.
--- include/linux/compat.h | 12 +++++-- include/linux/usb/composite.h | 12 +++++++ include/linux/usb/gadget.h | 75 ++++++++++++++++++++++++++++++++++++++--- include/linux/usb/otg.h | 20 +++++++++++ include/usb/lin_gadget_compat.h | 8 ++++- 5 files changed, 119 insertions(+), 8 deletions(-) create mode 100644 include/linux/usb/otg.h
include/linux/compat.h +10 -2
@@ -1,6 +1,8 @@#ifndef _LINUX_COMPAT_H_#define _LINUX_COMPAT_H_ +#include <common.h> +#define ndelay (x) udelay(1) #define dev_dbg(dev, fmt, args...) \
@@ -53,8 +55,14 @@#define BUG_ON (condition) do { if (condition) BUG(); } while(0)#endif /* BUG */ -#define WARN_ON (x) if (x) {printf("WARNING in %s line %d\n" \ - , __FILE__, __LINE__); } +#define WARN_ON (x) _WARN_ON((int)(x), __FILE__, __LINE__) +static inline int _WARN_ON (int x,char *file,int line) +{ +if (x) { +printf ("WARNING in %s line %d\n" , file, line); + } +return x; +}#define PAGE_SIZE 4096#endif
include/linux/usb/composite.h +12 -0
@@ -27,6 +27,18 @@#include <linux/usb/gadget.h> #include <usb/lin_gadget_compat.h> +/* +* USB function drivers should return USB_GADGET_DELAYED_STATUS if they +* wish to delay the data/status stages of the control transfer till they +* are ready. The control transfer will then be kept from completing till +* all the function drivers that requested for USB_GADGET_DELAYED_STAUS +* invoke usb_composite_setup_continue(). +* +* TODO: Fully port "usb: gadget: composite: Allow function drivers to +* pause control transfers" to uboot +*/ +#define USB_GADGET_DELAYED_STATUS 0x7fff/* Impossibly large value */ +struct usb_configuration ;/**
include/linux/usb/gadget.h +70 -5
172 lines not on this page · raw message
include/linux/usb/otg.h new file +20 -0
@@ -0,0 +1,20 @@ +/* include/linux/usb/otg.h +* +* Copyright (c) 2014 Texas Instruments Incorporated - http://www.ti.com +* +* USB OTG (On The Go) defines +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __LINUX_USB_OTG_H +#define __LINUX_USB_OTG_H + +enum usb_dr_mode { +USB_DR_MODE_UNKNOWN , +USB_DR_MODE_HOST , +USB_DR_MODE_PERIPHERAL , +USB_DR_MODE_OTG , +}; + +#endif /* __LINUX_USB_OTG_H */
include/usb/lin_gadget_compat.h +7 -1
@@ -27,7 +27,13 @@#define GFP_KERNEL 0 -#define IRQ_HANDLED 1 +enum irqreturn { +IRQ_NONE , +IRQ_HANDLED , +IRQ_WAKE_THREAD , +}; + +typedef enum irqreturn irqreturn_t ;#define ENOTSUPP 524/* Operation is not supported */
Signature · 1 line
1.9.1
RFC PATCH 2/13 usb: gadget: udc-core: Add minimal udc-core from linux kernel
In reply to Kishon Vijay Abraham IIn order to support multiple USB device controllers in uboot, udc-core is needed. udc-core also helps to cleanly link the USB peripheral driver with the gadget driver. Hence Ported minimal udc-core from linux kernel.
--- drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/udc-core.c | 229 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 230 insertions(+) create mode 100644 drivers/usb/gadget/udc-core.c
drivers/usb/gadget/Makefile +1 -0
@@ -19,6 +19,7 @@ obj-$(CONFIG_USBDOWNLOAD_GADGET) += g_dnl.o obj-$(CONFIG_DFU_FUNCTION) += f_dfu.o obj-$(CONFIG_USB_GADGET_MASS_STORAGE) += f_mass_storage.o obj-$(CONFIG_CMD_FASTBOOT) += f_fastboot.o +obj-y += udc-core.o endif ifdef CONFIG_USB_ETHER obj-y += ether.o
drivers/usb/gadget/udc-core.c new file +229 -0
229 lines not on this page · raw message
Signature · 1 line
1.9.1
RFC PATCH 2/13 usb: gadget: udc-core: Add minimal udc-core from linux kernel
Quoted 31 lines · Kishon Vijay Abraham I
In order to support multiple USB device controllers in uboot, udc-core is needed. udc-core also helps to cleanly link the USB peripheral driver with the gadget driver. Hence Ported minimal udc-core from linux kernel.
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/udc-core.c | 229 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 230 insertions(+) create mode 100644 drivers/usb/gadget/udc-core.cdrivers/usb/gadget/Makefile +1
-0@@ -19,6 +19,7 @@ obj-$(CONFIG_USBDOWNLOAD_GADGET) += g_dnl.o obj-$(CONFIG_DFU_FUNCTION) += f_dfu.o obj-$(CONFIG_USB_GADGET_MASS_STORAGE) += f_mass_storage.o obj-$(CONFIG_CMD_FASTBOOT) += f_fastboot.o +obj-y += udc-core.o endif ifdef CONFIG_USB_ETHER obj-y += ether.odrivers/usb/gadget/udc-core.c new file +1
-0@@ -0,0 +1,229 @@ +/**
drivers/usb/gadget/udc-core.c line 11
Quoted 10 lines
drivers/usb/gadget/udc-core.c new file +10
-0+* udc-core.c - Core UDC Framework +* +* Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com +* +* Author: Felipe Balbi <[email protected]> +* +* Taken from Linux Kernel v3.16 (drivers/usb/gadget/udc-core.c) and ported +* to uboot. +* +* SPDX-License-Identifier: GPL-2.0+
why are you relicensing this file ? In kernel this is gpl v2 only.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140818/a7bcc94b/attachment.pgp>
RFC PATCH 2/13 usb: gadget: udc-core: Add minimal udc-core from linux kernel
Quoted 36 lines · Felipe Balbi
Quoted 35 lines · Kishon Vijay Abraham I
In order to support multiple USB device controllers in uboot, udc-core is needed. udc-core also helps to cleanly link the USB peripheral driver with the gadget driver. Hence Ported minimal udc-core from linux kernel.
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/udc-core.c | 229 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 230 insertions(+) create mode 100644 drivers/usb/gadget/udc-core.cdrivers/usb/gadget/Makefile +1
-0@@ -19,6 +19,7 @@ obj-$(CONFIG_USBDOWNLOAD_GADGET) += g_dnl.o obj-$(CONFIG_DFU_FUNCTION) += f_dfu.o obj-$(CONFIG_USB_GADGET_MASS_STORAGE) += f_mass_storage.o obj-$(CONFIG_CMD_FASTBOOT) += f_fastboot.o +obj-y += udc-core.o endif ifdef CONFIG_USB_ETHER obj-y += ether.odrivers/usb/gadget/udc-core.c new file +5
-0@@ -0,0 +1,229 @@ +/** +* udc-core.c - Core UDC Framework +* +* Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com +*
Quoted 8 lines
drivers/usb/gadget/udc-core.c line 11
Quoted 6 lines
drivers/usb/gadget/udc-core.c new file +6
-0+* Author: Felipe Balbi <[email protected]> +* +* Taken from Linux Kernel v3.16 (drivers/usb/gadget/udc-core.c) and ported +* to uboot. +* +* SPDX-License-Identifier: GPL-2.0+ why are you relicensing this file ? In kernel this is gpl v2 only.
ah.. copy paste error. Will fix it.
Thanks
Kishon
Quoted 1 line
RFC PATCH 2/13 usb: gadget: udc-core: Add minimal udc-core from linux kernel
In reply to Kishon Vijay Abraham IHi Kishon,
Quoted 2 lines
In order to support multiple USB device controllers in uboot, udc-core is needed.
Is it? In u-boot at best only one UDC is operational at a time.
Quoted 3 lines
udc-core also helps to cleanly link the USB peripheral driver with the gadget driver. Hence Ported minimal udc-core from linux kernel.
I'd appreciate the exact SHA for this udc-core.c code. And the SHA should be from some already released mainline code (like final 3.16), not any private branch nor linux-next.
Quoted 31 lines
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/udc-core.c | 229++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 230 insertions(+) create mode 100644
drivers/usb/gadget/udc-core.cdrivers/usb/gadget/Makefile +1
-0@@ -19,6 +19,7 @@ obj-$(CONFIG_USBDOWNLOAD_GADGET) += g_dnl.o obj-$(CONFIG_DFU_FUNCTION) += f_dfu.o obj-$(CONFIG_USB_GADGET_MASS_STORAGE) += f_mass_storage.o obj-$(CONFIG_CMD_FASTBOOT) += f_fastboot.o +obj-y += udc-core.o endif ifdef CONFIG_USB_ETHER obj-y += ether.o(quoted diff) +0
-0
b/drivers/usb/gadget/udc-core.cnew file mode 100644 index 0000000..bbe919cdrivers/usb/gadget/udc-core.c new file +4
-0@@ -0,0 +1,229 @@ +/** +* udc-core.c - Core UDC Framework +* +* Copyright (C) 2014 Texas Instruments Incorporated -
Quoted 8 lines
+ *
+ * Author: Felipe Balbi <[email protected]>
+ *
+ * Taken from Linux Kernel v3.16 (drivers/usb/gadget/udc-core.c) and ported
+ * to uboot.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
It seems like the author is the same, but the GPL license is different:
Original file ./drivers/usb/gadget/udc/udc-core.c
/**
* udc.c - Core UDCFramework
*
* Copyright (C) 2010 TexasInstruments
* Author: Felipe Balbi<[email protected]>
*
* This program is free software: you can redistribute it and/or
modify
* it under the terms of the GNU General Public License version 2 of
* the License as published by the Free Software Foundation.
If Felipe don't mind then he should give you the permission to add + to the GPL2.
Quoted 223 lines
+ */
drivers/usb/gadget/udc-core.c new file +17
-0+ +#include <linux/compat.h> +#include <malloc.h> +#include <asm/cache.h> +#include <common.h> + +#include <linux/usb/ch9.h> +#include <linux/usb/gadget.h> + +/** +* struct usb_udc - describes one usb device controller +* @driver - the gadget driver pointer. For use by the class code +* @dev - the child device to the actual controller +* @gadget - the gadget. For use by the class code +* @list - for use by the udc class driver +* +* This represents the internal data structure which is used by the UDC-class
+ * to hold information about udc driver and gadget together.
+ */drivers/usb/gadget/udc-core.c new file +36
-0+struct usb_udc { +struct usb_gadget_driver *driver; +struct usb_gadget *gadget; +struct list_head list; +}; + +static LIST_HEAD (udc_list); + +void usb_gadget_set_state (struct usb_gadget *gadget, +enum usb_device_state state) +{ + gadget->state = state; +} + +/** +* usb_gadget_udc_start - tells usb device controller to start up +* @gadget: The gadget we want to get started +* @driver: The driver we want to bind to @gadget +* +* This call is issued by the UDC Class driver when it's about +* to register a gadget driver to the device controller, before +* calling gadget driver's bind() method. +* +* It allows the controller to be powered off until strictly +* necessary to have it powered on. +* +* Returns zero on success, else negative errno. +*/ +static inline int usb_gadget_udc_start (struct usb_gadget *gadget, +struct usb_gadget_driver *driver) +{ +return gadget->ops->udc_start (gadget, driver); +} + +/** +* usb_gadget_udc_stop - tells usb device controller we don't need it anymore
+ * @gadget: The device we want to stop activity
+ * @driver: The driver to unbind from @gadget
+ *
+ * This call is issued by the UDC Class driver after calling
+ * gadget driver'sunbind()method.
+ *
+ * The details are implementation specific, but it can go as
+ * far as powering off UDC completely and disable its data
+ * line pullups.
+ */drivers/usb/gadget/udc-core.c new file +8
-0+static inline void usb_gadget_udc_stop (struct usb_gadget *gadget, +struct usb_gadget_driver *driver) +{ + gadget->ops->udc_stop (gadget, driver); +} + +/** +* usb_add_gadget_udc_release - adds a new gadget to the udc class driver list
+ * @parent: the parent device to this udc. Usually the controller driver's
+ * device.
+ * @gadget: the gadget to be added to the list.
+ * @release: a gadget release function.
+ *
+ * Returns zero on success, negative errno otherwise.
+ */drivers/usb/gadget/udc-core.c new file +17
-0+int usb_add_gadget_udc_release (struct usb_gadget *gadget) +{ +struct usb_udc *udc; +int ret = -ENOMEM ; + + udc =kzalloc (sizeof (*udc),GFP_KERNEL ); +if (!udc) +return ret; + + udc->gadget = gadget; +list_add_tail (&udc->list, &udc_list); +usb_gadget_set_state (gadget,USB_STATE_NOTATTACHED ); +return 0 ; +} + +/** +* usb_add_gadget_udc - adds a new gadget to the udc class driver list
+ * @parent: the parent device to this udc. Usually the controller
+ * driver's device.
+ * @gadget: the gadget to be added to the list
+ *
+ * Returns zero on success, negative errno otherwise.
+ */drivers/usb/gadget/udc-core.c new file +46
-0+int usb_add_gadget_udc (struct usb_gadget *gadget) +{ +return usb_add_gadget_udc_release (gadget); +} + +static void usb_gadget_remove_driver (struct usb_udc *udc) +{ +dev_dbg (&udc->dev,"unregistering UDC driver [%s]\n" , + udc->gadget->name); +usb_gadget_disconnect (udc->gadget); + udc->driver->disconnect (udc->gadget); + udc->driver->unbind (udc->gadget); +usb_gadget_udc_stop (udc->gadget,NULL ); + + udc->driver =NULL ; +} + +/** +* usb_del_gadget_udc - deletes @udc from udc_list +* @gadget: the gadget to be removed. +* +* This, will call usb_gadget_unregister_driver() if +* the @udc is still busy. +*/ +void usb_del_gadget_udc (struct usb_gadget *gadget) +{ +struct usb_udc *udc =NULL ; +list_for_each_entry (udc, &udc_list, list) +if (udc->gadget == gadget) + goto found; + +dev_err (gadget->dev.parent,"gadget not registered.\n" ); +return ; + +found: +dev_vdbg (gadget->dev.parent,"unregistering gadget\n" ); + +list_del (&udc->list); + +if (udc->driver) +usb_gadget_remove_driver (udc); + +kfree (udc); +} + +static int udc_bind_to_driver(struct usb_udc *udc, struct
usb_gadget_driver*driver) +{drivers/usb/gadget/udc-core.c new file +67
-0+int ret; + +dev_dbg (&udc->dev,"registering UDC driver [%s]\n" , + driver->function); + + udc->driver = driver; + + ret = driver->bind (udc->gadget); +if (ret) + goto err1; + + ret =usb_gadget_udc_start (udc->gadget, driver); +if (ret) { + driver->unbind (udc->gadget); + goto err1; + } +usb_gadget_connect (udc->gadget); + +return 0 ; +err1: +if (ret != -EISNAM ) +dev_err (&udc->dev,"failed to start %s: %d\n" , + udc->driver->function, ret); + udc->driver =NULL ; +return ret; +} + +int usb_gadget_register_driver (struct usb_gadget_driver *driver) +{ +struct usb_udc *udc =NULL ; +int ret; + +if (!driver || !driver->bind || !driver->setup) +return -EINVAL ; + +list_for_each_entry (udc, &udc_list, list) { +/* For now we take the first one */ +if (!udc->driver) + goto found; + } + +debug ("couldn't find an available UDC\n" ); +return -ENODEV ; +found: + ret =udc_bind_to_driver (udc, driver); +return ret; +} + +int usb_gadget_unregister_driver (struct usb_gadget_driver *driver) +{ +struct usb_udc *udc =NULL ; +int ret = -ENODEV ; + +if (!driver || !driver->unbind) +return -EINVAL ; + +list_for_each_entry (udc, &udc_list, list) +if (udc->driver == driver) { +usb_gadget_remove_driver (udc); +usb_gadget_set_state (udc->gadget, +USB_STATE_NOTATTACHED ); + ret =0 ; +break ; + } + +return ret; +}
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
RFC PATCH 2/13 usb: gadget: udc-core: Add minimal udc-core from linux kernel
Quoted 37 lines · Lukasz Majewski
Quoted 11 lines
(quoted diff) +0
-0
b/drivers/usb/gadget/udc-core.cnew file mode 100644 index 0000000..bbe919cdrivers/usb/gadget/udc-core.c new file +4
-0@@ -0,0 +1,229 @@ +/** +* udc-core.c - Core UDC Framework +* +* Copyright (C) 2014 Texas Instruments Incorporated - Quoted 8 lines
+ *
+ * Author: Felipe Balbi <[email protected]>
+ *
+ * Taken from Linux Kernel v3.16 (drivers/usb/gadget/udc-core.c) and ported
+ * to uboot.
+ *
+ * SPDX-License-Identifier: GPL-2.0+It seems like the author is the same, but the GPL license is different:
Original file
./drivers/usb/gadget/udc/udc-core.c/**
*udc.c- Core UDCFramework
*
* Copyright (C) 2010 TexasInstruments
* Author: Felipe Balbi<[email protected]>
*
* This program is free software: you can redistribute it and/or
modify
* it under the terms of the GNU General Public License version 2 of
* the License as published by the Free Software Foundation.
Quoted 2 lines
If Felipe don't mind then he should give you the permission to add + to the GPL2.
I mind :-)
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140819/a89e8b6b/attachment.pgp>
RFC PATCH 2/13 usb: gadget: udc-core: Add minimal udc-core from linux kernel
In reply to Lukasz MajewskiHi Lukasz,
Quoted 6 lines · Lukasz Majewski
Hi Kishon,
Quoted 2 lines
In order to support multiple USB device controllers in uboot, udc-core is needed.
Is it? In u-boot at best only one UDC is operational at a time.
I didn't mean operational at the same time. dra7xx has 4 USB controllers and we should allow the user to use any USB port for DFU.
The current DFU code re-initializes the controller every time, but that can be optimized.
Quoted 8 lines
Quoted 4 lines
udc-core also helps to cleanly link the USB peripheral driver with the gadget driver. Hence Ported minimal udc-core from linux kernel.
I'd appreciate the exact SHA for this
udc-core.ccode. And the SHA should be from some already released mainline code (like final 3.16), not any private branch nor linux-next.
We can't have the exact udc-core.c from linux kernel as it deals with kernel driver model stuff and vfs which is not needed for kernel. Trying to have the exact same code from kernel complicates it.
Thanks
Kishon
Quoted 287 lines
Quoted 32 lines
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/udc-core.c | 229++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 230 insertions(+) create mode 100644
drivers/usb/gadget/udc-core.cdrivers/usb/gadget/Makefile +1
-0@@ -19,6 +19,7 @@ obj-$(CONFIG_USBDOWNLOAD_GADGET) += g_dnl.o obj-$(CONFIG_DFU_FUNCTION) += f_dfu.o obj-$(CONFIG_USB_GADGET_MASS_STORAGE) += f_mass_storage.o obj-$(CONFIG_CMD_FASTBOOT) += f_fastboot.o +obj-y += udc-core.o endif ifdef CONFIG_USB_ETHER obj-y += ether.o(quoted diff) +0
-0
b/drivers/usb/gadget/udc-core.cnew file mode 100644 index 0000000..bbe919cdrivers/usb/gadget/udc-core.c new file +4
-0@@ -0,0 +1,229 @@ +/** +* udc-core.c - Core UDC Framework +* +* Copyright (C) 2014 Texas Instruments Incorporated - Quoted 8 lines
+ *
+ * Author: Felipe Balbi <[email protected]>
+ *
+ * Taken from Linux Kernel v3.16 (drivers/usb/gadget/udc-core.c) and ported
+ * to uboot.
+ *
+ * SPDX-License-Identifier: GPL-2.0+It seems like the author is the same, but the GPL license is different:
Original file
./drivers/usb/gadget/udc/udc-core.c/**
*udc.c- Core UDCFramework
*
* Copyright (C) 2010 TexasInstruments
* Author: Felipe Balbi<[email protected]>
*
* This program is free software: you can redistribute it and/or
modify
* it under the terms of the GNU General Public License version 2 of
* the License as published by the Free Software Foundation.If Felipe don't mind then he should give you the permission to add + to the GPL2.
Quoted 223 lines
+ */
drivers/usb/gadget/udc-core.c new file +17
-0+ +#include <linux/compat.h> +#include <malloc.h> +#include <asm/cache.h> +#include <common.h> + +#include <linux/usb/ch9.h> +#include <linux/usb/gadget.h> + +/** +* struct usb_udc - describes one usb device controller +* @driver - the gadget driver pointer. For use by the class code +* @dev - the child device to the actual controller +* @gadget - the gadget. For use by the class code +* @list - for use by the udc class driver +* +* This represents the internal data structure which is used by the UDC-class
+ * to hold information about udc driver and gadget together.
+ */drivers/usb/gadget/udc-core.c new file +36
-0+struct usb_udc { +struct usb_gadget_driver *driver; +struct usb_gadget *gadget; +struct list_head list; +}; + +static LIST_HEAD (udc_list); + +void usb_gadget_set_state (struct usb_gadget *gadget, +enum usb_device_state state) +{ + gadget->state = state; +} + +/** +* usb_gadget_udc_start - tells usb device controller to start up +* @gadget: The gadget we want to get started +* @driver: The driver we want to bind to @gadget +* +* This call is issued by the UDC Class driver when it's about +* to register a gadget driver to the device controller, before +* calling gadget driver's bind() method. +* +* It allows the controller to be powered off until strictly +* necessary to have it powered on. +* +* Returns zero on success, else negative errno. +*/ +static inline int usb_gadget_udc_start (struct usb_gadget *gadget, +struct usb_gadget_driver *driver) +{ +return gadget->ops->udc_start (gadget, driver); +} + +/** +* usb_gadget_udc_stop - tells usb device controller we don't need it anymore
+ * @gadget: The device we want to stop activity
+ * @driver: The driver to unbind from @gadget
+ *
+ * This call is issued by the UDC Class driver after calling
+ * gadget driver'sunbind()method.
+ *
+ * The details are implementation specific, but it can go as
+ * far as powering off UDC completely and disable its data
+ * line pullups.
+ */drivers/usb/gadget/udc-core.c new file +8
-0+static inline void usb_gadget_udc_stop (struct usb_gadget *gadget, +struct usb_gadget_driver *driver) +{ + gadget->ops->udc_stop (gadget, driver); +} + +/** +* usb_add_gadget_udc_release - adds a new gadget to the udc class driver list
+ * @parent: the parent device to this udc. Usually the controller driver's
+ * device.
+ * @gadget: the gadget to be added to the list.
+ * @release: a gadget release function.
+ *
+ * Returns zero on success, negative errno otherwise.
+ */drivers/usb/gadget/udc-core.c new file +17
-0+int usb_add_gadget_udc_release (struct usb_gadget *gadget) +{ +struct usb_udc *udc; +int ret = -ENOMEM ; + + udc =kzalloc (sizeof (*udc),GFP_KERNEL ); +if (!udc) +return ret; + + udc->gadget = gadget; +list_add_tail (&udc->list, &udc_list); +usb_gadget_set_state (gadget,USB_STATE_NOTATTACHED ); +return 0 ; +} + +/** +* usb_add_gadget_udc - adds a new gadget to the udc class driver list
+ * @parent: the parent device to this udc. Usually the controller
+ * driver's device.
+ * @gadget: the gadget to be added to the list
+ *
+ * Returns zero on success, negative errno otherwise.
+ */drivers/usb/gadget/udc-core.c new file +46
-0+int usb_add_gadget_udc (struct usb_gadget *gadget) +{ +return usb_add_gadget_udc_release (gadget); +} + +static void usb_gadget_remove_driver (struct usb_udc *udc) +{ +dev_dbg (&udc->dev,"unregistering UDC driver [%s]\n" , + udc->gadget->name); +usb_gadget_disconnect (udc->gadget); + udc->driver->disconnect (udc->gadget); + udc->driver->unbind (udc->gadget); +usb_gadget_udc_stop (udc->gadget,NULL ); + + udc->driver =NULL ; +} + +/** +* usb_del_gadget_udc - deletes @udc from udc_list +* @gadget: the gadget to be removed. +* +* This, will call usb_gadget_unregister_driver() if +* the @udc is still busy. +*/ +void usb_del_gadget_udc (struct usb_gadget *gadget) +{ +struct usb_udc *udc =NULL ; +list_for_each_entry (udc, &udc_list, list) +if (udc->gadget == gadget) + goto found; + +dev_err (gadget->dev.parent,"gadget not registered.\n" ); +return ; + +found: +dev_vdbg (gadget->dev.parent,"unregistering gadget\n" ); + +list_del (&udc->list); + +if (udc->driver) +usb_gadget_remove_driver (udc); + +kfree (udc); +} + +static int udc_bind_to_driver(struct usb_udc *udc, struct
usb_gadget_driver*driver) +{drivers/usb/gadget/udc-core.c new file +67
-0+int ret; + +dev_dbg (&udc->dev,"registering UDC driver [%s]\n" , + driver->function); + + udc->driver = driver; + + ret = driver->bind (udc->gadget); +if (ret) + goto err1; + + ret =usb_gadget_udc_start (udc->gadget, driver); +if (ret) { + driver->unbind (udc->gadget); + goto err1; + } +usb_gadget_connect (udc->gadget); + +return 0 ; +err1: +if (ret != -EISNAM ) +dev_err (&udc->dev,"failed to start %s: %d\n" , + udc->driver->function, ret); + udc->driver =NULL ; +return ret; +} + +int usb_gadget_register_driver (struct usb_gadget_driver *driver) +{ +struct usb_udc *udc =NULL ; +int ret; + +if (!driver || !driver->bind || !driver->setup) +return -EINVAL ; + +list_for_each_entry (udc, &udc_list, list) { +/* For now we take the first one */ +if (!udc->driver) + goto found; + } + +debug ("couldn't find an available UDC\n" ); +return -ENODEV ; +found: + ret =udc_bind_to_driver (udc, driver); +return ret; +} + +int usb_gadget_unregister_driver (struct usb_gadget_driver *driver) +{ +struct usb_udc *udc =NULL ; +int ret = -ENODEV ; + +if (!driver || !driver->unbind) +return -EINVAL ; + +list_for_each_entry (udc, &udc_list, list) +if (udc->driver == driver) { +usb_gadget_remove_driver (udc); +usb_gadget_set_state (udc->gadget, +USB_STATE_NOTATTACHED ); + ret =0 ; +break ; + } + +return ret; +}
RFC PATCH 2/13 usb: gadget: udc-core: Add minimal udc-core from linux kernel
Quoted 5 lines · Kishon Vijay Abraham I
Hi Lukasz,
Quoted 2 lines · Lukasz Majewski
Hi Kishon,
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
In order to support multiple USB device controllers in uboot, udc-core is needed.
Is it? In u-boot at best only one UDC is operational at a time.
I didn't mean operational at the same time. dra7xx has 4 USB controllers and we should allow the user to use any USB port for DFU.
but from u-boot's perspective, that can (should?) be a build-time choice. That user, certainly, won't need more than one port active for booting, right ?
Quoted 11 lines
Quoted 7 lines
Quoted 3 lines
udc-core also helps to cleanly link the USB peripheral driver with the gadget driver. Hence Ported minimal udc-core from linux kernel.
I'd appreciate the exact SHA for this
udc-core.ccode. And the SHA should be from some already released mainline code (like final 3.16), not any private branch nor linux-next.We can't have the exact
udc-core.cfrom linux kernel as it deals with kernel driver model stuff and vfs which is not needed for kernel. Trying to have the exact same code from kernel complicates it.
what he means is to point to the SHA1 when you originally forked the code from kernel. Sure udc-core can't be the same, but you based off of a known commit ID frmo the kernel.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140819/93e1387e/attachment.pgp>
RFC PATCH 2/13 usb: gadget: udc-core: Add minimal udc-core from linux kernel
Hi Felipe, Kishon
Quoted 12 lines
Quoted 10 lines · Kishon Vijay Abraham I
Hi Lukasz,
Quoted 6 lines · Lukasz Majewski
Hi Kishon,
Quoted 2 lines
In order to support multiple USB device controllers in uboot, udc-core is needed.
Is it? In u-boot at best only one UDC is operational at a time.
Quoted 7 lines
Quoted 3 lines
I didn't mean operational at the same time. dra7xx has 4 USB controllers and we should allow the user to use any USB port for DFU.
but from u-boot's perspective, that can (should?) be a build-time choice. That user, certainly, won't need more than one port active for booting, right ?
This is my point. We are working with the bootloader. Some things here are set at board configuration and aren't changed afterwards (like only UDC 0 output is wired out).
The dfu/ums commands give you the ability to specify controller if you need such option.
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
udc-core also helps to cleanly link the USB peripheral driver with the gadget driver. Hence Ported minimal udc-core from linux kernel.
I'd appreciate the exact SHA for this
udc-core.ccode. And the SHA should be from some already released mainline code (like final 3.16), not any private branch nor linux-next.
Quoted 9 lines
Quoted 4 lines
We can't have the exact
udc-core.cfrom linux kernel as it deals with kernel driver model stuff and vfs which is not needed for kernel. Trying to have the exact same code from kernel complicates it.what he means is to point to the SHA1 when you originally forked the code from kernel. Sure udc-core can't be the same, but you based off of a known commit ID frmo the kernel.
+1
The best way is to grab original source from mailine kernel, and then provide patch which adjust it. In this way we have clean trace from where the code comes.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
RFC PATCH 2/13 usb: gadget: udc-core: Add minimal udc-core from linux kernel
In reply to Felipe BalbiQuoted 9 lines · Felipe Balbi
Quoted 8 lines · Kishon Vijay Abraham I
Hi Lukasz,
Quoted 5 lines · Lukasz Majewski
Hi Kishon,
Quoted 2 lines
In order to support multiple USB device controllers in uboot, udc-core is needed.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Is it? In u-boot at best only one UDC is operational at a time.
I didn't mean operational at the same time. dra7xx has 4 USB controllers and we should allow the user to use any USB port for DFU.
but from u-boot's perspective, that can (should?) be a build-time choice. That user, certainly, won't need more than one port active for booting, right ?
hmm.. right now I don't think any one needs more than one port. But then without udc core, we have to maintain global variable in gadget.c. Maybe slightly cleaner way is to use udc..
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 4 lines
udc-core also helps to cleanly link the USB peripheral driver with the gadget driver. Hence Ported minimal udc-core from linux kernel.
I'd appreciate the exact SHA for this
udc-core.ccode. And the SHA should be from some already released mainline code (like final 3.16), not any private branch nor linux-next.
Quoted 7 lines
Quoted 3 lines
We can't have the exact
udc-core.cfrom linux kernel as it deals with kernel driver model stuff and vfs which is not needed for kernel. Trying to have the exact same code from kernel complicates it.what he means is to point to the SHA1 when you originally forked the code from kernel. Sure udc-core can't be the same, but you based off of a known commit ID frmo the kernel.
Ah ok. The header of the file gives the gives the kernel tag it is forked from. Maybe add that in commit log to?
-Kishon
Quoted 1 line
RFC PATCH 2/13 usb: gadget: udc-core: Add minimal udc-core from linux kernel
Hi Kishon,
Quoted 19 lines · Felipe Balbi
Quoted 16 lines
Quoted 13 lines · Kishon Vijay Abraham I
Hi Lukasz,
Quoted 6 lines · Lukasz Majewski
Hi Kishon,
Quoted 2 lines
In order to support multiple USB device controllers in uboot, udc-core is needed.
Is it? In u-boot at best only one UDC is operational at a time.
I didn't mean operational at the same time. dra7xx has 4 USB controllers and we should allow the user to use any USB port for DFU.
Quoted 5 lines
Quoted 3 lines
but from u-boot's perspective, that can (should?) be a build-time choice. That user, certainly, won't need more than one port active for booting, right ?
hmm.. right now I don't think any one needs more than one port.
Please look into the dfu/ums commands interface. There is a possibility to set the controller for transmission.
Quoted 2 lines
But then without udc core, we have to maintain global variable in
gadget.c. Maybe slightly cleaner way is to use udc..
I don't mind taking code from linux kernel, but I'm concerned about the complexity and accepting the dead code. The composite.c was taken from 2.6.36 on purpose - it was the smallest working code in the linux kernel.
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Quoted 8 lines
Quoted 4 lines
udc-core also helps to cleanly link the USB peripheral driver with the gadget driver. Hence Ported minimal udc-core from linux kernel.
I'd appreciate the exact SHA for this
udc-core.ccode. And the SHA should be from some already released mainline code (like final 3.16), not any private branch nor linux-next.We can't have the exact
udc-core.cfrom linux kernel as it deals with kernel driver model stuff and vfs which is not needed for kernel. Trying to have the exact same code from kernel complicates it.
Quoted 6 lines
Quoted 3 lines
what he means is to point to the SHA1 when you originally forked the code from kernel. Sure udc-core can't be the same, but you based off of a known commit ID frmo the kernel.
Ah ok. The header of the file gives the gives the kernel tag it is forked from. Maybe add that in commit log to?
Please for example refer to: SHA1: dee1d99973 and b4d36f6
Quoted 4 lines
-Kishon
Quoted 1 line
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
RFC PATCH 3/13 ARM: DRA7: Enable clocks for USB OTGSS and USB PHY
In reply to Kishon Vijay Abraham IEnabled clocks for dwc3 controller and USB PHY present in DRA7.
--- arch/arm/cpu/armv7/omap5/hw_data.c | 14 ++++++++++++++ arch/arm/cpu/armv7/omap5/prcm-regs.c | 6 ++++-- arch/arm/include/asm/omap_common.h | 4 ++-- 3 files changed, 20 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/omap5/hw_data.c +14 -0
@@ -434,6 +434,10 @@ void enable_basic_clocks(void) (*prcm)->cm_l4per_gpio6_clkctrl, (*prcm)->cm_l4per_gpio7_clkctrl, (*prcm)->cm_l4per_gpio8_clkctrl, +#ifdef CONFIG_USB_DWC3 + (*prcm)->cm_l3init_ocp2scp1_clkctrl, + (*prcm)->cm_l3init_usb_otg_ss1_clkctrl, +#endif 0 };
@@ -465,6 +469,16 @@ void enable_basic_clocks(void)setbits_le32 ((*prcm)->cm_l3init_hsmmc2_clkctrl,HSMMC_CLKCTRL_CLKSEL_MASK ); +#ifdef CONFIG_USB_DWC3 +/* Enable 960 MHz clock for dwc3 */ +setbits_le32 ((*prcm)->cm_l3init_usb_otg_ss1_clkctrl, +OPTFCLKEN_REFCLK960M ); + +/* Enable 32 KHz clock for dwc3 */ +setbits_le32 ((*prcm)->cm_coreaon_usb_phy1_core_clkctrl, +USBPHY_CORE_CLKCTRL_OPTFCLKEN_CLK32K ); +#endif +/* Set the correct clock dividers for mmc */ setbits_le32 ((*prcm)->cm_l3init_hsmmc1_clkctrl,HSMMC_CLKCTRL_CLKSEL_DIV_MASK );
arch/arm/cpu/armv7/omap5/prcm-regs.c +4 -2
@@ -574,7 +574,7 @@ struct prcm_regs const omap5_es2_prcm = { .cm_div_m2_dpll_unipro = 0x4a0081d0, .cm_ssc_deltamstep_dpll_unipro = 0x4a0081e8, .cm_ssc_modfreqdiv_dpll_unipro = 0x4a0081ec, - .cm_coreaon_usb_phy_core_clkctrl = 0x4A008640, + .cm_coreaon_usb_phy1_core_clkctrl = 0x4A008640, .cm_coreaon_bandgap_clkctrl = 0x4a008648, .cm_coreaon_io_srcomp_clkctrl = 0x4a008650,
@@ -708,7 +708,7 @@ struct prcm_regs const omap5_es2_prcm = { .cm_l3init_fsusb_clkctrl = 0x4a0096d0, .cm_l3init_ocp2scp1_clkctrl = 0x4a0096e0, .cm_l3init_ocp2scp3_clkctrl = 0x4a0096e8, - .cm_l3init_usb_otg_ss_clkctrl = 0x4a0096f0, + .cm_l3init_usb_otg_ss1_clkctrl = 0x4a0096f0,/* prm irqstatus regs */ .prm_irqstatus_mpu_2 = 0x4ae06014,
@@ -800,6 +800,7 @@ struct prcm_regs const dra7xx_prcm = { .cm_clkmode_dpll_dsp = 0x4a005234, .cm_shadow_freq_config1 = 0x4a005260, .cm_clkmode_dpll_gmac = 0x4a0052a8, + .cm_coreaon_usb_phy1_core_clkctrl = 0x4a008640, .cm_coreaon_usb_phy2_core_clkctrl = 0x4a008688,/* cm1.mpu */
@@ -906,6 +907,7 @@ struct prcm_regs const dra7xx_prcm = { .cm_gmac_gmac_clkctrl = 0x4a0093d0, .cm_l3init_ocp2scp1_clkctrl = 0x4a0093e0, .cm_l3init_ocp2scp3_clkctrl = 0x4a0093e8, + .cm_l3init_usb_otg_ss1_clkctrl = 0x4a0093f0,/* cm2.l4per */ .cm_l4per_clkstctrl = 0x4a009700,
arch/arm/include/asm/omap_common.h +2 -2
@@ -143,7 +143,7 @@ struct prcm_regs {u32 cm_div_m2_dpll_unipro;u32 cm_ssc_deltamstep_dpll_unipro;u32 cm_ssc_modfreqdiv_dpll_unipro; -u32 cm_coreaon_usb_phy_core_clkctrl; +u32 cm_coreaon_usb_phy1_core_clkctrl;u32 cm_coreaon_usb_phy2_core_clkctrl;/* cm2.core */
@@ -230,7 +230,7 @@ struct prcm_regs {u32 cm_l3init_fsusb_clkctrl;u32 cm_l3init_ocp2scp1_clkctrl;u32 cm_l3init_ocp2scp3_clkctrl; -u32 cm_l3init_usb_otg_ss_clkctrl; +u32 cm_l3init_usb_otg_ss1_clkctrl;u32 prm_irqstatus_mpu_2;
Signature · 1 line
1.9.1
RFC PATCH 4/13 usb: dwc3: Add dwc3 driver
In reply to Kishon Vijay Abraham IPorted dwc3 driver from linux kernel to uboot.
--- Makefile | 1 + drivers/usb/dwc3/Makefile | 7 + drivers/usb/dwc3/core.c | 640 +++++++++ drivers/usb/dwc3/core.h | 961 +++++++++++++ drivers/usb/dwc3/ep0.c | 1045 ++++++++++++++ drivers/usb/dwc3/gadget.c | 2841 +++++++++++++++++++++++++++++++++++++++ drivers/usb/dwc3/gadget.h | 163 +++ drivers/usb/dwc3/io.h | 52 + drivers/usb/dwc3/linux-compat.h | 132 ++ include/dwc3-uboot.h | 26 + 10 files changed, 5868 insertions(+) create mode 100644 drivers/usb/dwc3/Makefile create mode 100644 drivers/usb/dwc3/core.c create mode 100644 drivers/usb/dwc3/core.h create mode 100644 drivers/usb/dwc3/ep0.c create mode 100644 drivers/usb/dwc3/gadget.c create mode 100644 drivers/usb/dwc3/gadget.h create mode 100644 drivers/usb/dwc3/io.h create mode 100644 drivers/usb/dwc3/linux-compat.h create mode 100644 include/dwc3-uboot.h
Makefile +1 -0
@@ -645,6 +645,7 @@ libs-y += drivers/spi/ libs-$(CONFIG_FMAN_ENET) += drivers/net/fm/ libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/ libs-y += drivers/serial/ +libs-y += drivers/usb/dwc3/ libs-y += drivers/usb/eth/ libs-y += drivers/usb/gadget/ libs-y += drivers/usb/host/
drivers/usb/dwc3/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +ccflags-$(CONFIG_USB_DWC3_DEBUG) := -DDEBUG +ccflags-$(CONFIG_USB_DWC3_VERBOSE) += -DVERBOSE_DEBUG + +obj-$(CONFIG_USB_DWC3) += dwc3.o + +dwc3-y := core.o +dwc3-$(CONFIG_USB_DWC3_GADGET) += gadget.o ep0.o
drivers/usb/dwc3/core.c new file +640 -0
640 lines not on this page · raw message
drivers/usb/dwc3/core.h new file +961 -0
961 lines not on this page · raw message
drivers/usb/dwc3/ep0.c new file +1045 -0
1,045 lines not on this page · raw message
drivers/usb/dwc3/gadget.c new file +2841 -0
340 lines not on this page · raw message
drivers/usb/dwc3/gadget.h new file +163 -0
163 lines not on this page · raw message
drivers/usb/dwc3/io.h new file +52 -0
52 lines not on this page · raw message
drivers/usb/dwc3/linux-compat.h new file +132 -0
132 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.9.1
Part of the diff is not shown here. View the raw message.
RFC PATCH 4/13 usb: dwc3: Add dwc3 driver
Quoted 58 lines · Kishon Vijay Abraham I
Ported dwc3 driver from linux kernel to uboot.
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- Makefile | 1 + drivers/usb/dwc3/Makefile | 7 + drivers/usb/dwc3/core.c | 640 +++++++++ drivers/usb/dwc3/core.h | 961 +++++++++++++ drivers/usb/dwc3/ep0.c | 1045 ++++++++++++++ drivers/usb/dwc3/gadget.c | 2841 +++++++++++++++++++++++++++++++++++++++ drivers/usb/dwc3/gadget.h | 163 +++ drivers/usb/dwc3/io.h | 52 + drivers/usb/dwc3/linux-compat.h | 132 ++ include/dwc3-uboot.h | 26 + 10 files changed, 5868 insertions(+) create mode 100644 drivers/usb/dwc3/Makefile create mode 100644 drivers/usb/dwc3/core.c create mode 100644 drivers/usb/dwc3/core.h create mode 100644 drivers/usb/dwc3/ep0.c create mode 100644 drivers/usb/dwc3/gadget.c create mode 100644 drivers/usb/dwc3/gadget.h create mode 100644 drivers/usb/dwc3/io.h create mode 100644 drivers/usb/dwc3/linux-compat.h create mode 100644 include/dwc3-uboot.hMakefile +1
-0@@ -645,6 +645,7 @@ libs-y += drivers/spi/ libs-$(CONFIG_FMAN_ENET) += drivers/net/fm/ libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/ libs-y += drivers/serial/ +libs-y += drivers/usb/dwc3/ libs-y += drivers/usb/eth/ libs-y += drivers/usb/gadget/ libs-y += drivers/usb/host/drivers/usb/dwc3/Makefile new file +7
-0@@ -0,0 +1,7 @@ +ccflags-$(CONFIG_USB_DWC3_DEBUG) := -DDEBUG +ccflags-$(CONFIG_USB_DWC3_VERBOSE) += -DVERBOSE_DEBUG + +obj-$(CONFIG_USB_DWC3) += dwc3.o + +dwc3-y := core.o +dwc3-$(CONFIG_USB_DWC3_GADGET) += gadget.o ep0.odrivers/usb/dwc3/core.c new file +2
-0@@ -0,0 +1,640 @@ +/** +* core.c - DesignWare USB3 DRD Controller Core file
drivers/usb/dwc3/core.c line 12
Quoted 10 lines
drivers/usb/dwc3/core.c new file +10
-0+* +* Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com +* +* Authors: Felipe Balbi <[email protected]>, +* Sebastian Andrzej Siewior <[email protected]> +* +* Taken from Linux Kernel v3.16 (drivers/usb/dwc3/core.c) and ported +* to uboot. +* +* SPDX-License-Identifier: GPL-2.0+
same here. Please review all patches to make sure license is correct.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140818/b72ef901/attachment.pgp>
RFC PATCH 4/13 usb: dwc3: Add dwc3 driver
Quoted 63 lines · Felipe Balbi
Quoted 62 lines · Kishon Vijay Abraham I
Ported dwc3 driver from linux kernel to uboot.
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- Makefile | 1 + drivers/usb/dwc3/Makefile | 7 + drivers/usb/dwc3/core.c | 640 +++++++++ drivers/usb/dwc3/core.h | 961 +++++++++++++ drivers/usb/dwc3/ep0.c | 1045 ++++++++++++++ drivers/usb/dwc3/gadget.c | 2841 +++++++++++++++++++++++++++++++++++++++ drivers/usb/dwc3/gadget.h | 163 +++ drivers/usb/dwc3/io.h | 52 + drivers/usb/dwc3/linux-compat.h | 132 ++ include/dwc3-uboot.h | 26 + 10 files changed, 5868 insertions(+) create mode 100644 drivers/usb/dwc3/Makefile create mode 100644 drivers/usb/dwc3/core.c create mode 100644 drivers/usb/dwc3/core.h create mode 100644 drivers/usb/dwc3/ep0.c create mode 100644 drivers/usb/dwc3/gadget.c create mode 100644 drivers/usb/dwc3/gadget.h create mode 100644 drivers/usb/dwc3/io.h create mode 100644 drivers/usb/dwc3/linux-compat.h create mode 100644 include/dwc3-uboot.hMakefile +1
-0@@ -645,6 +645,7 @@ libs-y += drivers/spi/ libs-$(CONFIG_FMAN_ENET) += drivers/net/fm/ libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/ libs-y += drivers/serial/ +libs-y += drivers/usb/dwc3/ libs-y += drivers/usb/eth/ libs-y += drivers/usb/gadget/ libs-y += drivers/usb/host/drivers/usb/dwc3/Makefile new file +7
-0@@ -0,0 +1,7 @@ +ccflags-$(CONFIG_USB_DWC3_DEBUG) := -DDEBUG +ccflags-$(CONFIG_USB_DWC3_VERBOSE) += -DVERBOSE_DEBUG + +obj-$(CONFIG_USB_DWC3) += dwc3.o + +dwc3-y := core.o +dwc3-$(CONFIG_USB_DWC3_GADGET) += gadget.o ep0.odrivers/usb/dwc3/core.c new file +6
-0@@ -0,0 +1,640 @@ +/** +* core.c - DesignWare USB3 DRD Controller Core file +* +* Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com +* +* Authors: Felipe Balbi <[email protected]>,
Quoted 8 lines
drivers/usb/dwc3/core.c line 12
Quoted 6 lines
drivers/usb/dwc3/core.c new file +6
-0+* Sebastian Andrzej Siewior <[email protected]> +* +* Taken from Linux Kernel v3.16 (drivers/usb/dwc3/core.c) and ported +* to uboot. +* +* SPDX-License-Identifier: GPL-2.0+ same here. Please review all patches to make sure license is correct.
sure.
Thanks
Kishon
Quoted 1 line
RFC PATCH 5/13 usb: dwc3-omap: Add dwc3 glue driver for OMAP
In reply to Kishon Vijay Abraham IPorted dwc3-omap driver from linux kernel to uboot.
--- drivers/usb/dwc3/Makefile | 2 + drivers/usb/dwc3/dwc3-omap.c | 447 ++++++++++++++++++++++++++++++++++++++++++ include/dwc3-omap-uboot.h | 32 +++ include/linux/usb/dwc3-omap.h | 19 ++ 4 files changed, 500 insertions(+) create mode 100644 drivers/usb/dwc3/dwc3-omap.c create mode 100644 include/dwc3-omap-uboot.h create mode 100644 include/linux/usb/dwc3-omap.h
drivers/usb/dwc3/Makefile +2 -0
@@ -5,3 +5,5 @@ obj-$(CONFIG_USB_DWC3) += dwc3.o dwc3-y := core.o dwc3-$(CONFIG_USB_DWC3_GADGET) += gadget.o ep0.o + +obj-$(CONFIG_USB_DWC3_OMAP) += dwc3-omap.o
drivers/usb/dwc3/dwc3-omap.c new file +447 -0
447 lines not on this page · raw message
include/dwc3-omap-uboot.h new file +32 -0
@@ -0,0 +1,32 @@ +/* include/dwc3_omap_uboot.h +* +* Copyright (c) 2014 Texas Instruments Incorporated - http://www.ti.com +* +* Designware SuperSpeed OMAP Glue uboot init +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __DWC3_OMAP_UBOOT_H_ +#define __DWC3_OMAP_UBOOT_H_ + +#include <linux/usb/dwc3-omap.h> + +enum omap_dwc3_vbus_id_status { +OMAP_DWC3_ID_FLOAT , +OMAP_DWC3_ID_GROUND , +OMAP_DWC3_VBUS_OFF , +OMAP_DWC3_VBUS_VALID , +}; + +struct dwc3_omap_device { +void *base; +int index; +enum dwc3_omap_utmi_mode utmi_mode; +enum omap_dwc3_vbus_id_status vbus_id_status; +}; + +int dwc3_omap_uboot_init (struct dwc3_omap_device *dev); +void dwc3_omap_uboot_exit (int index); +int dwc3_omap_uboot_interrupt_status (int index); +#endif /* __DWC3_OMAP_UBOOT_H_ */
include/linux/usb/dwc3-omap.h new file +19 -0
@@ -0,0 +1,19 @@ +/* include/linux/usb/dwc3-omap.h +* +* Copyright (c) 2014 Texas Instruments Incorporated - http://www.ti.com +* +* Designware SuperSpeed Glue +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __DWC3_OMAP_H_ +#define __DWC3_OMAP_H_ + +enum dwc3_omap_utmi_mode { +DWC3_OMAP_UTMI_MODE_UNKNOWN =0 , +DWC3_OMAP_UTMI_MODE_HW , +DWC3_OMAP_UTMI_MODE_SW , +}; + +#endif /* __DWC3_OMAP_H_ */
Signature · 1 line
1.9.1
RFC PATCH 6/13 usb: dwc3: TI PHY: PHY driver for dwc3 in TI platforms
In reply to Kishon Vijay Abraham IAdded a single driver for both USB2 PHY programming and USB3 PHY programming.
--- drivers/usb/dwc3/Makefile | 1 + drivers/usb/dwc3/ti_usb_phy.c | 269 ++++++++++++++++++++++++++++++++++++++++++ include/ti-usb-phy-uboot.h | 22 ++++ 3 files changed, 292 insertions(+) create mode 100644 drivers/usb/dwc3/ti_usb_phy.c create mode 100644 include/ti-usb-phy-uboot.h
drivers/usb/dwc3/Makefile +1 -0
@@ -7,3 +7,4 @@ dwc3-y := core.o dwc3-$(CONFIG_USB_DWC3_GADGET) += gadget.o ep0.o obj-$(CONFIG_USB_DWC3_OMAP) += dwc3-omap.o +obj-$(CONFIG_USB_DWC3_PHY_OMAP) += ti_usb_phy.o
drivers/usb/dwc3/ti_usb_phy.c new file +269 -0
269 lines not on this page · raw message
include/ti-usb-phy-uboot.h new file +22 -0
@@ -0,0 +1,22 @@ +/* include/ti_usb_phy_uboot.h +* +* Copyright (c) 2014 Texas Instruments Incorporated - http://www.ti.com +* +* USB2 and USB3 PHY uboot init +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef __TI_USB_PHY_UBOOT_H_ +#define __TI_USB_PHY_UBOOT_H_ + +struct ti_usb_phy_device { +void *pll_ctrl_base; +void *usb2_phy_power; +void *usb3_phy_power; +int index; +}; + +int ti_usb_phy_uboot_init (struct ti_usb_phy_device *dev); +void ti_usb_phy_uboot_exit (int index); +#endif /* __TI_USB_PHY_UBOOT_H_ */
Signature · 1 line
1.9.1
RFC PATCH 7/13 usb: gadget: g_dnl: Explicitly set the max packet size in descriptor
In reply to Kishon Vijay Abraham IExplicity set the max packet size in the device descriptor to 0x40 as specified in the device class specification for device firmware upgrade. Also changed debug to printf to explicitly notify the user if the device has been enumerated.
--- drivers/usb/gadget/composite.c | 3 +-- drivers/usb/gadget/g_dnl.c | 1 + 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/composite.c +1 -2
@@ -331,7 +331,7 @@ static int set_config(struct usb_composite_dev *cdev, }else result =0 ; - debug("%s: %s speed config #%d: %s\n", __func__, + printf("%s: %s speed config #%d: %s\n", __func__, ({ char *speed; switch (gadget->speed) { case USB_SPEED_LOW:
@@ -987,7 +987,6 @@ static int composite_bind(struct usb_gadget *gadget)memcpy (&cdev->desc, composite->dev,sizeof (struct usb_device_descriptor )); - cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket;debug ("%s: ready\n" , composite->name);return 0 ;
drivers/usb/gadget/g_dnl.c +1 -0
@@ -59,6 +59,7 @@ static struct usb_device_descriptor device_desc = { .bcdUSB = __constant_cpu_to_le16(0x0200), .bDeviceClass = USB_CLASS_COMM, .bDeviceSubClass = 0x02, /*0x02:CDC-modem , 0x00:CDC-serial*/ + .bMaxPacketSize0 = 0x40, .idVendor = __constant_cpu_to_le16(CONFIG_G_DNL_VENDOR_NUM), .idProduct = __constant_cpu_to_le16(CONFIG_G_DNL_PRODUCT_NUM),
Signature · 1 line
1.9.1
RFC PATCH 7/13 usb: gadget: g_dnl: Explicitly set the max packet size in descriptor
Quoted 16 lines · Kishon Vijay Abraham I
Explicity set the max packet size in the device descriptor to
0x40as specified in the device class specification for device firmware upgrade. Also changed debug to printf to explicitly notify the user if the device has been enumerated.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/usb/gadget/composite.c | 3 +-- drivers/usb/gadget/g_dnl.c | 1 + 2 files changed, 2 insertions(+), 2 deletions(-)drivers/usb/gadget/composite.c +0
-0
drivers/usb/gadget/composite.c static int set_config(struct usb_composite_dev *cdev, · line 334
Quoted 5 lines
drivers/usb/gadget/composite.c +1
-1@@ -331,7 +331,7 @@ static int set_config(struct usb_composite_dev *cdev, }else result =0 ; - debug("%s: %s speed config #%d: %s\n", __func__, + printf("%s: %s speed config #%d: %s\n", __func__,
this looks like it's only needed for debugging. No strong feelings though
drivers/usb/gadget/composite.c static int composite_bind(struct usb_gadget *gadget) · line 990
Quoted 5 lines
drivers/usb/gadget/composite.c +0
-1@@ -987,7 +987,6 @@ static int composite_bind(struct usb_gadget *gadget)memcpy (&cdev->desc, composite->dev,sizeof (struct usb_device_descriptor )); - cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket;
why are you dropping this line ?
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140818/e9b17520/attachment.pgp>
RFC PATCH 7/13 usb: gadget: g_dnl: Explicitly set the max packet size in descriptor
Hi Kishon,
Quoted 6 lines
Quoted 4 lines · Kishon Vijay Abraham I
Explicity set the max packet size in the device descriptor to
0x40as specified in the device class specification for device firmware upgrade. Also changed debug to printf to explicitly notify the user if the device has been enumerated.
It seems like this patch has slipped without my attention.
Hence I'd like to ask why do you need to hardcode the 0x40 value?
Quoted 29 lines
Quoted 12 lines
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/usb/gadget/composite.c | 3 +-- drivers/usb/gadget/g_dnl.c | 1 + 2 files changed, 2 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/usb/gadget/composite.cindex 7bd2562..60ca9a5 100644drivers/usb/gadget/composite.c static int set_config(struct usb_composite_dev · line 334
Quoted 5 lines
drivers/usb/gadget/composite.c +1
-1@@ -331,7 +331,7 @@ static int set_config(struct usb_composite_dev *cdev, } else result =0 ; - debug("%s: %s speed config #%d: %s\n", __func__, + printf("%s: %s speed config #%d: %s\n", __func__,this looks like it's only needed for debugging. No strong feelings though
drivers/usb/gadget/composite.c static int composite_bind(struct usb_gadget · line 990
Quoted 5 lines
drivers/usb/gadget/composite.c +0
-1@@ -987,7 +987,6 @@ static int composite_bind(struct usb_gadget *gadget)memcpy (&cdev->desc, composite->dev,sizeof (struct usb_device_descriptor )); - cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket;why are you dropping this line ?
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
RFC PATCH 7/13 usb: gadget: g_dnl: Explicitly set the max packet size in descriptor
In reply to Felipe BalbiHi Kishon,
Quoted 4 lines
Quoted 4 lines
Explicity set the max packet size in the device descriptor to
0x40as specified in the device class specification for device firmware upgrade. Also changed debug to printf to explicitly notify the user if the device has been enumerated.
It seems like this patch slipped without my attention ...
Hence, I'd like to ask why you must hardcode the packet size here?
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
RFC PATCH 7/13 usb: gadget: g_dnl: Explicitly set the max packet size in descriptor
Quoted 10 lines · Lukasz Majewski
Hi Kishon,
Quoted 4 lines
Quoted 4 lines
Explicity set the max packet size in the device descriptor to
0x40as specified in the device class specification for device firmware upgrade. Also changed debug to printf to explicitly notify the user if the device has been enumerated.It seems like this patch slipped without my attention ...
Hence, I'd like to ask why you must hardcode the packet size here?
http://www.usb.org/developers/devclass_docs/usbdfu10.pdf (in section 4.2.1 DFU Mode Device Descriptor), specifies the bMaxPacketSize0 can be 8,16,32,64. And the value we get from gadget is 512. So hard coded it.
Thanks
Kishon
RFC PATCH 7/13 usb: gadget: g_dnl: Explicitly set the max packet size in descriptor
Quoted 10 lines · Kishon Vijay Abraham I
Quoted 7 lines · Lukasz Majewski
Hi Kishon,
Quoted 4 lines
Quoted 4 lines
Explicity set the max packet size in the device descriptor to
0x40as specified in the device class specification for device firmware upgrade. Also changed debug to printf to explicitly notify the user if the device has been enumerated.
Quoted 7 lines
Quoted 3 lines
It seems like this patch slipped without my attention ...
Hence, I'd like to ask why you must hardcode the packet size here?
http://www.usb.org/developers/devclass_docs/usbdfu10.pdf (in section 4.2.1 DFU Mode Device Descriptor), specifies the bMaxPacketSize0 can be 8,16,32,64. And the value we get from gadget is 512. So hard coded it.
as I mentioned, this should be changed on connection done interrupt. DFU has one of the poorest documentations for a USB Class and has some moronic definitions. What happens if you want ot run DFU with a superspeed controller (such as dwc3) when connected to a superspeed port. We cannot use ep0 packet size as 64, right ? That's why hardcoding is bad ;-)
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140819/743e097b/attachment.pgp>
RFC PATCH 7/13 usb: gadget: g_dnl: Explicitly set the max packet size in descriptor
Hi Felipe,
Quoted 14 lines
Quoted 12 lines · Kishon Vijay Abraham I
Quoted 9 lines · Lukasz Majewski
Hi Kishon,
Quoted 4 lines
Quoted 4 lines
Explicity set the max packet size in the device descriptor to
0x40as specified in the device class specification for device firmware upgrade. Also changed debug to printf to explicitly notify the user if the device has been enumerated.It seems like this patch slipped without my attention ...
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
Hence, I'd like to ask why you must hardcode the packet size here?
http://www.usb.org/developers/devclass_docs/usbdfu10.pdf (in section 4.2.1 DFU Mode Device Descriptor), specifies the bMaxPacketSize0 can be 8,16,32,64. And the value we get from gadget is 512. So hard coded it.
as I mentioned, this should be changed on connection done interrupt.
In the u-boot it is set up during binding the composite.
Quoted 2 lines
DFU has one of the poorest documentations for a USB Class and has some moronic definitions.
Frankly speaking I prefer to have the worst standard than some "brilliant" in house developed protocols.
Quoted 3 lines
What happens if you want ot run DFU with a
superspeed controller (such as dwc3) when connected to a superspeed port. We cannot use ep0 packet size as 64, right ?
Correct me if I'm wrong, but MaxPacket for SS ep0 is 2^9 = 512B. I'm curious if dfu-util will manage to handle ep0 MaxPacket size up to 512B.
It not, then we shall be able to fallback to 64B.
Quoted 3 lines
That's why
hardcoding is bad ;-)
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
RFC PATCH 7/13 usb: gadget: g_dnl: Explicitly set the max packet size in descriptor
Quoted 18 lines · Lukasz Majewski
Hi Felipe,
Quoted 16 lines
Quoted 14 lines · Kishon Vijay Abraham I
Quoted 10 lines · Lukasz Majewski
Hi Kishon,
Quoted 4 lines
Quoted 4 lines
Explicity set the max packet size in the device descriptor to
0x40as specified in the device class specification for device firmware upgrade. Also changed debug to printf to explicitly notify the user if the device has been enumerated.It seems like this patch slipped without my attention ...
Hence, I'd like to ask why you must hardcode the packet size here?
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
http://www.usb.org/developers/devclass_docs/usbdfu10.pdf (in section 4.2.1 DFU Mode Device Descriptor), specifies the bMaxPacketSize0 can be 8,16,32,64. And the value we get from gadget is 512. So hard coded it.
as I mentioned, this should be changed on connection done interrupt.
In the u-boot it is set up during binding the composite.
look at dwc3. dwc3 has a connection done IRQ which also tells me the negotiated link speed.
Quoted 5 lines
Quoted 2 lines
DFU has one of the poorest documentations for a USB Class and has some moronic definitions.
Frankly speaking I prefer to have the worst standard than some "brilliant" in house developed protocols.
nobody is talking about changing the protocol. DFU was written back when Full speed was the fastest USB on earth.
Quoted 8 lines
Quoted 3 lines
What happens if you want ot run DFU with a
superspeed controller (such as dwc3) when connected to a superspeed port. We cannot use ep0 packet size as 64, right ?Correct me if I'm wrong, but MaxPacket for SS ep0 is 2^9 = 512B. I'm curious if dfu-util will manage to handle ep0 MaxPacket size up to 512B.
It not, then we shall be able to fallback to 64B.
should be a test away.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140820/a9cdf997/attachment.pgp>
RFC PATCH 7/13 usb: gadget: g_dnl: Explicitly set the max packet size in descriptor
Hi Felipe,
Quoted 26 lines · Lukasz Majewski
Quoted 25 lines
Hi Felipe,
Quoted 23 lines
Quoted 20 lines · Kishon Vijay Abraham I
Quoted 8 lines · Lukasz Majewski
Hi Kishon,
Quoted 5 lines
Quoted 5 lines
Explicity set the max packet size in the device descriptor to
0x40as specified in the device class specification for device firmware upgrade. Also changed debug to printf to explicitly notify the user if the device has been enumerated.Quoted 4 lines
It seems like this patch slipped without my attention ...
Hence, I'd like to ask why you must hardcode the packet size here?
http://www.usb.org/developers/devclass_docs/usbdfu10.pdf (in section 4.2.1 DFU Mode Device Descriptor), specifies the bMaxPacketSize0 can be 8,16,32,64. And the value we get from gadget is 512. So hard coded it.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
as I mentioned, this should be changed on connection done interrupt.
In the u-boot it is set up during binding the composite.
look at dwc3. dwc3 has a connection done IRQ which also tells me the negotiated link speed.
My point is that you will need to pool in u-boot to emulate this IRQ.
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
DFU has one of the poorest documentations for a USB Class and has some moronic definitions.
Frankly speaking I prefer to have the worst standard than some "brilliant" in house developed protocols.
nobody is talking about changing the protocol. DFU was written back when Full speed was the fastest USB on earth.
As you can see the standard is a bit old now... and should be revised.
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
What happens if you want ot run DFU with a superspeed controller (such as dwc3) when connected to a superspeed port. We cannot use ep0 packet size as 64, right ?
Quoted 7 lines
Quoted 4 lines
Correct me if I'm wrong, but MaxPacket for SS ep0 is 2^9 = 512B. I'm curious if dfu-util will manage to handle ep0 MaxPacket size up to 512B.
It not, then we shall be able to fallback to 64B.should be a test away.
Ok.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
RFC PATCH 7/13 usb: gadget: g_dnl: Explicitly set the max packet size in descriptor
Quoted 31 lines · Lukasz Majewski
Hi Felipe,
Quoted 29 lines · Lukasz Majewski
Quoted 28 lines
Hi Felipe,
Quoted 25 lines
Quoted 13 lines · Kishon Vijay Abraham I
Quoted 10 lines · Lukasz Majewski
Hi Kishon,
Quoted 5 lines
Quoted 5 lines
Explicity set the max packet size in the device descriptor to
0x40as specified in the device class specification for device firmware upgrade. Also changed debug to printf to explicitly notify the user if the device has been enumerated.It seems like this patch slipped without my attention ...
Quoted 7 lines
Quoted 2 lines
Hence, I'd like to ask why you must hardcode the packet size here?
http://www.usb.org/developers/devclass_docs/usbdfu10.pdf (in section 4.2.1 DFU Mode Device Descriptor), specifies the bMaxPacketSize0 can be 8,16,32,64. And the value we get from gadget is 512. So hard coded it.
as I mentioned, this should be changed on connection done interrupt.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
In the u-boot it is set up during binding the composite.
look at dwc3. dwc3 has a connection done IRQ which also tells me the negotiated link speed.
My point is that you will need to pool in u-boot to emulate this IRQ.
you will need to poll anyways for a bunch of other things. There are some details in DWC3 which are mandated that you wait for event X before doing Y. For example control transfers, it's mandatory that you wait for a XferNotReady event before trying to start a Status Phase.
Quoted 10 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
DFU has one of the poorest documentations for a USB Class and has some moronic definitions.
Frankly speaking I prefer to have the worst standard than some "brilliant" in house developed protocols.
nobody is talking about changing the protocol. DFU was written back when Full speed was the fastest USB on earth.
As you can see the standard is a bit old now... and should be revised.
right, once USB-IF does that, I hope they switch to bulk endpoints :-p
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140821/29fe9f39/attachment.pgp>
RFC PATCH 7/13 usb: gadget: g_dnl: Explicitly set the max packet size in descriptor
In reply to Kishon Vijay Abraham IHi Kishon,
Quoted 10 lines · Lukasz Majewski
Quoted 7 lines
Hi Kishon,
Quoted 4 lines
Quoted 4 lines
Explicity set the max packet size in the device descriptor to
0x40as specified in the device class specification for device firmware upgrade. Also changed debug to printf to explicitly notify the user if the device has been enumerated.
Quoted 8 lines
Quoted 3 lines
It seems like this patch slipped without my attention ...
Hence, I'd like to ask why you must hardcode the packet size here?
http://www.usb.org/developers/devclass_docs/usbdfu10.pdf (in section 4.2.1 DFU Mode Device Descriptor), specifies the bMaxPacketSize0 can be 8,16,32,64. And the value we get from gadget is 512. So hard coded it.
As fair as I know ep0 MaxPacket for USB 2.0 is up to 64 bytes. This value here is set in a following way:
./drivers/usb/gadget/composite.c:990: cdev->desc.bMaxPacketSize0 =gadget->ep0->maxpacket;
And in my UDC driver .maxpacket = EP0_FIFO_SIZE, for ep0 the max packet is set to 64B:
s3c_udc_otg.c:782 .maxpacket = EP0_FIFO_SIZE,
So you don't need to hardcode it.
Another issue is how DFU works. It uses ONLY ep0 for transmission (as it was the requirement for very tiny microcontrollers).
According to USB 2.0 spec the ep0 MaxPacket size is up to 64B.
Considering above, DFU shall work with USB 3.0 using compliance mode with USB 2.0.
For other gadgets - like USB Mass Storage - which use other EPs you should notice benefit from using USB 3.0.
Quoted 3 lines
Thanks
Kishon
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
RFC PATCH 7/13 usb: gadget: g_dnl: Explicitly set the max packet size in descriptor
In reply to Felipe BalbiHi,
Quoted 20 lines · Felipe Balbi
Quoted 19 lines · Kishon Vijay Abraham I
Explicity set the max packet size in the device descriptor to
0x40as specified in the device class specification for device firmware upgrade. Also changed debug to printf to explicitly notify the user if the device has been enumerated.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/usb/gadget/composite.c | 3 +-- drivers/usb/gadget/g_dnl.c | 1 + 2 files changed, 2 insertions(+), 2 deletions(-)drivers/usb/gadget/composite.c +0
-0@@ -331,7 +331,7 @@ static int set_config(struct usb_composite_dev *cdev, }else result =0 ;
Quoted 5 lines
drivers/usb/gadget/composite.c static int set_config(struct usb_composite_dev *cdev, · line 334
Quoted 2 lines
drivers/usb/gadget/composite.c +1
-1- debug("%s: %s speed config #%d: %s\n", __func__, + printf("%s: %s speed config #%d: %s\n", __func__,this looks like it's only needed for debugging. No strong feelings though
yeah.. it helps to know if the device has been enumerated.
Quoted 8 lines
drivers/usb/gadget/composite.c static int composite_bind(struct usb_gadget *gadget) · line 990
Quoted 6 lines
drivers/usb/gadget/composite.c +0
-1@@ -987,7 +987,6 @@ static int composite_bind(struct usb_gadget *gadget)memcpy (&cdev->desc, composite->dev,sizeof (struct usb_device_descriptor )); - cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket;why are you dropping this line ?
Actually faced an issue with this. DWC3 gadget sets ep0 maxpacket size to 512 and if the device is operating at hight speed, the bMaxPacketSize0 field should be 64?
If the maxpacket size is set to 512, the host reports Invalid EP0 Maxpacket.
Thanks
Kishon
RFC PATCH 7/13 usb: gadget: g_dnl: Explicitly set the max packet size in descriptor
Hi,
Quoted 37 lines · Kishon Vijay Abraham I
Quoted 20 lines · Felipe Balbi
Quoted 19 lines · Kishon Vijay Abraham I
Explicity set the max packet size in the device descriptor to
0x40as specified in the device class specification for device firmware upgrade. Also changed debug to printf to explicitly notify the user if the device has been enumerated.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/usb/gadget/composite.c | 3 +-- drivers/usb/gadget/g_dnl.c | 1 + 2 files changed, 2 insertions(+), 2 deletions(-)drivers/usb/gadget/composite.c +0
-0@@ -331,7 +331,7 @@ static int set_config(struct usb_composite_dev *cdev, }else result =0 ;Quoted 5 lines
drivers/usb/gadget/composite.c static int set_config(struct usb_composite_dev *cdev, · line 334
Quoted 2 lines
drivers/usb/gadget/composite.c +1
-1- debug("%s: %s speed config #%d: %s\n", __func__, + printf("%s: %s speed config #%d: %s\n", __func__,this looks like it's only needed for debugging. No strong feelings though
yeah.. it helps to know if the device has been enumerated.
Quoted 8 lines
drivers/usb/gadget/composite.c static int composite_bind(struct usb_gadget *gadget) · line 990
Quoted 6 lines
drivers/usb/gadget/composite.c +0
-1@@ -987,7 +987,6 @@ static int composite_bind(struct usb_gadget *gadget)memcpy (&cdev->desc, composite->dev,sizeof (struct usb_device_descriptor )); - cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket;why are you dropping this line ?
Quoted 3 lines
Actually faced an issue with this. DWC3 gadget sets ep0 maxpacket size to 512 and if the device is operating at hight speed, the bMaxPacketSize0 field should be 64?
right, but that's changed on connection done IRQ.
Quoted 2 lines
If the maxpacket size is set to 512, the host reports Invalid EP0 Maxpacket.
huh ? who broke dwc3 ? connection done happens before we receive the first setup packet, how can host complain about anything ?
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140819/eb825288/attachment.pgp>
RFC PATCH 7/13 usb: gadget: g_dnl: Explicitly set the max packet size in descriptor
Quoted 44 lines · Felipe Balbi
Hi,
Quoted 37 lines · Kishon Vijay Abraham I
Quoted 20 lines · Felipe Balbi
Quoted 19 lines · Kishon Vijay Abraham I
Explicity set the max packet size in the device descriptor to
0x40as specified in the device class specification for device firmware upgrade. Also changed debug to printf to explicitly notify the user if the device has been enumerated.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/usb/gadget/composite.c | 3 +-- drivers/usb/gadget/g_dnl.c | 1 + 2 files changed, 2 insertions(+), 2 deletions(-)drivers/usb/gadget/composite.c +0
-0@@ -331,7 +331,7 @@ static int set_config(struct usb_composite_dev *cdev, }else result =0 ;Quoted 5 lines
drivers/usb/gadget/composite.c static int set_config(struct usb_composite_dev *cdev, · line 334
Quoted 2 lines
drivers/usb/gadget/composite.c +1
-1- debug("%s: %s speed config #%d: %s\n", __func__, + printf("%s: %s speed config #%d: %s\n", __func__,this looks like it's only needed for debugging. No strong feelings though
yeah.. it helps to know if the device has been enumerated.
Quoted 8 lines
drivers/usb/gadget/composite.c static int composite_bind(struct usb_gadget *gadget) · line 990
Quoted 6 lines
drivers/usb/gadget/composite.c +0
-1@@ -987,7 +987,6 @@ static int composite_bind(struct usb_gadget *gadget)memcpy (&cdev->desc, composite->dev,sizeof (struct usb_device_descriptor )); - cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket;why are you dropping this line ?
Quoted 3 lines
Actually faced an issue with this. DWC3 gadget sets ep0 maxpacket size to 512 and if the device is operating at hight speed, the bMaxPacketSize0 field should be 64?
Quoted 8 lines
right, but that's changed on connection done IRQ.
Quoted 2 lines
If the maxpacket size is set to 512, the host reports Invalid EP0 Maxpacket.
huh ? who broke dwc3 ? connection done happens before we receive the first setup packet, how can host complain about anything ?
composite_bind() (where maxpacket is being set) happens much before connection done interrupt. So it's not dwc3's fault.
Thanks
Kishon
RFC PATCH 7/13 usb: gadget: g_dnl: Explicitly set the max packet size in descriptor
Hi,
Quoted 14 lines · Kishon Vijay Abraham I
Quoted 14 lines
Quoted 11 lines
Quoted 7 lines
drivers/usb/gadget/composite.c static int composite_bind(struct usb_gadget *gadget) · line 990
Quoted 5 lines
drivers/usb/gadget/composite.c +0
-1@@ -987,7 +987,6 @@ static int composite_bind(struct usb_gadget *gadget)memcpy (&cdev->desc, composite->dev,sizeof (struct usb_device_descriptor )); - cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket;why are you dropping this line ?
Actually faced an issue with this. DWC3 gadget sets ep0 maxpacket size to 512 and if the device is operating at hight speed, the bMaxPacketSize0 field should be 64?
right, but that's changed on connection done IRQ.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
If the maxpacket size is set to 512, the host reports Invalid EP0 Maxpacket.
huh ? who broke dwc3 ? connection done happens before we receive the first setup packet, how can host complain about anything ?
composite_bind()(where maxpacket is being set) happens much before connection done interrupt. So it's not dwc3's fault.
seems like you're just missing a few fixes to composite.c, such as commit 765f5b830e547229bb752e7b232ee83e2b3d49d5
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140819/1ec75e6e/attachment.pgp>
RFC PATCH 7/13 usb: gadget: g_dnl: Explicitly set the max packet size in descriptor
Quoted 20 lines · Felipe Balbi
Hi,
Quoted 17 lines · Kishon Vijay Abraham I
Quoted 17 lines
Quoted 11 lines
Quoted 7 lines
drivers/usb/gadget/composite.c static int composite_bind(struct usb_gadget *gadget) · line 990
Quoted 5 lines
drivers/usb/gadget/composite.c +0
-1@@ -987,7 +987,6 @@ static int composite_bind(struct usb_gadget *gadget)memcpy (&cdev->desc, composite->dev,sizeof (struct usb_device_descriptor )); - cdev->desc.bMaxPacketSize0 = gadget->ep0->maxpacket;why are you dropping this line ?
Actually faced an issue with this. DWC3 gadget sets ep0 maxpacket size to 512 and if the device is operating at hight speed, the bMaxPacketSize0 field should be 64?
right, but that's changed on connection done IRQ.
Quoted 2 lines
If the maxpacket size is set to 512, the host reports Invalid EP0 Maxpacket.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
huh ? who broke dwc3 ? connection done happens before we receive the first setup packet, how can host complain about anything ?
composite_bind()(where maxpacket is being set) happens much before connection done interrupt. So it's not dwc3's fault.seems like you're just missing a few fixes to
composite.c, such as commit765f5b830e547229bb752e7b232ee83e2b3d49d5
hmm.. yeah.
-Kishon
Quoted 1 line
RFC PATCH 8/13 common: cmd_dfu: invoke board_usb_cleanup() for cleaning up
In reply to Kishon Vijay Abraham IInvoked board_usb_cleanup for cleaning up initialized USB. It will be invoked if the user enterts ctrl-C.
--- common/cmd_dfu.c | 1 + 1 file changed, 1 insertion(+)
common/cmd_dfu.c +1 -0
@@ -55,6 +55,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } exit:g_dnl_unregister (); +board_usb_cleanup (controller_index,USB_INIT_DEVICE ); done:dfu_free_entities ();
Signature · 1 line
1.9.1
RFC PATCH 9/13 common: cmd_dfu: add an API that takes controller index for handling interrupts
In reply to Kishon Vijay Abraham ISince there can be multiple USB controllers in the system, usb_gadget_handle_interrupts should take controller index as arguments. However such an API can only be added in board file so added board_usb_gadget_handle_interrupts(). usb_gadget_handle_interrupts() should be deprecated.
--- common/cmd_dfu.c | 1 + include/usb.h | 7 +++++++ 2 files changed, 8 insertions(+)
common/cmd_dfu.c +1 -0
@@ -52,6 +52,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) goto exit;usb_gadget_handle_interrupts (); +board_usb_gadget_handle_interrupts (controller_index); } exit:g_dnl_unregister ();
include/usb.h +7 -0
@@ -197,6 +197,13 @@ int board_usb_init(int index, enum usb_init_type init);*/ int board_usb_cleanup (int index,enum usb_init_type init); +/* +* Can be use to handle interrupts from a specific controller. +* +* @index index of the USB controller +*/ +int board_usb_gadget_handle_interrupts (int index); +#ifdef CONFIG_USB_STORAGE #define USB_MAX_STOR_DEV 5
Signature · 1 line
1.9.1
Lukasz Majewski
NAKRFC PATCH 9/13 common: cmd_dfu: add an API that takes controller index for handling interrupts
Hi Kishon,
Quoted 3 lines
Since there can be multiple USB controllers in the system,
usb_gadget_handle_interruptsshould take controller index as arguments.
The controller index is passed in the ums/dfu/thor command. Then PHY subsystem is properly configured.
Since we only handle one USB controller transmission at a time (u-boot doesn't use interrupts - we only pool) the usb_gadget_handle_interrupts() was enough for our purpose.
To start transmission from other usb controller you need to end current transmission and then invoke modified command with different controller number.
It would be enough to extend usb_gadget_handle_interrupts() to accept controller index argument (only six boards use it - it shall be easy to modify them all).
Quoted 15 lines
However such an API can only be added in board file so added
board_usb_gadget_handle_interrupts().usb_gadget_handle_interrupts()should be deprecated.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- common/cmd_dfu.c | 1 + include/usb.h | 7 +++++++ 2 files changed, 8 insertions(+)common/cmd_dfu.c +0
-0
common/cmd_dfu.c static int do_dfu(cmd_tbl_t *cmdtp, int flag, int · line 55
Quoted 4 lines
common/cmd_dfu.c +1
-0@@ -52,6 +52,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) goto exit;usb_gadget_handle_interrupts (); +board_usb_gadget_handle_interrupts (controller_index);
NAK, for the reason stated above.
Quoted 21 lines
common/cmd_dfu.c +0
-0} exit:g_dnl_unregister ();include/usb.h +0
-0@@ -197,6 +197,13 @@ int board_usb_init(int index, enum usb_init_typeinit); */
intboard_usb_cleanup(int index, enum usb_init_type init);include/usb.h +7
-0+/* +* Can be use to handle interrupts from a specific controller. +* +* @index index of the USB controller +*/ +int board_usb_gadget_handle_interrupts (int index); +#ifdef CONFIG_USB_STORAGE #define USB_MAX_STOR_DEV 5
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
RFC PATCH 9/13 common: cmd_dfu: add an API that takes controller index for handling interrupts
Hi,
Quoted 11 lines · Lukasz Majewski
Hi Kishon,
Quoted 3 lines
Since there can be multiple USB controllers in the system,
usb_gadget_handle_interruptsshould take controller index as arguments.The controller index is passed in the ums/dfu/thor command. Then PHY subsystem is properly configured.
Since we only handle one USB controller transmission at a time (u-boot doesn't use interrupts - we only pool) theusb_gadget_handle_interrupts()was enough for our purpose.
yeah, if we have only one USB controller in the system, controller index is not needed.
-Kishon
Quoted 55 lines
To start transmission from other usb controller you need to end current transmission and then invoke modified command with different controller number.
It would be enough to extend
usb_gadget_handle_interrupts()to accept controller index argument (only six boards use it - it shall be easy to modify them all).Quoted 15 lines
However such an API can only be added in board file so added
board_usb_gadget_handle_interrupts().usb_gadget_handle_interrupts()should be deprecated.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- common/cmd_dfu.c | 1 + include/usb.h | 7 +++++++ 2 files changed, 8 insertions(+)common/cmd_dfu.c +0
-0common/cmd_dfu.c static int do_dfu(cmd_tbl_t *cmdtp, int flag, int · line 55
Quoted 4 lines
common/cmd_dfu.c +1
-0@@ -52,6 +52,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) goto exit;usb_gadget_handle_interrupts (); +board_usb_gadget_handle_interrupts (controller_index);NAK, for the reason stated above.
Quoted 21 lines
common/cmd_dfu.c +0
-0} exit:g_dnl_unregister ();include/usb.h +0
-0@@ -197,6 +197,13 @@ int board_usb_init(int index, enum usb_init_typeinit); */
intboard_usb_cleanup(int index, enum usb_init_type init);include/usb.h +7
-0+/* +* Can be use to handle interrupts from a specific controller. +* +* @index index of the USB controller +*/ +int board_usb_gadget_handle_interrupts (int index); +#ifdef CONFIG_USB_STORAGE #define USB_MAX_STOR_DEV 5
RFC PATCH 9/13 common: cmd_dfu: add an API that takes controller index for handling interrupts
Hi Kishon,
Quoted 9 lines
Hi,
Quoted 6 lines · Lukasz Majewski
Hi Kishon,
Quoted 3 lines
Since there can be multiple USB controllers in the system,
usb_gadget_handle_interruptsshould take controller index as arguments.
Quoted 8 lines
Quoted 5 lines
The controller index is passed in the ums/dfu/thor command. Then PHY subsystem is properly configured.
Since we only handle one USB controller transmission at a time (u-boot doesn't use interrupts - we only pool) theusb_gadget_handle_interrupts()was enough for our purpose.yeah, if we have only one USB controller in the system, controller index is not needed.
To sum up:
1. You should be able to specify the USB controller when calling dfu or ums commands (as it is now).
2. If this is not enough for some reason (and good justification is welcome here), then usb_gadget_handle_interrupts() should be extended to accept the controller index argument.
Quoted 58 lines
-Kishon
Quoted 56 lines
To start transmission from other usb controller you need to end current transmission and then invoke modified command with different controller number.
It would be enough to extend
usb_gadget_handle_interrupts()to accept controller index argument (only six boards use it - it shall be easy to modify them all).Quoted 15 lines
However such an API can only be added in board file so added
board_usb_gadget_handle_interrupts().usb_gadget_handle_interrupts()should be deprecated.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- common/cmd_dfu.c | 1 + include/usb.h | 7 +++++++ 2 files changed, 8 insertions(+)common/cmd_dfu.c +0
-0common/cmd_dfu.c static int do_dfu(cmd_tbl_t *cmdtp, int flag, int · line 56
Quoted 5 lines
common/cmd_dfu.c +1
-0@@ -52,6 +52,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) goto exit;usb_gadget_handle_interrupts (); +board_usb_gadget_handle_interrupts (controller_index);NAK, for the reason stated above.
Quoted 21 lines
common/cmd_dfu.c +0
-0} exit:common/cmd_dfu.c +0
-0g_dnl_unregister ();include/usb.h +0
-0@@ -197,6 +197,13 @@ int board_usb_init(int index, enum
usb_init_typeinit); */
intboard_usb_cleanup(int index, enum usb_init_type init);include/usb.h +7
-0+/* +* Can be use to handle interrupts from a specific controller. +* +* @index index of the USB controller +*/ +int board_usb_gadget_handle_interrupts (int index); +#ifdef CONFIG_USB_STORAGE #define USB_MAX_STOR_DEV 5
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
RFC PATCH 10/13 board: ti: DRA7: added USB initializtion code
In reply to Kishon Vijay Abraham IImplemented board_usb_init(), board_usb_cleanup() and board_usb_gadget_handle_interrupts() in dra7xx board file that can be invoked by various gadget drivers.
--- arch/arm/include/asm/arch-omap5/omap.h | 12 ++++ board/ti/dra7xx/evm.c | 106 +++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+)
arch/arm/include/asm/arch-omap5/omap.h +12 -0
@@ -33,6 +33,18 @@#define CONTROL_ID_CODE CONTROL_CORE_ID_CODE#endif +#ifdef CONFIG_DRA7XX +#define DRA7_USB_OTG_SS1_BASE 0x48890000 +#define DRA7_USB_OTG_SS1_GLUE_BASE 0x48880000 +#define DRA7_USB3_PHY1_PLL_CTRL 0x4A084C00 +#define DRA7_USB3_PHY1_POWER 0x4A002370 +#define DRA7_USB2_PHY1_POWER 0x4A002300 + +#define DRA7_USB_OTG_SS2_BASE 0x488D0000 +#define DRA7_USB_OTG_SS2_GLUE_BASE 0x488C0000 +#define DRA7_USB2_PHY2_POWER 0x4A002E74 +#endif +/* To be verified */ #define OMAP5430_CONTROL_ID_CODE_ES1_0 0x0B94202F#define OMAP5430_CONTROL_ID_CODE_ES2_0 0x1B94202F
board/ti/dra7xx/evm.c +106 -0
122 lines not on this page · raw message
Signature · 1 line
1.9.1
RFC PATCH 10/13 board: ti: DRA7: added USB initializtion code
Quoted 53 lines · Kishon Vijay Abraham I
Implemented
board_usb_init(),board_usb_cleanup()andboard_usb_gadget_handle_interrupts()in dra7xx board file that can be invoked by various gadget drivers.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/include/asm/arch-omap5/omap.h | 12 ++++ board/ti/dra7xx/evm.c | 106 +++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+)arch/arm/include/asm/arch-omap5/omap.h +12
-0@@ -33,6 +33,18 @@#define CONTROL_ID_CODE CONTROL_CORE_ID_CODE#endif +#ifdef CONFIG_DRA7XX +#define DRA7_USB_OTG_SS1_BASE 0x48890000 +#define DRA7_USB_OTG_SS1_GLUE_BASE 0x48880000 +#define DRA7_USB3_PHY1_PLL_CTRL 0x4A084C00 +#define DRA7_USB3_PHY1_POWER 0x4A002370 +#define DRA7_USB2_PHY1_POWER 0x4A002300 + +#define DRA7_USB_OTG_SS2_BASE 0x488D0000 +#define DRA7_USB_OTG_SS2_GLUE_BASE 0x488C0000 +#define DRA7_USB2_PHY2_POWER 0x4A002E74 +#endif +/* To be verified */ #define OMAP5430_CONTROL_ID_CODE_ES1_0 0x0B94202F#define OMAP5430_CONTROL_ID_CODE_ES2_0 0x1B94202Fboard/ti/dra7xx/evm.c +4
-0@@ -13,10 +13,14 @@#include <common.h> #include <palmas.h> #include <sata.h> +#include <usb.h> #include <asm/arch/sys_proto.h> #include <asm/arch/mmc_host_def.h> #include <asm/arch/sata.h> #include <environment.h> +#include <dwc3-uboot.h> +#include <dwc3-omap-uboot.h> +#include <ti-usb-phy-uboot.h> #include "mux_data.h"
board/ti/dra7xx/evm.c int board_mmc_init(bd_t *bis) · line 135
Quoted 7 lines
board/ti/dra7xx/evm.c +4
-0@@ -125,6 +129,108 @@ int board_mmc_init(bd_t *bis) }#endif +static struct dwc3_device usb_otg_ss1 = { + .maximum_speed =USB_SPEED_SUPER , + .base =DRA7_USB_OTG_SS1_BASE , + .needs_fifo_resize = true,
make sure this is *really* needed. The only SoC which has needed this was OMAP5 ES1 due to a nice little "feature" IP folks left in there :-)
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140818/ab09eb41/attachment.pgp>
RFC PATCH 10/13 board: ti: DRA7: added USB initializtion code
Hi Felipe,
Quoted 57 lines · Felipe Balbi
Quoted 56 lines · Kishon Vijay Abraham I
Implemented
board_usb_init(),board_usb_cleanup()andboard_usb_gadget_handle_interrupts()in dra7xx board file that can be invoked by various gadget drivers.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/include/asm/arch-omap5/omap.h | 12 ++++ board/ti/dra7xx/evm.c | 106 +++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+)arch/arm/include/asm/arch-omap5/omap.h +12
-0@@ -33,6 +33,18 @@#define CONTROL_ID_CODE CONTROL_CORE_ID_CODE#endif +#ifdef CONFIG_DRA7XX +#define DRA7_USB_OTG_SS1_BASE 0x48890000 +#define DRA7_USB_OTG_SS1_GLUE_BASE 0x48880000 +#define DRA7_USB3_PHY1_PLL_CTRL 0x4A084C00 +#define DRA7_USB3_PHY1_POWER 0x4A002370 +#define DRA7_USB2_PHY1_POWER 0x4A002300 + +#define DRA7_USB_OTG_SS2_BASE 0x488D0000 +#define DRA7_USB_OTG_SS2_GLUE_BASE 0x488C0000 +#define DRA7_USB2_PHY2_POWER 0x4A002E74 +#endif +/* To be verified */ #define OMAP5430_CONTROL_ID_CODE_ES1_0 0x0B94202F#define OMAP5430_CONTROL_ID_CODE_ES2_0 0x1B94202Fboard/ti/dra7xx/evm.c +4
-0@@ -13,10 +13,14 @@#include <common.h> #include <palmas.h> #include <sata.h> +#include <usb.h> #include <asm/arch/sys_proto.h> #include <asm/arch/mmc_host_def.h> #include <asm/arch/sata.h> #include <environment.h> +#include <dwc3-uboot.h> +#include <dwc3-omap-uboot.h> +#include <ti-usb-phy-uboot.h> #include "mux_data.h" @@ -125,6 +129,108 @@ int board_mmc_init(bd_t *bis) }#endif
Quoted 7 lines
board/ti/dra7xx/evm.c int board_mmc_init(bd_t *bis) · line 135
Quoted 4 lines
board/ti/dra7xx/evm.c +4
-0+static struct dwc3_device usb_otg_ss1 = { + .maximum_speed =USB_SPEED_SUPER , + .base =DRA7_USB_OTG_SS1_BASE , + .needs_fifo_resize = true,make sure this is *really* needed. The only SoC which has needed this was OMAP5 ES1 due to a nice little "feature" IP folks left in there :-)
ah.. "tx-fifo-resize" is set in dra7.dtsi.
Thanks
Kishon
RFC PATCH 10/13 board: ti: DRA7: added USB initializtion code
Quoted 68 lines · Kishon Vijay Abraham I
Hi Felipe,
Quoted 57 lines · Felipe Balbi
Quoted 56 lines · Kishon Vijay Abraham I
Implemented
board_usb_init(),board_usb_cleanup()andboard_usb_gadget_handle_interrupts()in dra7xx board file that can be invoked by various gadget drivers.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/include/asm/arch-omap5/omap.h | 12 ++++ board/ti/dra7xx/evm.c | 106 +++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+)arch/arm/include/asm/arch-omap5/omap.h +12
-0@@ -33,6 +33,18 @@#define CONTROL_ID_CODE CONTROL_CORE_ID_CODE#endif +#ifdef CONFIG_DRA7XX +#define DRA7_USB_OTG_SS1_BASE 0x48890000 +#define DRA7_USB_OTG_SS1_GLUE_BASE 0x48880000 +#define DRA7_USB3_PHY1_PLL_CTRL 0x4A084C00 +#define DRA7_USB3_PHY1_POWER 0x4A002370 +#define DRA7_USB2_PHY1_POWER 0x4A002300 + +#define DRA7_USB_OTG_SS2_BASE 0x488D0000 +#define DRA7_USB_OTG_SS2_GLUE_BASE 0x488C0000 +#define DRA7_USB2_PHY2_POWER 0x4A002E74 +#endif +/* To be verified */ #define OMAP5430_CONTROL_ID_CODE_ES1_0 0x0B94202F#define OMAP5430_CONTROL_ID_CODE_ES2_0 0x1B94202Fboard/ti/dra7xx/evm.c +4
-0@@ -13,10 +13,14 @@#include <common.h> #include <palmas.h> #include <sata.h> +#include <usb.h> #include <asm/arch/sys_proto.h> #include <asm/arch/mmc_host_def.h> #include <asm/arch/sata.h> #include <environment.h> +#include <dwc3-uboot.h> +#include <dwc3-omap-uboot.h> +#include <ti-usb-phy-uboot.h> #include "mux_data.h" @@ -125,6 +129,108 @@ int board_mmc_init(bd_t *bis) }#endif Quoted 7 lines
board/ti/dra7xx/evm.c int board_mmc_init(bd_t *bis) · line 135
Quoted 4 lines
board/ti/dra7xx/evm.c +4
-0+static struct dwc3_device usb_otg_ss1 = { + .maximum_speed =USB_SPEED_SUPER , + .base =DRA7_USB_OTG_SS1_BASE , + .needs_fifo_resize = true,make sure this is *really* needed. The only SoC which has needed this was OMAP5 ES1 due to a nice little "feature" IP folks left in there :-)
Quoted 1 line
ah.. "tx-fifo-resize" is set in
dra7.dtsi.
hmm, I don't think it needs to be :-) not sure if you remember but early OMAP5 samples had a default TX fifo configuration of less than one superspeed bulk packet (less than 1024 bytes) :-)
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140819/b5f07165/attachment.pgp>
RFC PATCH 10/13 board: ti: DRA7: added USB initializtion code
Quoted 69 lines · Felipe Balbi
Quoted 68 lines · Kishon Vijay Abraham I
Hi Felipe,
Quoted 64 lines · Felipe Balbi
Quoted 53 lines · Kishon Vijay Abraham I
Implemented
board_usb_init(),board_usb_cleanup()andboard_usb_gadget_handle_interrupts()in dra7xx board file that can be invoked by various gadget drivers.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/include/asm/arch-omap5/omap.h | 12 ++++ board/ti/dra7xx/evm.c | 106 +++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+)arch/arm/include/asm/arch-omap5/omap.h +12
-0@@ -33,6 +33,18 @@#define CONTROL_ID_CODE CONTROL_CORE_ID_CODE#endif +#ifdef CONFIG_DRA7XX +#define DRA7_USB_OTG_SS1_BASE 0x48890000 +#define DRA7_USB_OTG_SS1_GLUE_BASE 0x48880000 +#define DRA7_USB3_PHY1_PLL_CTRL 0x4A084C00 +#define DRA7_USB3_PHY1_POWER 0x4A002370 +#define DRA7_USB2_PHY1_POWER 0x4A002300 + +#define DRA7_USB_OTG_SS2_BASE 0x488D0000 +#define DRA7_USB_OTG_SS2_GLUE_BASE 0x488C0000 +#define DRA7_USB2_PHY2_POWER 0x4A002E74 +#endif +/* To be verified */ #define OMAP5430_CONTROL_ID_CODE_ES1_0 0x0B94202F#define OMAP5430_CONTROL_ID_CODE_ES2_0 0x1B94202Fboard/ti/dra7xx/evm.c +4
-0@@ -13,10 +13,14 @@#include <common.h> #include <palmas.h> #include <sata.h> +#include <usb.h> #include <asm/arch/sys_proto.h> #include <asm/arch/mmc_host_def.h> #include <asm/arch/sata.h> #include <environment.h> +#include <dwc3-uboot.h> +#include <dwc3-omap-uboot.h> +#include <ti-usb-phy-uboot.h> #include "mux_data.h" board/ti/dra7xx/evm.c int board_mmc_init(bd_t *bis) · line 135
Quoted 7 lines
board/ti/dra7xx/evm.c +4
-0@@ -125,6 +129,108 @@ int board_mmc_init(bd_t *bis) }#endif +static struct dwc3_device usb_otg_ss1 = { + .maximum_speed =USB_SPEED_SUPER , + .base =DRA7_USB_OTG_SS1_BASE , + .needs_fifo_resize = true,make sure this is *really* needed. The only SoC which has needed this was OMAP5 ES1 due to a nice little "feature" IP folks left in there :-)
Quoted 5 lines
Quoted 1 line
ah.. "tx-fifo-resize" is set in
dra7.dtsi.hmm, I don't think it needs to be :-) not sure if you remember but early OMAP5 samples had a default TX fifo configuration of less than one superspeed bulk packet (less than 1024 bytes) :-)
ah.. I remember that one :-D Thankfully you solved it during wakeup ;-)
-Kishon
RFC PATCH 11/13 commom: usb: implement "__weak" functions to make compiler happy
In reply to Kishon Vijay Abraham IImplemented __weak functions for board_usb_cleanup, board_usb_gadget_handle_interrupts and usb_gadget_handle_interrupts to get of compiler errors in platforms that haven't implemented these functions.
--- common/usb.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
common/usb.c +18 -0
@@ -1072,4 +1072,22 @@ int board_usb_init(int index, enum usb_init_type init) {return 0 ; } + +__weak +int board_usb_cleanup (int index,enum usb_init_type init) +{ +return 0 ; +} + +__weak +int board_usb_gadget_handle_interrupts (int index) +{ +return 0 ; +} + +__weak +int usb_gadget_handle_interrupts (void ) +{ +return 0 ; +}/* EOF */
Signature · 1 line
1.9.1
RFC PATCH 11/13 commom: usb: implement "__weak" functions to make compiler happy
Hi Kishon,
Quoted 15 lines
Implemented
__weakfunctions forboard_usb_cleanup,board_usb_gadget_handle_interruptsandusb_gadget_handle_interruptsto get of compiler errors in platforms that haven't implemented these functions.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- common/usb.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)common/usb.c +0
-0
common/usb.c int board_usb_init(int index, enum · line 1080
Quoted 9 lines
common/usb.c +6
-0@@ -1072,4 +1072,22 @@ int board_usb_init(int index, enum usb_init_type init) {return 0 ; } + +__weak +int board_usb_cleanup (int index,enum usb_init_type init) +{ +return 0 ; +}
This needed before [PATCH 7/13]. Without it your code will cause u-boot repository to not be bisectable.
Quoted 13 lines
common/usb.c +12
-0+ +__weak +int board_usb_gadget_handle_interrupts (int index) +{ +return 0 ; +} + +__weak +int usb_gadget_handle_interrupts (void ) +{ +return 0 ; +}/* EOF */
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
RFC PATCH 11/13 commom: usb: implement "__weak" functions to make compiler happy
Quoted 21 lines · Lukasz Majewski
Hi Kishon,
Quoted 19 lines
Implemented
__weakfunctions forboard_usb_cleanup,board_usb_gadget_handle_interruptsandusb_gadget_handle_interruptsto get of compiler errors in platforms that haven't implemented these functions.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- common/usb.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)common/usb.c +1
-0@@ -1072,4 +1072,22 @@ int board_usb_init(int index, enum usb_init_type init) {return 0 ; } +
Quoted 8 lines
common/usb.c int board_usb_init(int index, enum usb_init_type init) · line 1080
Quoted 5 lines
common/usb.c +5
-0+__weak +int board_usb_cleanup (int index,enum usb_init_type init) +{ +return 0 ; +}This needed before [PATCH 7/13]. Without it your code will cause u-boot repository to not be bisectable.
hmm. ok
-Kishon
Quoted 17 lines
Quoted 14 lines
common/usb.c +12
-0+ +__weak +int board_usb_gadget_handle_interrupts (int index) +{ +return 0 ; +} + +__weak +int usb_gadget_handle_interrupts (void ) +{ +return 0 ; +}/* EOF */
RFC PATCH 11/13 commom: usb: implement "__weak" functions to make compiler happy
Quoted 33 lines · Kishon Vijay Abraham I
Quoted 21 lines · Lukasz Majewski
Hi Kishon,
Quoted 19 lines
Implemented
__weakfunctions forboard_usb_cleanup,board_usb_gadget_handle_interruptsandusb_gadget_handle_interruptsto get of compiler errors in platforms that haven't implemented these functions.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- common/usb.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)common/usb.c +1
-0@@ -1072,4 +1072,22 @@ int board_usb_init(int index, enum usb_init_type init) {return 0 ; } +Quoted 8 lines
common/usb.c int board_usb_init(int index, enum usb_init_type init) · line 1080
Quoted 5 lines
common/usb.c +5
-0+__weak +int board_usb_cleanup (int index,enum usb_init_type init) +{ +return 0 ; +}This needed before [PATCH 7/13]. Without it your code will cause u-boot repository to not be bisectable.
Quoted 1 line
hmm. ok
And note that you can use buildman to make sure that your branch is bisectable, in addition to the normal git rebase 'exec' keyword.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140821/bd4b4775/attachment.pgp>
RFC PATCH 12/13 include: configs: Enable DWC3 and DFU in DRA7xx
In reply to Kishon Vijay Abraham IEnabled dwc3, dwc3-omap and PHY for dwc3 are enabled. Also enabled support for DFU.
--- include/configs/dra7xx_evm.h | 59 +++++++++++++++++++++++++++++++++++++++ include/configs/ti_omap5_common.h | 1 + 2 files changed, 60 insertions(+)
include/configs/dra7xx_evm.h +59 -0
@@ -132,6 +132,65 @@#define CONFIG_OMAP_USB_PHY #define CONFIG_OMAP_USB2PHY2_HOST +/* USB GADGET */ +#define CONFIG_USB_DWC3_PHY_OMAP +#define CONFIG_USB_DWC3_OMAP +#define CONFIG_USB_DWC3 +#define CONFIG_USB_DWC3_GADGET +#define CONFIG_SYS_DCACHE_OFF 1 + +#define CONFIG_USB_GADGET +#define CONFIG_USBDOWNLOAD_GADGET +#define CONFIG_USB_GADGET_VBUS_DRAW 2 +#define CONFIG_G_DNL_MANUFACTURER "Texas Instruments" +#define CONFIG_G_DNL_VENDOR_NUM 0x0403 +#define CONFIG_G_DNL_PRODUCT_NUM 0xBD00 +#define CONFIG_USB_GADGET_DUALSPEED + +/* USB Device Firmware Update support */ +#define CONFIG_DFU_FUNCTION +#define CONFIG_DFU_RAM +#define CONFIG_CMD_DFU + +#define DFU_ALT_INFO_MMC \ + "dfu_alt_info_mmc=" \ + "boot part 0 1;" \ + "rootfs part 0 2;" \ + "MLO fat 0 1;" \ + "spl-os-args fat 0 1;" \ + "spl-os-image fat 0 1;" \ + "u-boot.img fat 0 1;" \ + "uEnv.txt fat 0 1\0" + +#ifdef CONFIG_NAND +#define CONFIG_DFU_NAND +#define DFU_ALT_INFO_NAND \ + "dfu_alt_info_nand=" \ + "SPL part 0 1;" \ + "SPL.backup1 part 0 2;" \ + "SPL.backup2 part 0 3;" \ + "SPL.backup3 part 0 4;" \ + "u-boot part 0 5;" \ + "u-boot-spl-os part 0 6;" \ + "kernel part 0 8;" \ + "rootfs part 0 9\0" +#else +#define DFU_ALT_INFO_NAND "" +#endif + +#define CONFIG_DFU_RAM +#define DFU_ALT_INFO_RAM \ + "dfu_alt_info_ram=" \ + "kernel ram 0x80200000 0x4000000;" \ + "fdt ram 0x80f80000 0x80000;" \ + "ramdisk ram 0x81000000 0x4000000\0" + +#define DFUARGS \ + "dfu_alt_info_emmc=rawemmc mmc 0 3751936\0" \ + DFU_ALT_INFO_MMC \ + DFU_ALT_INFO_RAM \ + DFU_ALT_INFO_NAND +/* SATA */ #define CONFIG_BOARD_LATE_INIT #define CONFIG_CMD_SCSI
include/configs/ti_omap5_common.h +1 -0
@@ -119,6 +119,7 @@"if test $fdtfile = undefined; then " \"echo WARNING: Could not determine device tree to use; fi; \0" \"loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile};\0" \ +DFUARGS \ #define CONFIG_BOOTCOMMAND \"run findfdt; " \
Signature · 1 line
1.9.1
RFC PATCH 13/13 dwc3: core: Change the bounce buffer size to 4096
In reply to Kishon Vijay Abraham IBounce buffer is used for transferring requests which is not maxpacket aligned. In the case of DFU the requests can be upto 4096 bytes.
While the actual fix for this should be using two chained TRBs to handle the transfer, this can be used as a temporary fix.
--- drivers/usb/dwc3/core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/core.h +1 -1
@@ -24,7 +24,7 @@#include <linux/usb/otg.h> /* Global constants */ -#define DWC3_EP0_BOUNCE_SIZE 512 +#define DWC3_EP0_BOUNCE_SIZE 4096#define DWC3_ENDPOINTS_NUM 32#define DWC3_XHCI_RESOURCES_NUM 2
Signature · 1 line
1.9.1
RFC PATCH 13/13 dwc3: core: Change the bounce buffer size to 4096
Quoted 5 lines · Kishon Vijay Abraham I
Bounce buffer is used for transferring requests which is not maxpacket aligned. In the case of DFU the requests can be upto 4096 bytes.
While the actual fix for this should be using two chained TRBs to handle the transfer, this can be used as a temporary fix.
Did you manage to trigger this fault ? Was the size larger than 512 ? I'm inclined into getting a real fix instead of just patching around.
That way, the kernel benefits too as we can port the same patch there.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140818/495e5c89/attachment.pgp>
RFC PATCH 13/13 dwc3: core: Change the bounce buffer size to 4096
Hi,
Quoted 8 lines · Felipe Balbi
Quoted 5 lines · Kishon Vijay Abraham I
Bounce buffer is used for transferring requests which is not maxpacket aligned. In the case of DFU the requests can be upto 4096 bytes.
While the actual fix for this should be using two chained TRBs to handle the transfer, this can be used as a temporary fix.
Did you manage to trigger this fault ? Was the size larger than 512 ?
yeah.. transferring any kernel image resulted in a size larger than 512.
Quoted 3 lines
I'm inclined into getting a real fix instead of just patching around.
That way, the kernel benefits too as we can port the same patch there.
sure.
Thanks
Kishon
RFC PATCH 13/13 dwc3: core: Change the bounce buffer size to 4096
Quoted 7 lines · Kishon Vijay Abraham I
Hi,
Quoted 4 lines · Felipe Balbi
Quoted 3 lines · Kishon Vijay Abraham I
Bounce buffer is used for transferring requests which is not maxpacket aligned. In the case of DFU the requests can be upto 4096 bytes.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
While the actual fix for this should be using two chained TRBs to handle the transfer, this can be used as a temporary fix.
Did you manage to trigger this fault ? Was the size larger than 512 ?
yeah.. transferring any kernel image resulted in a size larger than 512.
but it's also larger than 4KiB :-)
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140819/37f0ee92/attachment.pgp>
RFC PATCH 13/13 dwc3: core: Change the bounce buffer size to 4096
Hi,
Quoted 8 lines · Felipe Balbi
Quoted 7 lines · Kishon Vijay Abraham I
Hi,
Quoted 4 lines · Felipe Balbi
Quoted 3 lines · Kishon Vijay Abraham I
Bounce buffer is used for transferring requests which is not maxpacket aligned. In the case of DFU the requests can be upto 4096 bytes.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
While the actual fix for this should be using two chained TRBs to handle the transfer, this can be used as a temporary fix.
Did you manage to trigger this fault ? Was the size larger than 512 ?
yeah.. transferring any kernel image resulted in a size larger than 512.
but it's also larger than 4KiB :-)
Yeah. But the DFU specifies the maximum transfer size in wTransferSize (DFU function descriptor) to the host which is 4096 bytes (DFU_USB_BUFSIZ).
So the max size will be only 4KB.
Thanks
Kishon
RFC PATCH 13/13 dwc3: core: Change the bounce buffer size to 4096
Quoted 16 lines · Kishon Vijay Abraham I
Hi,
Quoted 13 lines · Felipe Balbi
Quoted 12 lines · Kishon Vijay Abraham I
Hi,
Quoted 8 lines · Felipe Balbi
Quoted 5 lines · Kishon Vijay Abraham I
Bounce buffer is used for transferring requests which is not maxpacket aligned. In the case of DFU the requests can be upto 4096 bytes.
While the actual fix for this should be using two chained TRBs to handle the transfer, this can be used as a temporary fix.
Did you manage to trigger this fault ? Was the size larger than 512 ?
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
yeah.. transferring any kernel image resulted in a size larger than 512.
but it's also larger than 4KiB :-)
Yeah. But the DFU specifies the maximum transfer size in wTransferSize (DFU function descriptor) to the host which is 4096 bytes (
DFU_USB_BUFSIZ).So the max size will be only 4KB.
ah, ok. Thanks for that detail.
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140822/89e13ffb/attachment.pgp>
cover DRA7xx: Add DWC3 USB driver and enable DFU
In reply to Kishon Vijay Abraham IQuoted 7 lines · Kishon Vijay Abraham I
Ported DWC3 driver from linux kernel v3.16 to uboot and enabled DFU in DRA7xx. Tested only with DFU ram.
While I kept the dwc3 driver pretty much the same from linux kernel, I have created a single driver for both USB2 and USB3 PHY programming. I have also adapted udc-core from linux kernel so that we can cleanly link the gadet driver with the controller driver.
For the next round please CC Marek as he's the USB custodian. Also, enable DFU for writing to the eMMC as well, thanks.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140818/239d3244/attachment.pgp>
cover DRA7xx: Add DWC3 USB driver and enable DFU
In reply to Kishon Vijay Abraham IHi Kishon,
Quoted 2 lines
Ported DWC3 driver from linux kernel v3.16 to uboot and enabled DFU in DRA7xx. Tested only with DFU ram.
I'm afraid that only testing the code with DFU ram is not enough.
I'd _appreciate_ if you had CCed other people involved in DFU/UDC/USB development to this RFC. I've CCed Marek Vasut - the USB custodian.
The whole series seems like a huge improvement from the base code - which is 2.6.36 based one...
Quoted 4 lines
While I kept the dwc3 driver pretty much the same from linux kernel, I have created a single driver for both USB2 and USB3 PHY programming.
I concern about driver model compliance. Simon Glass has put a lot of effort to convert Exynos' UART and GPIO to it. Hence, I believe that potential UDC/PHY rework shall comply with Simon's device model work.
Therefore, I've CC'ed Simon as well.
Quoted 84 lines
I have also adapted udc-core from linux kernel so that we can cleanly link the gadet driver with the controller driver.
This series was created on top of
commit61e76f53708cf082ef9061a140b57df3513b8ba1
Merge: 76b2102 3d83e67
Author: Tom Rini <[email protected]>
Date: Tue Jun 10 20:37:00 2014 -0400Merge branch 'master' of
git://git.denx.de/u-boot-usbLet me know of any feedback and suggestions.
Known Issues:
DWC3 is not enumerating consistently.Kishon Vijay Abraham I (13):
include: linux: preparation for porting dwc3 from linux kernel
usb: gadget: udc-core: Add minimal udc-core from linux kernel
ARM: DRA7: Enable clocks for USB OTGSS and USB PHY
usb: dwc3: Add dwc3 driver
usb: dwc3-omap: Add dwc3 glue driver for OMAP
usb: dwc3: TI PHY: PHY driver for dwc3 in TI platforms
usb: gadget:g_dnl: Explicitly set the max packet size in descriptor
common:cmd_dfu: invokeboard_usb_cleanup()for cleaning up
common:cmd_dfu: add an API that takes controller index for handling
interrupts
board: ti: DRA7: added USB initializtion code
commom: usb: implement "__weak" functions to make compiler happy
include: configs: Enable DWC3 and DFU in DRA7xx
dwc3: core: Change the bounce buffer size to 4096Makefile | 1 + arch/arm/cpu/armv7/omap5/hw_data.c | 14 + arch/arm/cpu/armv7/omap5/prcm-regs.c | 6 +- arch/arm/include/asm/arch-omap5/omap.h | 12 + arch/arm/include/asm/omap_common.h | 4 +- board/ti/dra7xx/evm.c | 106 ++ common/cmd_dfu.c | 2 + common/usb.c | 18 + drivers/usb/dwc3/Makefile | 10 + drivers/usb/dwc3/core.c | 640 +++++++ drivers/usb/dwc3/core.h | 961 +++++++++++ drivers/usb/dwc3/dwc3-omap.c | 447 +++++ drivers/usb/dwc3/ep0.c | 1045 ++++++++++++ drivers/usb/dwc3/gadget.c | 2841 ++++++++++++++++++++++++++++++++ drivers/usb/dwc3/gadget.h | 163 ++ drivers/usb/dwc3/io.h | 52 + drivers/usb/dwc3/linux-compat.h | 132 ++ drivers/usb/dwc3/ti_usb_phy.c | 269 +++ drivers/usb/gadget/Makefile | 1 + drivers/usb/gadget/composite.c | 3 +- drivers/usb/gadget/g_dnl.c | 1 + drivers/usb/gadget/udc-core.c | 229 +++ include/configs/dra7xx_evm.h | 59 + include/configs/ti_omap5_common.h | 1 + include/dwc3-omap-uboot.h | 32 + include/dwc3-uboot.h | 26 + include/linux/compat.h | 12 +- include/linux/usb/composite.h | 12 + include/linux/usb/dwc3-omap.h | 19 + include/linux/usb/gadget.h | 75 +- include/linux/usb/otg.h | 20 + include/ti-usb-phy-uboot.h | 22 + include/usb.h | 7 + include/usb/lin_gadget_compat.h | 8 +- 34 files changed, 7236 insertions(+), 14 deletions(-) create mode 100644 drivers/usb/dwc3/Makefile create mode 100644 drivers/usb/dwc3/core.c create mode 100644 drivers/usb/dwc3/core.h create mode 100644 drivers/usb/dwc3/dwc3-omap.c create mode 100644 drivers/usb/dwc3/ep0.c create mode 100644 drivers/usb/dwc3/gadget.c create mode 100644 drivers/usb/dwc3/gadget.h create mode 100644 drivers/usb/dwc3/io.h create mode 100644 drivers/usb/dwc3/linux-compat.h create mode 100644 drivers/usb/dwc3/ti_usb_phy.c create mode 100644 drivers/usb/gadget/udc-core.c create mode 100644 include/dwc3-omap-uboot.h create mode 100644 include/dwc3-uboot.h create mode 100644 include/linux/usb/dwc3-omap.h create mode 100644 include/linux/usb/otg.h create mode 100644 include/ti-usb-phy-uboot.h
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group