[PATCH v4 0/2] Fix 'no USB device found' error.

This series fixes the "No USB device found" error for am335x-icev2 and am335x-evmsk. USB0 dual-role feature is now handled as peripheral only in the driver.
The error was not produced for am335x-evm because usb0 dr_mode was configured as peripheral in 'am335x-evm-u-boot.dtsi'. This fragment is no longer needed.
Signed-off-by: Julien Panis jpanis@baylibre.com --- Changes in v4: - Handle usb dual-role feature as peripheral in ti-musb driver. - Link to v3: https://lore.kernel.org/r/20230621-fix_usb_ether_init-v3-1-40493e1d7c0b@bayl...
Changes in v3: - Remove usb0 dr_mode configuration from 'am335x-evm-u-boot.dtsi'. - Link to v2: https://lore.kernel.org/r/20230621-fix_usb_ether_init-v2-0-ff121f0e8d7a@bayl...
Changes in v2: - Drop the modification made in arch/arm/mach-omap2/am33xx/board.c - Configure usb0 dr_mode as peripheral in 'am335x-icev2-u-boot.dtsi' and 'am335x-evmsk-u-boot.dtsi' device trees. - Link to v1: https://lore.kernel.org/r/20230621-fix_usb_ether_init-v1-1-2156923994a9@bayl...
--- Julien Panis (2): musb-new: ti-musb: Handle usb dual-role feature as peripheral arm: dts: am335x-evm-u-boot: Remove usb0 mode configuration
arch/arm/dts/am335x-evm-u-boot.dtsi | 4 ---- drivers/usb/musb-new/ti-musb.c | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) --- base-commit: 19b77d3d23966a0d6dbb3c86187765f11100fb6f change-id: 20230621-fix_usb_ether_init-4bf4f1135113
Best regards,

This prevents from getting some 'No USB device found' error, in usb_ether_init() function for instance.
Signed-off-by: Julien Panis jpanis@baylibre.com --- drivers/usb/musb-new/ti-musb.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c index 3be3f93dd85d..44697dc31387 100644 --- a/drivers/usb/musb-new/ti-musb.c +++ b/drivers/usb/musb-new/ti-musb.c @@ -302,6 +302,7 @@ static int ti_musb_wrapper_bind(struct udevice *parent) dr_mode = usb_get_dr_mode(node); switch (dr_mode) { case USB_DR_MODE_PERIPHERAL: + case USB_DR_MODE_OTG: /* Bind MUSB device */ ret = device_bind_driver_to_node(parent, "ti-musb-peripheral",

* Julien Panis jpanis@baylibre.com [230706 10:41]:
This prevents from getting some 'No USB device found' error, in usb_ether_init() function for instance.
Looks good to me:
Reviewed-by: Tony Lindgren tony@atomide.com

On 12:40-20230706, Julien Panis wrote:
This prevents from getting some 'No USB device found' error, in usb_ether_init() function for instance.
Signed-off-by: Julien Panis jpanis@baylibre.com
drivers/usb/musb-new/ti-musb.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c index 3be3f93dd85d..44697dc31387 100644 --- a/drivers/usb/musb-new/ti-musb.c +++ b/drivers/usb/musb-new/ti-musb.c @@ -302,6 +302,7 @@ static int ti_musb_wrapper_bind(struct udevice *parent) dr_mode = usb_get_dr_mode(node); switch (dr_mode) { case USB_DR_MODE_PERIPHERAL:
case USB_DR_MODE_OTG: /* Bind MUSB device */ ret = device_bind_driver_to_node(parent, "ti-musb-peripheral",
-- 2.37.3
Reviewed-by: Nishanth Menon nm@ti.com

On Thu, Jul 06, 2023 at 12:40:22PM +0200, Julien Panis wrote:
This prevents from getting some 'No USB device found' error, in usb_ether_init() function for instance.
Signed-off-by: Julien Panis jpanis@baylibre.com Reviewed-by: Tony Lindgren tony@atomide.com Reviewed-by: Nishanth Menon nm@ti.com
drivers/usb/musb-new/ti-musb.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c index 3be3f93dd85d..44697dc31387 100644 --- a/drivers/usb/musb-new/ti-musb.c +++ b/drivers/usb/musb-new/ti-musb.c @@ -302,6 +302,7 @@ static int ti_musb_wrapper_bind(struct udevice *parent) dr_mode = usb_get_dr_mode(node); switch (dr_mode) { case USB_DR_MODE_PERIPHERAL:
case USB_DR_MODE_OTG: /* Bind MUSB device */ ret = device_bind_driver_to_node(parent, "ti-musb-peripheral",
Julien, why don't we support OTG mode here instead?

On 8/14/23 19:18, Tom Rini wrote:
On Thu, Jul 06, 2023 at 12:40:22PM +0200, Julien Panis wrote:
This prevents from getting some 'No USB device found' error, in usb_ether_init() function for instance.
Signed-off-by: Julien Panis jpanis@baylibre.com Reviewed-by: Tony Lindgren tony@atomide.com Reviewed-by: Nishanth Menon nm@ti.com
drivers/usb/musb-new/ti-musb.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c index 3be3f93dd85d..44697dc31387 100644 --- a/drivers/usb/musb-new/ti-musb.c +++ b/drivers/usb/musb-new/ti-musb.c @@ -302,6 +302,7 @@ static int ti_musb_wrapper_bind(struct udevice *parent) dr_mode = usb_get_dr_mode(node); switch (dr_mode) { case USB_DR_MODE_PERIPHERAL:
case USB_DR_MODE_OTG: /* Bind MUSB device */ ret = device_bind_driver_to_node(parent, "ti-musb-peripheral",
Julien, why don't we support OTG mode here instead?
Roger, can this be achieved with this controller ?

Hi Julien,
On 21/08/2023 11:28, Julien Panis wrote:
On 8/14/23 19:18, Tom Rini wrote:
On Thu, Jul 06, 2023 at 12:40:22PM +0200, Julien Panis wrote:
This prevents from getting some 'No USB device found' error, in usb_ether_init() function for instance.
Signed-off-by: Julien Panis jpanis@baylibre.com Reviewed-by: Tony Lindgren tony@atomide.com Reviewed-by: Nishanth Menon nm@ti.com
drivers/usb/musb-new/ti-musb.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c index 3be3f93dd85d..44697dc31387 100644 --- a/drivers/usb/musb-new/ti-musb.c +++ b/drivers/usb/musb-new/ti-musb.c @@ -302,6 +302,7 @@ static int ti_musb_wrapper_bind(struct udevice *parent) dr_mode = usb_get_dr_mode(node); switch (dr_mode) { case USB_DR_MODE_PERIPHERAL: + case USB_DR_MODE_OTG: /* Bind MUSB device */ ret = device_bind_driver_to_node(parent, "ti-musb-peripheral",
Julien, why don't we support OTG mode here instead?
Roger, can this be achieved with this controller ?
The Controller supports OTG mode but I'm not sure of the u-boot driver.
Bin / Stephan might know.

On 8/21/23 14:16, Roger Quadros wrote:
Hi Julien,
On 21/08/2023 11:28, Julien Panis wrote:
On 8/14/23 19:18, Tom Rini wrote:
On Thu, Jul 06, 2023 at 12:40:22PM +0200, Julien Panis wrote:
This prevents from getting some 'No USB device found' error, in usb_ether_init() function for instance.
Signed-off-by: Julien Panis jpanis@baylibre.com Reviewed-by: Tony Lindgren tony@atomide.com Reviewed-by: Nishanth Menon nm@ti.com
drivers/usb/musb-new/ti-musb.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c index 3be3f93dd85d..44697dc31387 100644 --- a/drivers/usb/musb-new/ti-musb.c +++ b/drivers/usb/musb-new/ti-musb.c @@ -302,6 +302,7 @@ static int ti_musb_wrapper_bind(struct udevice *parent) dr_mode = usb_get_dr_mode(node); switch (dr_mode) { case USB_DR_MODE_PERIPHERAL: + case USB_DR_MODE_OTG: /* Bind MUSB device */ ret = device_bind_driver_to_node(parent, "ti-musb-peripheral",
Julien, why don't we support OTG mode here instead?
Roger, can this be achieved with this controller ?
The Controller supports OTG mode but I'm not sure of the u-boot driver.
Bin / Stephan might know.
Surely the controller supports both Host and Peripheral mode.

On Mon, Aug 21, 2023 at 03:40:42PM +0200, Marek Vasut wrote:
On 8/21/23 14:16, Roger Quadros wrote:
Hi Julien,
On 21/08/2023 11:28, Julien Panis wrote:
On 8/14/23 19:18, Tom Rini wrote:
On Thu, Jul 06, 2023 at 12:40:22PM +0200, Julien Panis wrote:
This prevents from getting some 'No USB device found' error, in usb_ether_init() function for instance.
Signed-off-by: Julien Panis jpanis@baylibre.com Reviewed-by: Tony Lindgren tony@atomide.com Reviewed-by: Nishanth Menon nm@ti.com
drivers/usb/musb-new/ti-musb.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c index 3be3f93dd85d..44697dc31387 100644 --- a/drivers/usb/musb-new/ti-musb.c +++ b/drivers/usb/musb-new/ti-musb.c @@ -302,6 +302,7 @@ static int ti_musb_wrapper_bind(struct udevice *parent) dr_mode = usb_get_dr_mode(node); switch (dr_mode) { case USB_DR_MODE_PERIPHERAL: + case USB_DR_MODE_OTG: /* Bind MUSB device */ ret = device_bind_driver_to_node(parent, "ti-musb-peripheral",
Julien, why don't we support OTG mode here instead?
Roger, can this be achieved with this controller ?
The Controller supports OTG mode but I'm not sure of the u-boot driver.
Bin / Stephan might know.
Surely the controller supports both Host and Peripheral mode.
And perhaps the other half of the disconnect here is that DWC2/DWC3 at least behave in U-Boot as Marek is asking.

USB0 dual-role feature is now handled as peripheral only in ti-musb driver.
Signed-off-by: Julien Panis jpanis@baylibre.com --- arch/arm/dts/am335x-evm-u-boot.dtsi | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/arch/arm/dts/am335x-evm-u-boot.dtsi b/arch/arm/dts/am335x-evm-u-boot.dtsi index 82a483ae3e28..42eeca8c0499 100644 --- a/arch/arm/dts/am335x-evm-u-boot.dtsi +++ b/arch/arm/dts/am335x-evm-u-boot.dtsi @@ -23,10 +23,6 @@ status = "disabled"; };
-&usb0 { - dr_mode = "peripheral"; -}; - &i2c0 { bootph-all; };

On 12:40-20230706, Julien Panis wrote:
USB0 dual-role feature is now handled as peripheral only in ti-musb driver.
Signed-off-by: Julien Panis jpanis@baylibre.com
arch/arm/dts/am335x-evm-u-boot.dtsi | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/arch/arm/dts/am335x-evm-u-boot.dtsi b/arch/arm/dts/am335x-evm-u-boot.dtsi index 82a483ae3e28..42eeca8c0499 100644 --- a/arch/arm/dts/am335x-evm-u-boot.dtsi +++ b/arch/arm/dts/am335x-evm-u-boot.dtsi @@ -23,10 +23,6 @@ status = "disabled"; };
-&usb0 {
- dr_mode = "peripheral";
-};
&i2c0 { bootph-all; };
-- 2.37.3
Reviewed-by: Nishanth Menon nm@ti.com

Hi Julien,
On 06/07/2023 13:40, Julien Panis wrote:
This series fixes the "No USB device found" error for am335x-icev2 and am335x-evmsk. USB0 dual-role feature is now handled as peripheral only in the driver.
The error was not produced for am335x-evm because usb0 dr_mode was configured as peripheral in 'am335x-evm-u-boot.dtsi'. This fragment is no longer needed.
Signed-off-by: Julien Panis jpanis@baylibre.com
Changes in v4:
- Handle usb dual-role feature as peripheral in ti-musb driver.
- Link to v3: https://lore.kernel.org/r/20230621-fix_usb_ether_init-v3-1-40493e1d7c0b@bayl...
Changes in v3:
- Remove usb0 dr_mode configuration from 'am335x-evm-u-boot.dtsi'.
- Link to v2: https://lore.kernel.org/r/20230621-fix_usb_ether_init-v2-0-ff121f0e8d7a@bayl...
Changes in v2:
- Drop the modification made in arch/arm/mach-omap2/am33xx/board.c
- Configure usb0 dr_mode as peripheral in 'am335x-icev2-u-boot.dtsi' and 'am335x-evmsk-u-boot.dtsi' device trees.
- Link to v1: https://lore.kernel.org/r/20230621-fix_usb_ether_init-v1-1-2156923994a9@bayl...
Julien Panis (2): musb-new: ti-musb: Handle usb dual-role feature as peripheral arm: dts: am335x-evm-u-boot: Remove usb0 mode configuration
for this series: Reviewed-by: Roger Quadros rogerq@kernel.org
I also see other boards doing the wrong thing. i.e. replacing 'otg' with 'peripheral'.
dra71-evm-u-boot.dtsi: dr_mode = "peripheral"; dra72-evm-revc-u-boot.dtsi: dr_mode = "peripheral"; dra72-evm-u-boot.dtsi: dr_mode = "peripheral"; dra76-evm-u-boot.dtsi: dr_mode = "peripheral"; dra7-evm-u-boot.dtsi: dr_mode = "peripheral"; k3-am642-evm-u-boot.dtsi: dr_mode="peripheral"; k3-am654-r5-base-board-u-boot.dtsi: dr_mode = "peripheral"; k3-am654-r5-base-board-u-boot.dtsi: dr_mode = "peripheral"; k3-j7200-common-proc-board-u-boot.dtsi: dr_mode = "peripheral"; k3-j721e-common-proc-board-u-boot.dtsi: dr_mode = "peripheral"; keystone-k2e-evm-u-boot.dtsi: dr_mode = "peripheral";
Is this something you can fix (in dwc3 driver) as it is on similar lines ;). Thanks!
participants (6)
-
Julien Panis
-
Marek Vasut
-
Nishanth Menon
-
Roger Quadros
-
Tom Rini
-
Tony Lindgren