Skip to contentSkip to conversation

HSD #18028953892: usb: xhci-dwc3: Fix USB3.1 controller register access in reset state

PATCH In review Jit Loon Lim 4 participants 12 messages Jun 21, 2023 – Jul 27, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HSD #18028953892: usb: xhci-dwc3: Fix USB3.1 controller register access in reset state

From: Teik Heng Chong <[email protected]>

The controller registers should not be accessed while the controller's vcc_reset_n is asserted.

---
 drivers/usb/host/xhci-dwc3.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-dwc3.c +6 -1
index 1dbd65dfaa..3172956bd6 100644
@@ -227,6 +227,11 @@ static int xhci_dwc3_probe(struct udevice *dev)
 static int xhci_dwc3_remove(struct udevice *dev)
 {
 	struct xhci_dwc3_plat *plat = dev_get_plat(dev);
+	int ret;
+
+	ret = xhci_deregister(dev);
+	if (ret)
+		return ret;
 
 	dwc3_shutdown_phy(dev, &plat->phys);
 
@@ -234,7 +239,7 @@ static int xhci_dwc3_remove(struct udevice *dev)
 
 	reset_release_bulk(&plat->resets);
 
-	return xhci_deregister(dev);
+	return 0;
 }
 
 static const struct udevice_id xhci_dwc3_ids[] = {
Signature · 1 line
2.26.2
#1 lore raw
Quoted 6 lines · Jit Loon Lim

From: Teik Heng Chong <[email protected]>

The controller registers should not be accessed while the controller's vcc_reset_n is asserted.

Is this patch ported from Linux or is this custom development ?

Is there a matching patch/fix in Linux already ?

#2 lore raw
Quoted 19 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, 21 June, 2023 10:19 PM
To: Lim, Jit Loon <[email protected]>; [email protected]
Cc: Jagan Teki <[email protected]>; Simon <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Lokanathan, Raaj <[email protected]>; Maniyam, Dinesh <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Chong, Teik Heng <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Tang, Sieu Mun <[email protected]>; Bin Meng <[email protected]>
Subject: Re: [PATCH v1] HSD #18028953892: usb: xhci-dwc3: Fix USB3.1 controller register access in reset state

Quoted 2 lines · Jit Loon Lim

From: Teik Heng Chong <[email protected]>

Quoted 8 lines
Quoted 4 lines

The controller registers should not be accessed while the controller's vcc_reset_n is asserted.

Is this patch ported from Linux or is this custom development ?

Is there a matching patch/fix in Linux already ?

In xhci_dwc3_probe(), the program sequence is
vcc reset -> clk init -> phy setup -> xhci_register
therefore, when xhci_dwc3_remove is called, the proper usb stop sequence should be xhci_register _> phy setup -> clk init -> vcc reset

if we look at linux driver https://elixir.bootlin.com/linux/latest/source/drivers/usb/dwc3/dwc3-of-simple.c#L33

dwc3_of_simple_probe: The sequence is reset -> clock __dwc3_of_simple_teardown: Then, clock -> reset

So based on the above, we have made changes and the uboot fix is now aligned with linux driver.

#3 lore raw
Quoted 33 lines · Jit Loon
Quoted 19 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, 21 June, 2023 10:19 PM
To: Lim, Jit Loon <[email protected]>; [email protected]
Cc: Jagan Teki <[email protected]>; Simon <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Lokanathan, Raaj <[email protected]>; Maniyam, Dinesh <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Chong, Teik Heng <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Tang, Sieu Mun <[email protected]>; Bin Meng <[email protected]>
Subject: Re: [PATCH v1] HSD #18028953892: usb: xhci-dwc3: Fix USB3.1 controller register access in reset state

Quoted 2 lines · Jit Loon Lim

From: Teik Heng Chong <[email protected]>

Quoted 8 lines
Quoted 4 lines

The controller registers should not be accessed while the controller's vcc_reset_n is asserted.

Is this patch ported from Linux or is this custom development ?

Is there a matching patch/fix in Linux already ?

In xhci_dwc3_probe(), the program sequence is
vcc reset -> clk init -> phy setup -> xhci_register
therefore, when xhci_dwc3_remove is called, the proper usb stop sequence should be xhci_register _> phy setup -> clk init -> vcc reset

Quoted 6 lines

if we look at linux driver https://elixir.bootlin.com/linux/latest/source/drivers/usb/dwc3/dwc3-of-simple.c#L33

dwc3_of_simple_probe: The sequence is reset -> clock __dwc3_of_simple_teardown: Then, clock -> reset

So based on the above, we have made changes and the uboot fix is now aligned with linux driver.

Instead of adding random patches to the U-Boot dwc3 driver, please just synchronize the driver with Linux. You should be able to add the missing patches to the DWC3 driver from Linux since the last synchronization point, the process should be largely mechanical. Make sure to include commit ID of each Linux commit in the new matching U-Boot patch.

It shouldn't be difficult, one approach I can think of is roughly this:
- figure out the original merge base from which the DWC3 driver was imported to U-Boot
- in U-Boot, revert all dwc3 patches on top of that import patch
- pick all Linux kernel dwc3 patches from that merge base and apply on top of this U-Boot with reverts
- Run rebase and drop the reverts, let git drop duplicate patches

#4 lore raw
Quoted 68 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Thursday, 22 June, 2023 5:35 PM
To: Lim, Jit Loon <[email protected]>; [email protected]
Cc: Jagan Teki <[email protected]>; Simon <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Lokanathan, Raaj <[email protected]>; Maniyam, Dinesh <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Chong, Teik Heng <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Tang, Sieu Mun <[email protected]>; Bin Meng <[email protected]>; Michal Simek <[email protected]>; Tom Rini <[email protected]>; Eugen Hristev <[email protected]>
Subject: Re: [PATCH v1] HSD #18028953892: usb: xhci-dwc3: Fix USB3.1 controller register access in reset state

Quoted 33 lines · Jit Loon
Quoted 19 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, 21 June, 2023 10:19 PM
To: Lim, Jit Loon <[email protected]>; [email protected]
Cc: Jagan Teki <[email protected]>; Simon <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Lokanathan, Raaj <[email protected]>; Maniyam, Dinesh <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Chong, Teik Heng <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Tang, Sieu Mun <[email protected]>; Bin Meng <[email protected]>
Subject: Re: [PATCH v1] HSD #18028953892: usb: xhci-dwc3: Fix USB3.1 controller register access in reset state

Quoted 2 lines · Jit Loon Lim

From: Teik Heng Chong <[email protected]>

Quoted 8 lines
Quoted 4 lines

The controller registers should not be accessed while the controller's vcc_reset_n is asserted.

Is this patch ported from Linux or is this custom development ?

Is there a matching patch/fix in Linux already ?

In xhci_dwc3_probe(), the program sequence is vcc reset -> clk init -> phy setup -> xhci_register therefore, when xhci_dwc3_remove is called, the proper usb stop sequence should be xhci_register _> phy setup -> clk init -> vcc reset

Quoted 8 lines

if we look at linux driver
https://elixir.bootlin.com/linux/latest/source/drivers/usb/dwc3/dwc3-o
f-simple.c#L33

dwc3_of_simple_probe: The sequence is reset -> clock __dwc3_of_simple_teardown: Then, clock -> reset

So based on the above, we have made changes and the uboot fix is now

aligned with linux driver.

Instead of adding random patches to the U-Boot dwc3 driver, please just synchronize the driver with Linux. You should be able to add the missing patches to the DWC3 driver from Linux since the last synchronization point, the process should be largely mechanical. Make sure to include commit ID of each Linux commit in the new matching U-Boot patch.

Quoted 7 lines

It shouldn't be difficult, one approach I can think of is roughly this:
- figure out the original merge base from which the DWC3 driver was imported to U-Boot
- in U-Boot, revert all dwc3 patches on top of that import patch
- pick all Linux kernel dwc3 patches from that merge base and apply on top of this U-Boot with reverts
- Run rebase and drop the reverts, let git drop duplicate patches

We believed the previous reply from us is a bit confusing. There is no exact same function/file for U-Boot to use in Linux. What we are doing is, we are referring to Linux sequence.

Linux: (dwc3_of_simple_probe)
https://elixir.bootlin.com/linux/latest/source/drivers/usb/dwc3/dwc3-of-simple.c#L33
U-Boot: (xhci_dwc3_probe)
https://elixir.bootlin.com/u-boot/latest/source/drivers/usb/host/xhci-dwc3.c#L159

Linux: (__dwc3_of_simple_teardown)
https://elixir.bootlin.com/linux/latest/source/drivers/usb/dwc3/dwc3-of-simple.c#L98
U-Boot: (xhci_dwc3_remove)
https://elixir.bootlin.com/u-boot/latest/source/drivers/usb/host/xhci-dwc3.c#L227

So we believed that we can't directly pickup all Linux kernel dwc3 patches and merge to U-Boot.

#5 lore raw
Quoted 85 lines · Jit Loon
Quoted 68 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Thursday, 22 June, 2023 5:35 PM
To: Lim, Jit Loon <[email protected]>; [email protected]
Cc: Jagan Teki <[email protected]>; Simon <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Lokanathan, Raaj <[email protected]>; Maniyam, Dinesh <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Chong, Teik Heng <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Tang, Sieu Mun <[email protected]>; Bin Meng <[email protected]>; Michal Simek <[email protected]>; Tom Rini <[email protected]>; Eugen Hristev <[email protected]>
Subject: Re: [PATCH v1] HSD #18028953892: usb: xhci-dwc3: Fix USB3.1 controller register access in reset state

Quoted 33 lines · Jit Loon
Quoted 19 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, 21 June, 2023 10:19 PM
To: Lim, Jit Loon <[email protected]>; [email protected]
Cc: Jagan Teki <[email protected]>; Simon <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Lokanathan, Raaj <[email protected]>; Maniyam, Dinesh <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Chong, Teik Heng <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Tang, Sieu Mun <[email protected]>; Bin Meng <[email protected]>
Subject: Re: [PATCH v1] HSD #18028953892: usb: xhci-dwc3: Fix USB3.1 controller register access in reset state

Quoted 2 lines · Jit Loon Lim

From: Teik Heng Chong <[email protected]>

Quoted 8 lines
Quoted 4 lines

The controller registers should not be accessed while the controller's vcc_reset_n is asserted.

Is this patch ported from Linux or is this custom development ?

Is there a matching patch/fix in Linux already ?

In xhci_dwc3_probe(), the program sequence is vcc reset -> clk init -> phy setup -> xhci_register therefore, when xhci_dwc3_remove is called, the proper usb stop sequence should be xhci_register _> phy setup -> clk init -> vcc reset

Quoted 8 lines

if we look at linux driver
https://elixir.bootlin.com/linux/latest/source/drivers/usb/dwc3/dwc3-o
f-simple.c#L33

dwc3_of_simple_probe: The sequence is reset -> clock __dwc3_of_simple_teardown: Then, clock -> reset

So based on the above, we have made changes and the uboot fix is now

aligned with linux driver.

Instead of adding random patches to the U-Boot dwc3 driver, please just synchronize the driver with Linux. You should be able to add the missing patches to the DWC3 driver from Linux since the last synchronization point, the process should be largely mechanical. Make sure to include commit ID of each Linux commit in the new matching U-Boot patch.

Quoted 7 lines

It shouldn't be difficult, one approach I can think of is roughly this:
- figure out the original merge base from which the DWC3 driver was imported to U-Boot
- in U-Boot, revert all dwc3 patches on top of that import patch
- pick all Linux kernel dwc3 patches from that merge base and apply on top of this U-Boot with reverts
- Run rebase and drop the reverts, let git drop duplicate patches

We believed the previous reply from us is a bit confusing. There is no exact same function/file for U-Boot to use in Linux. What we are doing is, we are referring to Linux sequence.

Linux: (dwc3_of_simple_probe)
https://elixir.bootlin.com/linux/latest/source/drivers/usb/dwc3/dwc3-of-simple.c#L33
U-Boot: (xhci_dwc3_probe)
https://elixir.bootlin.com/u-boot/latest/source/drivers/usb/host/xhci-dwc3.c#L159

Quoted 6 lines

Linux: (__dwc3_of_simple_teardown)
https://elixir.bootlin.com/linux/latest/source/drivers/usb/dwc3/dwc3-of-simple.c#L98
U-Boot: (xhci_dwc3_remove)
https://elixir.bootlin.com/u-boot/latest/source/drivers/usb/host/xhci-dwc3.c#L227

So we believed that we can't directly pickup all Linux kernel dwc3 patches and merge to U-Boot.

If you were to sync the driver from Linux to U-Boot, then the same sequence as Linux uses would be automatically used too, right ?

Sorry for the abysmal delay in my reply.

#6 lore raw

Hi

Quoted 118 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Friday, 7 July, 2023 5:50 AM
To: Lim, Jit Loon <[email protected]>; [email protected]
Cc: Jagan Teki <[email protected]>; Simon <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Lokanathan, Raaj <[email protected]>; Maniyam, Dinesh <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Chong, Teik Heng <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Tang, Sieu Mun <[email protected]>; Bin Meng <[email protected]>; Michal Simek <[email protected]>; Tom Rini <[email protected]>; Eugen Hristev <[email protected]>
Subject: Re: [PATCH v1] HSD #18028953892: usb: xhci-dwc3: Fix USB3.1 controller register access in reset state

Quoted 9 lines · Jit Loon
Quoted 9 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Thursday, 22 June, 2023 5:35 PM
To: Lim, Jit Loon <[email protected]>; [email protected]
Cc: Jagan Teki <[email protected]>; Simon <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Lokanathan, Raaj <[email protected]>; Maniyam, Dinesh <[email protected]>; Ng, Boon Khai

<[email protected]>;

Quoted 10 lines
Quoted 10 lines

Yuslaimi, Alif Zakuan <[email protected]>; Chong, Teik Heng <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Tang, Sieu Mun <[email protected]>; Bin Meng <[email protected]>; Michal Simek <[email protected]>; Tom Rini <[email protected]>; Eugen Hristev <[email protected]>
Subject: Re: [PATCH v1] HSD #18028953892: usb: xhci-dwc3: Fix USB3.1 controller register access in reset state

On 6/22/23 04:48, Lim, Jit Loon wrote:

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, 21 June, 2023 10:19 PM
To: Lim, Jit Loon <[email protected]>; [email protected]
Cc: Jagan Teki <[email protected]>; Simon <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Lokanathan, Raaj <[email protected]>; Maniyam, Dinesh <[email protected]>; Ng, Boon Khai

<[email protected]>;

Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 10 lines

Yuslaimi, Alif Zakuan <[email protected]>; Chong, Teik Heng <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Tang, Sieu Mun <[email protected]>; Bin Meng <[email protected]>
Subject: Re: [PATCH v1] HSD #18028953892: usb: xhci-dwc3: Fix USB3.1 controller register access in reset state

Quoted 2 lines · Jit Loon Lim

From: Teik Heng Chong <[email protected]>

Quoted 8 lines
Quoted 4 lines

The controller registers should not be accessed while the controller's vcc_reset_n is asserted.

Is this patch ported from Linux or is this custom development ?

Is there a matching patch/fix in Linux already ?

In xhci_dwc3_probe(), the program sequence is vcc reset -> clk init -> phy setup -> xhci_register therefore, when xhci_dwc3_remove is called, the proper usb stop sequence should be xhci_register _> phy setup -> clk init -> vcc reset

if we look at linux driver
https://elixir.bootlin.com/linux/latest/source/drivers/usb/dwc3/dwc3
-o
f-simple.c#L33

dwc3_of_simple_probe: The sequence is reset -> clock __dwc3_of_simple_teardown: Then, clock -> reset

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

So based on the above, we have made changes and the uboot fix is now

aligned with linux driver.

Instead of adding random patches to the U-Boot dwc3 driver, please just synchronize the driver with Linux. You should be able to add the missing patches to the DWC3 driver from Linux since the last synchronization point, the process should be largely mechanical. Make sure to include commit ID of each Linux commit in the new matching U-

Boot patch.

Quoted 27 lines
Quoted 8 lines

It shouldn't be difficult, one approach I can think of is roughly this:
- figure out the original merge base from which the DWC3 driver was imported to U-Boot
- in U-Boot, revert all dwc3 patches on top of that import patch
- pick all Linux kernel dwc3 patches from that merge base and apply on top of this U-Boot with reverts
- Run rebase and drop the reverts, let git drop duplicate patches

We believed the previous reply from us is a bit confusing. There is no exact same function/file for U-Boot to use in Linux. What we are doing is, we are referring to Linux sequence.

Linux: (dwc3_of_simple_probe)
https://elixir.bootlin.com/linux/latest/source/drivers/usb/dwc3/dwc3-o
f-simple.c#L33
U-Boot: (xhci_dwc3_probe)
https://elixir.bootlin.com/u-boot/latest/source/drivers/usb/host/xhci-
dwc3.c#L159

Linux: (__dwc3_of_simple_teardown)
https://elixir.bootlin.com/linux/latest/source/drivers/usb/dwc3/dwc3-o
f-simple.c#L98
U-Boot: (xhci_dwc3_remove)
https://elixir.bootlin.com/u-boot/latest/source/drivers/usb/host/xhci-
dwc3.c#L227

Quoted 7 lines
Quoted 1 line

So we believed that we can't directly pickup all Linux kernel dwc3 patches

and merge to U-Boot.

If you were to sync the driver from Linux to U-Boot, then the same sequence as Linux uses would be automatically used too, right ?

Sorry for the abysmal delay in my reply.

Are we saying that we shall port/use Linux driver in U-Boot and abandon the existing USB host driver in U-Boot?

#7 lore raw

On 7/21/23 05:26, Lim, Jit Loon wrote:

Hi,

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Linux: (__dwc3_of_simple_teardown)
https://elixir.bootlin.com/linux/latest/source/drivers/usb/dwc3/dwc3-o
f-simple.c#L98
U-Boot: (xhci_dwc3_remove)
https://elixir.bootlin.com/u-boot/latest/source/drivers/usb/host/xhci-
dwc3.c#L227

So we believed that we can't directly pickup all Linux kernel dwc3 patches

Quoted 8 lines
Quoted 6 lines

and merge to U-Boot.

If you were to sync the driver from Linux to U-Boot, then the same sequence as Linux uses would be automatically used too, right ?

Sorry for the abysmal delay in my reply.

Are we saying that we shall port/use Linux driver in U-Boot and abandon the existing USB host driver in U-Boot?

No, the existing driver in U-Boot is a port of the Linux driver, it is just outdated. I am saying, just pick the missing patches from Linux and add them to U-Boot, so the two drivers are in sync.

#8 lore raw

Hi

Quoted 38 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Saturday, 22 July, 2023 4:31 AM
To: Lim, Jit Loon <[email protected]>; [email protected]
Cc: Jagan Teki <[email protected]>; Simon <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Maniyam, Dinesh <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Chong, Teik Heng <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Tang, Sieu Mun <[email protected]>; Bin Meng <[email protected]>; Michal Simek <[email protected]>; Tom Rini <[email protected]>; Eugen Hristev <[email protected]>
Subject: Re: [PATCH v1] HSD #18028953892: usb: xhci-dwc3: Fix USB3.1 controller register access in reset state

On 7/21/23 05:26, Lim, Jit Loon wrote:

Hi,

Quoted 16 lines
Quoted 16 lines
Quoted 11 lines

Linux: (__dwc3_of_simple_teardown)
https://elixir.bootlin.com/linux/latest/source/drivers/usb/dwc3/dwc3
-o
f-simple.c#L98
U-Boot: (xhci_dwc3_remove)
https://elixir.bootlin.com/u-boot/latest/source/drivers/usb/host/xhc
i-
dwc3.c#L227

So we believed that we can't directly pickup all Linux kernel dwc3 patches

and merge to U-Boot.

If you were to sync the driver from Linux to U-Boot, then the same sequence as Linux uses would be automatically used too, right ?

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Sorry for the abysmal delay in my reply.

Are we saying that we shall port/use Linux driver in U-Boot and abandon

the existing USB host driver in U-Boot?

No, the existing driver in U-Boot is a port of the Linux driver, it is just outdated. I am saying, just pick the missing patches from Linux and add them to U-Boot, so the two drivers are in sync.

We do not see a DWC3 host driver under usb host folder in Linux https://elixir.bootlin.com/linux/latest/source/drivers/usb/host. Would you mind to tell us which DWC3 host driver we should use in usb host folder? Then, we can pick up the missing patches

#9 lore raw

On 7/26/23 06:04, Chong, Teik Heng wrote:
[...]

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
Quoted 11 lines

Linux: (__dwc3_of_simple_teardown)
https://elixir.bootlin.com/linux/latest/source/drivers/usb/dwc3/dwc3
-o
f-simple.c#L98
U-Boot: (xhci_dwc3_remove)
https://elixir.bootlin.com/u-boot/latest/source/drivers/usb/host/xhc
i-
dwc3.c#L227

So we believed that we can't directly pickup all Linux kernel dwc3 patches

and merge to U-Boot.

If you were to sync the driver from Linux to U-Boot, then the same sequence as Linux uses would be automatically used too, right ?

Sorry for the abysmal delay in my reply.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Are we saying that we shall port/use Linux driver in U-Boot and abandon

the existing USB host driver in U-Boot?

No, the existing driver in U-Boot is a port of the Linux driver, it is just outdated. I am saying, just pick the missing patches from Linux and add them to U-Boot, so the two drivers are in sync.

We do not see a DWC3 host driver under usb host folder in Linux https://elixir.bootlin.com/linux/latest/source/drivers/usb/host. Would you mind to tell us which DWC3 host driver we should use in usb host folder? Then, we can pick up the missing patches

drivers/usb/dwc3

Same as u-boot

#10 lore raw

Hi

Quoted 48 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, 26 July, 2023 6:30 PM
To: Chong, Teik Heng <[email protected]>; Lim, Jit Loon <[email protected]>; [email protected]
Cc: Jagan Teki <[email protected]>; Simon <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Maniyam, Dinesh <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Tang, Sieu Mun <[email protected]>; Bin Meng <[email protected]>; Michal Simek <[email protected]>; Tom Rini <[email protected]>; Eugen Hristev <[email protected]>
Subject: Re: [PATCH v1] HSD #18028953892: usb: xhci-dwc3: Fix USB3.1 controller register access in reset state

On 7/26/23 06:04, Chong, Teik Heng wrote:
[...]

Quoted 28 lines
Quoted 27 lines
Quoted 15 lines
Quoted 15 lines
Quoted 11 lines

Linux: (__dwc3_of_simple_teardown)
https://elixir.bootlin.com/linux/latest/source/drivers/usb/dwc3/dw
c3
-o
f-simple.c#L98
U-Boot: (xhci_dwc3_remove)
https://elixir.bootlin.com/u-boot/latest/source/drivers/usb/host/x
hc
i-
dwc3.c#L227

Quoted 2 lines

So we believed that we can't directly pickup all Linux kernel dwc3 patches

and merge to U-Boot.

Quoted 7 lines
Quoted 4 lines

If you were to sync the driver from Linux to U-Boot, then the same sequence as Linux uses would be automatically used too, right ?

Sorry for the abysmal delay in my reply.

Are we saying that we shall port/use Linux driver in U-Boot and abandon

the existing USB host driver in U-Boot?

No, the existing driver in U-Boot is a port of the Linux driver, it is just outdated. I am saying, just pick the missing patches from Linux and add them to U-Boot, so the two drivers are in sync.

Quoted 8 lines
Quoted 4 lines

We do not see a DWC3 host driver under usb host folder in Linux
https://elixir.bootlin.com/linux/latest/source/drivers/usb/host. Would you mind to tell us which DWC3 host driver we should use in usb host folder? Then, we can pick up the missing patches

drivers/usb/dwc3

Same as u-boot

Ok. We will use the driver from drivers/usb/dwc3. Thank you for the pointers

#11 lore raw
In reply to Jit Loon Lim
Quoted 28 lines · Jit Loon Lim

From: Teik Heng Chong <[email protected]>

The controller registers should not be accessed while the controller's vcc_reset_n is asserted.

---
 drivers/usb/host/xhci-dwc3.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-dwc3.c +5 -0
index 1dbd65dfaa..3172956bd6 100644
@@ -227,6 +227,11 @@ static int xhci_dwc3_probe(struct udevice *dev)
 static int xhci_dwc3_remove(struct udevice *dev)
 {
        struct xhci_dwc3_plat *plat = dev_get_plat(dev);
+       int ret;
+
+       ret = xhci_deregister(dev);
+       if (ret)
+               return ret;
 
        dwc3_shutdown_phy(dev, &plat->phys);
 

drivers/usb/host/xhci-dwc3.c static int xhci_dwc3_remove(struct udevice *dev) · line 245

Quoted 8 lines
drivers/usb/host/xhci-dwc3.c +1 -1
@@ -234,7 +239,7 @@ static int xhci_dwc3_remove(struct udevice *dev)
 
        reset_release_bulk(&plat->resets);
 
-       return xhci_deregister(dev);
+       return 0;
 }
 
 static const struct udevice_id xhci_dwc3_ids[] = {

Please remove the HSD tag in the commit summary.

Regards,
Bin