Re: [PATCH] usb: dwc2: fix reset logic in dwc2_core_reset

2025-07-24 Thread Junhui Liu
iting for GINTSTS_CURMODE_HOST timeout" > > Fixes: c5d685b8993c ("usb: dwc2: Unify flush and reset logic with v4.20a > support") > Signed-off-by: Patrick Delaunay Thanks for the fix. Reviewed-by: Junhui Liu -- Best regards, Junhui Liu

Re: [PATCH] usb: dwc2: Refactor register operations with clrsetbits macros

2025-04-23 Thread Junhui Liu
00:29, Junhui Liu wrote: > Refactor DWC2 USB gadget driver to replace manual read-modify-write > operations with `clrsetbits_le32`, `setbits_le32`, and `clrbits_le32` > macros, which simplify the code and improve readability. > > Signed-off-by: Junhui Liu > --- > This patc

[PATCH] riscv: dts: spacemit: Update UART compatible for k1

2025-02-23 Thread Junhui Liu
Update UART compatible in k1 dts to "intel,xscale-uart", introduced in commit 2d84e1519c5b ("serial: ns16550: Add Intel XScale support") recently, aligning dts with the upstream kernel. Tested-by: Huan Zhou Signed-off-by: Junhui Liu --- arch/riscv/dts/k1.dtsi | 22 +

[PATCH] usb: dwc2: Refactor register operations with clrsetbits macros

2025-01-26 Thread Junhui Liu
Refactor DWC2 USB gadget driver to replace manual read-modify-write operations with `clrsetbits_le32`, `setbits_le32`, and `clrbits_le32` macros, which simplify the code and improve readability. Signed-off-by: Junhui Liu --- This patch is a supplement of patch series [1]. [1] https

[PATCH 5/5] doc: canaan: Add K230 CanMV board

2025-01-14 Thread Junhui Liu
ommon/k230_board_common.h#L52 Signed-off-by: Junhui Liu --- doc/board/canaan/index.rst | 8 doc/board/canaan/k230_canmv.rst | 88 + doc/board/index.rst | 1 + 3 files changed, 97 insertions(+) diff --git a/doc/board/canaan/index.rst

[PATCH 4/5] riscv: canaan: k230_canmv: Add initial support

2025-01-14 Thread Junhui Liu
Add support for K230 CanMV board with serial console and usb otg support. It can boot via vendor's u-boot-spl and boot into Linux via tftp through the onboard RTL8152. Signed-off-by: Junhui Liu --- board/canaan/k230_canmv/Kconfig | 19 +++ board/canaan/k230_canmv/MAINTA

[PATCH 3/5] riscv: cpu: k230: Add support for Canaan Kendryte K230 SoC

2025-01-14 Thread Junhui Liu
Add Canaan K230 SoC with sysreset support, running without cache enabled. Signed-off-by: Junhui Liu --- arch/riscv/Kconfig | 5 + arch/riscv/cpu/k230/Kconfig | 14 ++ arch/riscv/cpu/k230/Makefile | 6 ++ arch/riscv/cpu/k230/cpu.c| 9 + arch/riscv

[PATCH 2/5] riscv: dts: canaan: Add basic device tree for K230 CanMV board

2025-01-14 Thread Junhui Liu
blob/v1.8/src/little/uboot/board/canaan/common/k230_img.c#L125 Signed-off-by: Junhui Liu --- arch/riscv/dts/Makefile | 1 + arch/riscv/dts/k230-canmv.dts | 31 +++ arch/riscv/dts/k230-u-boot.dtsi | 25 ++ arch/riscv/dts/k230.dtsi| 175 +

[PATCH 1/5] usb: dwc2: Add support for Canaan K230

2025-01-14 Thread Junhui Liu
Canaan Kendryte K230 SoC instantiates a dwc2 v4.30a core. This patch adds the compatible for it. Signed-off-by: Junhui Liu --- The USB function on K230 currently relies on patch [1], which updates the core reset flow of dwc2 in version 4.20a and newer. However, the USB PHY drivers is not

[PATCH 0/5] riscv: canaan: Add support for K230-CanMV board

2025-01-14 Thread Junhui Liu
https://developer.canaan-creative.com/k230/en/dev/CanMV_K230_Tutorial.html [2] https://developer.canaan-creative.com/proDetail/230 [3] https://gist.github.com/Judehahh/c0ed94de3a0aeada2e2f1bc3a397fa2d --- Junhui Liu (5): usb: dwc2: Add support for Canaan K230 riscv: dts: canaan: Add basic device

[PATCH v4 8/8] usb: dwc2: Replace uint_t types with u

2025-01-10 Thread Junhui Liu
: Junhui Liu --- drivers/usb/gadget/dwc2_udc_otg.c | 4 +- drivers/usb/host/dwc2.c | 100 +++--- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c index

[PATCH v4 7/8] usb: dwc2: Unify flush and reset logic with v4.20a support

2025-01-10 Thread Junhui Liu
: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=65dc2e725286106f99c6f6b78e3d9c52c15f3a9c Signed-off-by: Kongyang Liu Tested-by: Peter Robinson Signed-off-by: Junhui Liu --- This commit does not add the handling of ret returned from the dwc2_core_reset

[PATCH v4 6/8] usb: dwc2: Extract macro definitions to common header

2025-01-10 Thread Junhui Liu
-by: Junhui Liu --- drivers/usb/common/dwc2_core.h | 430 + drivers/usb/gadget/dwc2_udc_otg_regs.h | 154 +--- drivers/usb/host/dwc2.h| 291 -- 3 files changed, 431 insertions(+), 444 deletions(-) diff --git a

[PATCH v4 5/8] usb: dwc2: Align macros with Linux kernel definitions

2025-01-10 Thread Junhui Liu
Korpershoek Signed-off-by: Junhui Liu --- drivers/usb/gadget/dwc2_udc_otg.c | 62 +-- drivers/usb/gadget/dwc2_udc_otg_regs.h | 243 ++- drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c | 130 +++--- drivers/usb/host/dwc2.c| 260 ++-- drivers/usb/host/dwc2

[PATCH v4 4/8] usb: dwc2: Clean up with bitfield macros

2025-01-10 Thread Junhui Liu
-by: Peter Robinson Signed-off-by: Junhui Liu --- drivers/usb/gadget/dwc2_udc_otg.c | 5 +- drivers/usb/gadget/dwc2_udc_otg_regs.h | 250 drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c | 21 +- drivers/usb/host/dwc2.c| 101 ++- drivers/usb/host/dwc2.h

[PATCH v4 3/8] usb: dwc2: Fix HBstLen setting for external DMA mode

2025-01-10 Thread Junhui Liu
://rockchip.fr/RK312X%20TRM/chapter-26-usb-otg-2-0.pdf#page=24 Signed-off-by: Kongyang Liu Reviewed-by: Marek Vasut Tested-by: Peter Robinson Reviewed-by: Mattijs Korpershoek Signed-off-by: Junhui Liu --- Additionally, the boards I have only use internal DMA mode, and it’s unclear which chips

[PATCH v4 2/8] usb: dwc2: Fix incorrect ULPI_UTMI_SEL bit setting

2025-01-10 Thread Junhui Liu
ut Tested-by: Peter Robinson Reviewed-by: Mattijs Korpershoek Signed-off-by: Junhui Liu --- drivers/usb/host/dwc2.c | 24 +--- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dw

[PATCH v4 1/8] usb: dwc2: Extract register definitions to common header file

2025-01-10 Thread Junhui Liu
Liu Reviewed-by: Marek Vasut Tested-by: Peter Robinson Reviewed-by: Mattijs Korpershoek Signed-off-by: Junhui Liu --- drivers/usb/common/dwc2_core.h | 126 ++ drivers/usb/gadget/dwc2_udc_otg.c | 94 +++--- drivers/usb/gadget/dwc2_udc_otg_regs.h

[PATCH v4 0/8] usb: dwc2: Refactor and update USB DWC2 driver

2025-01-10 Thread Junhui Liu
alculating HBstLen for external DMA mode. - Extend the changes that replace uint32 with u32 to also include u8 and u16. - Link to v1: https://lore.kernel.org/r/20240522142311.17351-1-seashell11234...@gmail.com --- Junhui Liu (1): usb: dwc2: Fix incorrect ULPI_UTMI_SEL bit setting Kongyang Li

Re: [PATCH v3 6/8] usb: dwc2: Extract macro definitions to common header

2025-01-07 Thread Junhui Liu
Hi Mattijs, Thank you for your review. On 07/01/2025 10:55, Mattijs Korpershoek wrote: > Hi Junhui, > > Thank you for the patch. > > On sam., janv. 04, 2025 at 11:37, Junhui Liu wrote: > >> From: Kongyang Liu >> >> Some macros are shared between host

Re: [PATCH v3 0/8] usb: dwc2: Refactor and update USB DWC2 driver

2025-01-07 Thread Junhui Liu
Hi Mattijs, On 07/01/2025 10:47, Mattijs Korpershoek wrote: > Hi Junhui, > > On sam., janv. 04, 2025 at 11:37, Junhui Liu wrote: > >> This series improves the USB DWC2 driver by extracting register >> definitions into a common file for better readability and updatin

Re: [PATCH v3 7/8] usb: dwc2: Unify flush and reset logic with v4.20a support

2025-01-07 Thread Junhui Liu
On 06/01/2025 16:37, Marek Vasut wrote: > On 1/6/25 10:14 AM, Junhui Liu wrote: >> Hi Marek, >> >> On 05/01/2025 20:19, Marek Vasut wrote: >>> On 1/4/25 4:37 AM, Junhui Liu wrote: >>>> From: Kongyang Liu >>>> >>>> This patch me

Re: [PATCH v3 7/8] usb: dwc2: Unify flush and reset logic with v4.20a support

2025-01-06 Thread Junhui Liu
Hi Marek, On 05/01/2025 20:19, Marek Vasut wrote: > On 1/4/25 4:37 AM, Junhui Liu wrote: >> From: Kongyang Liu >> >> This patch merges flush and reset logic for both host and gadget code >> into a common set of functions, reducing duplication. It also adds support >

[PATCH v3 8/8] usb: dwc2: Replace uint_t types with u

2025-01-04 Thread Junhui Liu
: Junhui Liu --- drivers/usb/gadget/dwc2_udc_otg.c | 4 +- drivers/usb/host/dwc2.c | 100 +++--- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c index

[PATCH v3 7/8] usb: dwc2: Unify flush and reset logic with v4.20a support

2025-01-04 Thread Junhui Liu
: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=65dc2e725286106f99c6f6b78e3d9c52c15f3a9c Signed-off-by: Kongyang Liu Signed-off-by: Junhui Liu --- This commit does not add the handling of ret returned from the dwc2_core_reset, dwc2_flush_tx_fifo and

[PATCH v3 6/8] usb: dwc2: Extract macro definitions to common header

2025-01-04 Thread Junhui Liu
-by: Junhui Liu --- drivers/usb/common/dwc2_core.h | 430 + drivers/usb/gadget/dwc2_udc_otg_regs.h | 160 +--- drivers/usb/host/dwc2.h| 291 -- 3 files changed, 431 insertions(+), 450 deletions(-) diff --git a

[PATCH v3 5/8] usb: dwc2: Align macros with Linux kernel definitions

2025-01-04 Thread Junhui Liu
From: Kongyang Liu Update the DWC2 macros to match those used in the Linux kernel, making it easier to synchronize updates with kernel. Also removed some unused macros to cleanup the code. Signed-off-by: Kongyang Liu Reviewed-by: Marek Vasut Tested-by: Peter Robinson Signed-off-by: Junhui

[PATCH v3 4/8] usb: dwc2: Clean up with bitfield macros

2025-01-04 Thread Junhui Liu
From: Kongyang Liu Use FIELD_PREP, FIELD_GET, BIT, and GENMASK macros to standardize bit manipulation across the DWC2 code, improving readability and maintainability without altering functionality. Signed-off-by: Kongyang Liu Signed-off-by: Junhui Liu --- drivers/usb/gadget/dwc2_udc_otg.c

[PATCH v3 3/8] USB: dwc2: Fix HBstLen setting for external DMA mode

2025-01-04 Thread Junhui Liu
://rockchip.fr/RK312X%20TRM/chapter-26-usb-otg-2-0.pdf#page=24 Signed-off-by: Kongyang Liu Reviewed-by: Marek Vasut Tested-by: Peter Robinson Signed-off-by: Junhui Liu --- Additionally, the boards I have only use internal DMA mode, and it’s unclear which chips employ external DMA. The testing was

[PATCH v3 2/8] usb: dwc2: Fix incorrect ULPI_UTMI_SEL bit setting

2025-01-04 Thread Junhui Liu
ut Tested-by: Peter Robinson Signed-off-by: Junhui Liu --- drivers/usb/host/dwc2.c | 24 +--- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c index b6c8b3d5a6bdf375f1adeb106d4832

[PATCH v3 0/8] usb: dwc2: Refactor and update USB DWC2 driver

2025-01-04 Thread Junhui Liu
ith u32 to also include u8 and u16. - Link to v1: https://lore.kernel.org/r/20240522142311.17351-1-seashell11234...@gmail.com --- Junhui Liu (1): usb: dwc2: Fix incorrect ULPI_UTMI_SEL bit setting Kongyang Liu (7): usb: dwc2: Extract register definitions to common header file

[PATCH v3 1/8] usb: dwc2: Extract register definitions to common header file

2025-01-04 Thread Junhui Liu
Liu Reviewed-by: Marek Vasut Tested-by: Peter Robinson Signed-off-by: Junhui Liu --- drivers/usb/common/dwc2_core.h | 126 ++ drivers/usb/gadget/dwc2_udc_otg.c | 94 +++--- drivers/usb/gadget/dwc2_udc_otg_regs.h | 68 +- drivers/usb

[PATCH v2 6/8] usb: dwc2: Extract macro definitions to common header

2024-12-30 Thread Junhui Liu via B4 Relay
From: Kongyang Liu Some macros are shared between host and gadget code, causing duplicated definitions. Move DWC2 macro definitions from host and gadget code into a common header to reduce duplication. Signed-off-by: Kongyang Liu Signed-off-by: Junhui Liu --- drivers/usb/common/dwc2_core.h

[PATCH v2 8/8] usb: dwc2: Replace uint_t types with u

2024-12-30 Thread Junhui Liu via B4 Relay
From: Kongyang Liu Updates all instances of uint8_t, uint16_t, and uint32_t to u8, u16, and u32 respectively, ensuring consistent use of kernel-preferred types and resolving checkpatch.pl warnings. Signed-off-by: Kongyang Liu Signed-off-by: Junhui Liu --- drivers/usb/gadget/dwc2_udc_otg.c

[PATCH v2 5/8] usb: dwc2: Align macros with Linux kernel definitions

2024-12-30 Thread Junhui Liu via B4 Relay
From: Kongyang Liu Update the DWC2 macros to match those used in the Linux kernel, making it easier to synchronize updates with kernel. Also removed some unused macros to cleanup the code. Signed-off-by: Kongyang Liu Signed-off-by: Junhui Liu --- drivers/usb/gadget/dwc2_udc_otg.c

[PATCH v2 1/8] usb: dwc2: Extract register definitions to common header file

2024-12-30 Thread Junhui Liu via B4 Relay
Liu Signed-off-by: Junhui Liu --- drivers/usb/common/dwc2_core.h | 126 ++ drivers/usb/gadget/dwc2_udc_otg.c | 94 +++--- drivers/usb/gadget/dwc2_udc_otg_regs.h | 68 +- drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c | 201

[PATCH v2 4/8] usb: dwc2: Clean up with bitfield macros

2024-12-30 Thread Junhui Liu via B4 Relay
From: Kongyang Liu Use FIELD_PREP, FIELD_GET, BIT, and GENMASK macros to standardize bit manipulation across the DWC2 code, improving readability and maintainability without altering functionality. Signed-off-by: Kongyang Liu Signed-off-by: Junhui Liu --- drivers/usb/gadget/dwc2_udc_otg.c

[PATCH v2 3/8] USB: dwc2: Fix HBstLen setting for external DMA mode

2024-12-30 Thread Junhui Liu via B4 Relay
://rockchip.fr/RK312X%20TRM/chapter-26-usb-otg-2-0.pdf#page=24 Signed-off-by: Kongyang Liu Signed-off-by: Junhui Liu --- Additionally, the boards I have only use internal DMA mode, and it’s unclear which chips employ external DMA. The testing was performed by comparing against the datasheet, and

[PATCH v2 2/8] usb: dwc2: Fix incorrect ULPI_UTMI_SEL bit setting

2024-12-30 Thread Junhui Liu via B4 Relay
From: Junhui Liu The ULPI_UTMI_SEL bit in the DWC2 driver was set incorrectly. According to the datasheet [1], this bit should be set to 0 for UTMI interface and 1 for ULPI interface. The existing code had this logic reversed, causing the interface selection to be incorrect. This commit

[PATCH v2 7/8] usb: dwc2: Unify flush and reset logic with v4.20a support

2024-12-30 Thread Junhui Liu via B4 Relay
: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=65dc2e725286106f99c6f6b78e3d9c52c15f3a9c Signed-off-by: Kongyang Liu Signed-off-by: Junhui Liu --- drivers/usb/common/Makefile| 2 + drivers/usb/common/dwc2_core.c | 103

[PATCH v2 0/8] usb: dwc2: Refactor and update USB DWC2 driver

2024-12-30 Thread Junhui Liu via B4 Relay
uint32 with u32 to also include u8 and u16. - Link to v1: https://lore.kernel.org/r/20240522142311.17351-1-seashell11234...@gmail.com --- Junhui Liu (8): usb: dwc2: Extract register definitions to common header file usb: dwc2: Fix incorrect ULPI_UTMI_SEL bit setting USB: dwc2