| #
90a5cd4a |
| 28-May-2024 |
Neil Armstrong <neil.armstrong@linaro.org> |
UPSTREAM: usb: dwc3: gadget: fix crash in dwc3_gadget_giveback()
If the ep0 stalls or request are dequeued when gagdet is stopped, the request dma may not be mapped yet and dwc3_flush_cache() may be
UPSTREAM: usb: dwc3: gadget: fix crash in dwc3_gadget_giveback()
If the ep0 stalls or request are dequeued when gagdet is stopped, the request dma may not be mapped yet and dwc3_flush_cache() may be called with a NULL pointer.
Check req->request.dma before calling dwc3_flush_cache() and later the usb_gadget_unmap_request() functions since it means that usb_gadget_map_request() hasn't been called yet.
Fixes: fd15b58c1a9 ("dwc3: flush cache only if there is a buffer attached to a request") Change-Id: I08df172aaea16bd09f3c9596576d3b45f7338caa Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Link: https://lore.kernel.org/r/20240528-topic-sm8x50-dwc3-gadget-crash-fix-v1-1-58434ab4b3d3@linaro.org Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: William Wu <william.wu@rock-chips.com> (cherry picked from commit 85ced6f4745f529098cae38a5bd3144035a1318c)
show more ...
|
| #
87398174 |
| 05-Feb-2024 |
William Wu <william.wu@rock-chips.com> |
usb: dwc3: gadget: Fix non-multiple maxpacket len for out req
If the length of OUT request isn't a multiple of MaxPacketSize, the current code round up to multiple of MaxPacketSize as the OUT transf
usb: dwc3: gadget: Fix non-multiple maxpacket len for out req
If the length of OUT request isn't a multiple of MaxPacketSize, the current code round up to multiple of MaxPacketSize as the OUT transfer's buffer size, but in the transfer complete handler, it still use the original req length to calculate the actual length of the transfer, and get a wrong actual length.
This patch use the transfer's buffer size to calculate the actual length of the OUT request.
Fixes: 5433dc646a26 ("usb: dwc3: gadget: fix TRB buffer to multiple of MaxPacketSize") Change-Id: I5132ee53044d16edd1bd26ccec3e4d98aba1d7c5 Signed-off-by: William Wu <william.wu@rock-chips.com>
show more ...
|
| #
469f3582 |
| 21-Dec-2023 |
William Wu <william.wu@rock-chips.com> |
usb: dwc3: gadget: Print usb speed info
Some rockchip platforms support rockusb max speed at usb3. For usb2 enumeration, print 'high-speed'. For usb3 enumeration, print 'super-speed'.
Change-Id: I6
usb: dwc3: gadget: Print usb speed info
Some rockchip platforms support rockusb max speed at usb3. For usb2 enumeration, print 'high-speed'. For usb3 enumeration, print 'super-speed'.
Change-Id: I6f54d30c1234fa1676c225ae76431598e4653380 Signed-off-by: William Wu <william.wu@rock-chips.com>
show more ...
|
| #
36c87911 |
| 19-Oct-2023 |
william.wu <william.wu@rock-chips.com> |
usb: rockusb: Add support for usb3 download
This patch improve the usb gadget drivers and the usb dwc3 controller drivers to support rockusb usb3 download images.
With this patch, it can support: 1
usb: rockusb: Add support for usb3 download
This patch improve the usb gadget drivers and the usb dwc3 controller drivers to support rockusb usb3 download images.
With this patch, it can support: 1. Maskrom usbplug usb2 switch to usb3 automatically if the boards and the upgrade tool support usb3.
2. Loader enter usb3 automatically if the boards support usb3.
3. Force Maskrom/Loader usb fall back to usb2 if wait for usb3 enumeration time out.
Signed-off-by: Jianwei Zheng <jianwei.zheng@rock-chips.com> Signed-off-by: william.wu <william.wu@rock-chips.com> Change-Id: I9ad13fb42ae59cc9075545e22627f237f0eb1f32
show more ...
|
| #
e4f6d043 |
| 24-Mar-2023 |
Frank Wang <frank.wang@rock-chips.com> |
usb: dwc3: gadget: fix dcache invalidate for event buffer
The second parameter of invalidate_dcache_range() is the end address to invalidate up to not the invalidation length, so wrap a new API dwc3
usb: dwc3: gadget: fix dcache invalidate for event buffer
The second parameter of invalidate_dcache_range() is the end address to invalidate up to not the invalidation length, so wrap a new API dwc3_invalidate_cache() make the driver easy to use.
Move up the invalidation operation into event buffer check instead of event buffer process to reduce the invoked times.
Fixes: 0e7e455ba5bd ("usb: dwc3: invalidate dcache before read event buffer") Change-Id: I299740e5d15e1f1841d5b33cd1cd2f9e34ebcc12 Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
show more ...
|
| #
bc481ab8 |
| 12-May-2022 |
Frank Wang <frank.wang@rock-chips.com> |
usb: dwc3: fix the the gadget max_speed
The maximum_speed of the dwc is always valid since it configured from DTB or dwc3_device structure, and the gadget max_speed should keep same with the dwc dev
usb: dwc3: fix the the gadget max_speed
The maximum_speed of the dwc is always valid since it configured from DTB or dwc3_device structure, and the gadget max_speed should keep same with the dwc device maximum_speed, so fix it.
Change-Id: If207f8f10b8362728577d4e49981c74634e88ecf Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
show more ...
|
| #
0e7e455b |
| 23-Feb-2022 |
Frank Wang <frank.wang@rock-chips.com> |
usb: dwc3: invalidate dcache before read event buffer
The dcache of the event buffer contents may be dirty when cpu read them in interrupt thread after the controller has been touched, so invalidate
usb: dwc3: invalidate dcache before read event buffer
The dcache of the event buffer contents may be dirty when cpu read them in interrupt thread after the controller has been touched, so invalidate the dcache before read to fix it.
Change-Id: Ib8c4865ddf0fda03f799540eb96772e23257ec75 Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
show more ...
|
| #
8abdd51c |
| 19-Jan-2022 |
Frank Wang <frank.wang@rock-chips.com> |
usb: dwc3: gadget: start new transfer on XFER_COMPLETE
In current code, the next transfer in dwc3 queue needs to wait for a following XFERNOTREADY event coming after the current transfer is complete
usb: dwc3: gadget: start new transfer on XFER_COMPLETE
In current code, the next transfer in dwc3 queue needs to wait for a following XFERNOTREADY event coming after the current transfer is completed. However, the gadget in U-Boot awlays uses polling method to check the DWC3 interrupt, so the gadget class driver is required to poll dwc3 interrupt twice to check the XFERCOMPLETE and XFERNOTREADY event separately in ping-pong buffer usage scenario.
So let start the new transfer in dwc3 request list right away when the time we get to XFERCOMPLETE event for non-sync transfer, instead of waiting for the following XFER_NOT_READY event.
Change-Id: I113c6551606acd4fc0d0fbafb84d066179eec587 Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
show more ...
|
| #
1a4f6af8 |
| 02-Mar-2020 |
Joseph Chen <chenjh@rock-chips.com> |
Merge branch 'next-dev' into thunder-boot
|
| #
5433dc64 |
| 14-Jan-2020 |
Frank Wang <frank.wang@rock-chips.com> |
usb: dwc3: gadget: fix TRB buffer to multiple of MaxPacketSize
According to the chapter 8.2.3.3 of DWC3 Databook, the total size of a Buffer Descriptor must be a multiple of MaxPacketSize for OUT en
usb: dwc3: gadget: fix TRB buffer to multiple of MaxPacketSize
According to the chapter 8.2.3.3 of DWC3 Databook, the total size of a Buffer Descriptor must be a multiple of MaxPacketSize for OUT endpoints. This commit fixes it.
Change-Id: I7a4ae8ee73561c06cb4927cb83b4ae18a3f46c43 Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
show more ...
|
| #
c936c8a6 |
| 14-Jan-2020 |
Frank Wang <frank.wang@rock-chips.com> |
usb: dwc3: gadget: always enable CSP
CSP bit of TRB Control is useful for protocols such CDC EEM/ECM/NCM where we're transferring in blocks of MTU-sized requests (usually MTU is 1500 bytes).
We kno
usb: dwc3: gadget: always enable CSP
CSP bit of TRB Control is useful for protocols such CDC EEM/ECM/NCM where we're transferring in blocks of MTU-sized requests (usually MTU is 1500 bytes).
We know we will always have a short packet after two (for HS) wMaxPacketSize packets and, usually, we will have a long(-ish) queue of requests (for our g_ether gadget, we have at least 10 requests).
Instead of always stopping the queue processing to interrupt, giveback and restart, let's tell dwc3 to interrupt but continue processing following request if we have anything already pending in the queue.
Refer to commit ca4d44ea2a91 ("usb: dwc3: gadget: always enable CSP") in Linux Kernel.
Change-Id: Icce79fa174f6d7f040e1c332fe6792a1922c5a04 Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
show more ...
|
| #
3a920774 |
| 02-Oct-2019 |
Marek Szyprowski <m.szyprowski@samsung.com> |
UPSTREAM: dwc3: flush cache only if there is a buffer attached to a request
Calling cache flush on invalid buffer, even with zero length might cause an exception on certain platforms.
Change-Id: Id
UPSTREAM: dwc3: flush cache only if there is a buffer attached to a request
Calling cache flush on invalid buffer, even with zero length might cause an exception on certain platforms.
Change-Id: Idf8e2c87a24c80627279faa69430881d5c2c6800 Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Frank Wang <frank.wang@rock-chips.com> (cherry picked from commit fd15b58c1a9a61edcdeef8ce1eb4df2442295f58)
show more ...
|
| #
57521aaa |
| 23-Nov-2018 |
Lukasz Majewski <lukma@denx.de> |
UPSTREAM: usb: composite: Move bitmap related operations to ./include/linux/bitmap.h
The BITMAP related operations can now be moved to ./include/linux/bitmap.h file to mimic the Linux kernel directo
UPSTREAM: usb: composite: Move bitmap related operations to ./include/linux/bitmap.h
The BITMAP related operations can now be moved to ./include/linux/bitmap.h file to mimic the Linux kernel directory tree.
This change also allows to remove the lin_gadget_compat.h header file (which is a legacy code only for composite U-boot layer). It was also possible to remove #includes from several USB gadget drivers.
Conflicts: include/usb/lin_gadget_compat.h
Change-Id: Id61d6f9cef89ca238f082f430f6d01ac1009aa07 Signed-off-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Stefan Agner <stefan.agner@toradex.com> (cherry picked from commit 916fa097997a5e1b70768ce944de28e038d4bebf)
show more ...
|
| #
434f82ed |
| 18-May-2018 |
Mugunthan V N <mugunthanvnm@ti.com> |
UPSTREAM: usb: dwc3: Add dwc3_init/remove with DM_USB
The patch is preparing dwc3 core for enabling DM_USB with peripheral driver with using driver model support. The driver will be bound by the DWC
UPSTREAM: usb: dwc3: Add dwc3_init/remove with DM_USB
The patch is preparing dwc3 core for enabling DM_USB with peripheral driver with using driver model support. The driver will be bound by the DWC3 wrapper driver based on the dr_mode device tree entry.
Change-Id: If18bda57dfccaa3df104df5defa326d930a8abbe Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com> (Remove dwc3-omap changes) Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Frank Wang <frank.wang@rock-chips.com> (cherry picked from commit 23ba2d6372e45479106922c6241a7a09707bbe08)
show more ...
|
| #
6e4c159c |
| 09-Jul-2018 |
William Wu <william.wu@rock-chips.com> |
usb: dwc3: get rid of debug compile error
When enable debug option to compile, it will give the following error, this patch is used to get rid of it.
error: ‘flags’ is used uninitialized in this fu
usb: dwc3: get rid of debug compile error
When enable debug option to compile, it will give the following error, this patch is used to get rid of it.
error: ‘flags’ is used uninitialized in this function [-Werror=uninitialized]
Change-Id: Iba4cd59ab28eb7a48490e45842541f0418239e17 Signed-off-by: William Wu <william.wu@rock-chips.com>
show more ...
|
| #
7a4b7544 |
| 25-Oct-2017 |
Frank Wang <frank.wang@rock-chips.com> |
Revert "usb: rockchip: add the rockusb gadget"
Instead of using fastboot framework it is better to use ums framework to improve firmware upgrade speed. Will add a new rockusb driver next.
This reve
Revert "usb: rockchip: add the rockusb gadget"
Instead of using fastboot framework it is better to use ums framework to improve firmware upgrade speed. Will add a new rockusb driver next.
This reverts commit c7cd0ba("usb: rockchip: add the rockusb gadget").
Change-Id: Ie578ee94e247780d6f9b56156b0ccf737fa18cb9 Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
show more ...
|
| #
c7cd0ba4 |
| 25-May-2017 |
Eddie Cai <eddie.cai.linux@gmail.com> |
usb: rockchip: add the rockusb gadget
this patch implement rockusb protocol on the device side. this is based on USB download gadget infrastructure. the rockusb function implements the rd, wl, rid c
usb: rockchip: add the rockusb gadget
this patch implement rockusb protocol on the device side. this is based on USB download gadget infrastructure. the rockusb function implements the rd, wl, rid commands. it can work with rkdeveloptool
Signed-off-by: Eddie Cai <eddie.cai.linux@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Changes in v7: -none
Changes in v6: -move some data to f_rockusb structure
Changes in v5: -fix build error when build non-rockchip board -fix checkpatch error
Changes in v4: -use enum instead of macro define -move some structure define and macro to f_rockusb.h -add some function comment as Simon required -address other comment from Simon -fix build error as Lukasz point out
Changes in v3: -split the macro to f_rockusb.h -use ALLOC_CACHE_ALIGN_BUFFER to define cache safe struct inside the function. -fix checkpatch error
show more ...
|
| #
bdf1ea11 |
| 14-Apr-2017 |
Tom Rini <trini@konsulko.com> |
Merge branch 'master' of git://git.denx.de/u-boot-usb
|
| #
889239d6 |
| 06-Apr-2017 |
Philipp Tomsich <philipp.tomsich@theobroma-systems.com> |
usb: dwc3: gadget: make cache-maintenance on event buffers more robust
Merely using dma_alloc_coherent does not ensure that there is no stale data left in the caches for the allocated DMA buffer (i.
usb: dwc3: gadget: make cache-maintenance on event buffers more robust
Merely using dma_alloc_coherent does not ensure that there is no stale data left in the caches for the allocated DMA buffer (i.e. that the affected cacheline may still be dirty).
The original code was doing the following (on AArch64, which translates a 'flush' into a 'clean + invalidate'): # during initialisation: 1. allocate buffers via memalign => buffers may still be modified (cached, dirty) # during interrupt processing 2. clean + invalidate buffers => may commit stale data from a modified cacheline 3. read from buffers
This could lead to garbage info being written to buffers before reading them during even-processing.
To make the event processing more robust, we use the following sequence for the cache-maintenance: # during initialisation: 1. allocate buffers via memalign 2. clean + invalidate buffers (we only need the 'invalidate' part, but dwc3_flush_cache() always performs a 'clean + invalidate') # during interrupt processing 3. read the buffers (we know these lines are not cached, due to the previous invalidation and no other code touching them in-between) 4. clean + invalidate buffers => writes back any modification we may have made during event processing and ensures that the lines are not in the cache the next time we enter interrupt processing
Note that with the original sequence, we observe reproducible (depending on the cache state: i.e. running dhcp/usb start before will upset caches to get us around this) issues in the event processing (a fatal synchronous abort in dwc3_gadget_uboot_handle_interrupt on the first time interrupt handling is invoked) when running USB mass storage emulation on our RK3399-Q7 with data-caches on.
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
show more ...
|
| #
b7bf4a95 |
| 06-Apr-2017 |
Philipp Tomsich <philipp.tomsich@theobroma-systems.com> |
usb: dwc3: ensure consistent types for dwc3_flush_cache
The dwc3_flush_cache() call was declared and used inconsistently: * The declaration assumed 'int' for addresses (a potential issue when ru
usb: dwc3: ensure consistent types for dwc3_flush_cache
The dwc3_flush_cache() call was declared and used inconsistently: * The declaration assumed 'int' for addresses (a potential issue when running in a LP64 memory model). * The invocation cast the address to 'long'.
This change ensures that both the declaration and usage of this function consistently uses 'uintptr_t' for correct behaviour even when the allocated buffers (to be flushed) reside outside of the lower 32bits of memory.
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
show more ...
|
| #
87fcdca6 |
| 26-Feb-2017 |
Tom Rini <trini@konsulko.com> |
Merge branch 'master' of git://git.denx.de/u-boot-usb
|
| #
282b7208 |
| 14-Feb-2017 |
Vincent Tinelli <vincent.tinelli@intel.com> |
usb: dwc3: gadget: Remove unused header inclusion
Remove sys_proto.h inclusion which is not used by the driver.
Signed-off-by: Vincent Tinelli <vincent.tinelli@intel.com> Signed-off-by: Andy Shevch
usb: dwc3: gadget: Remove unused header inclusion
Remove sys_proto.h inclusion which is not used by the driver.
Signed-off-by: Vincent Tinelli <vincent.tinelli@intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
show more ...
|
| #
84b8bf6d |
| 24-Jan-2016 |
Masahiro Yamada <yamada.masahiro@socionext.com> |
bug.h: move BUILD_BUG_* defines to include/linux/bug.h
BUILD_BUG_* macros have been defined in several headers. It would be nice to collect them in include/linux/bug.h like Linux.
This commit is c
bug.h: move BUILD_BUG_* defines to include/linux/bug.h
BUILD_BUG_* macros have been defined in several headers. It would be nice to collect them in include/linux/bug.h like Linux.
This commit is cherry-picking useful macros from include/linux/bug.h of Linux 4.4.
I did not import BUILD_BUG_ON_MSG() because it would not work if it is used with include/common.h in U-Boot. I'd like to postpone it until the root cause (the "error()" macro in include/common.h causes the name conflict with "__attribute__((error()))") is fixed.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Tom Rini <trini@konsulko.com>
show more ...
|
| #
5f5620ab |
| 12-Nov-2015 |
Stefano Babic <sbabic@denx.de> |
Merge git://git.denx.de/u-boot
|
| #
1674942a |
| 05-Nov-2015 |
Tom Rini <trini@konsulko.com> |
Merge git://git.denx.de/u-boot-usb
|