mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] usb: dwc3: remove CONFIG_USB_ROLE_SWITCH in condition
@ 2025-08-05 14:38 Stefan Kerkmann
  2025-08-05 15:55 ` Ahmad Fatoum
  2025-08-06  4:55 ` Sascha Hauer
  0 siblings, 2 replies; 4+ messages in thread
From: Stefan Kerkmann @ 2025-08-05 14:38 UTC (permalink / raw)
  To: Sascha Hauer, BAREBOX; +Cc: Stefan Kerkmann

CONFIG_USB_ROLE_SWITCH is only defined in the kernel and is always
undefined in barebox.

Signed-off-by: Stefan Kerkmann <s.kerkmann@pengutronix.de>
---
 drivers/usb/dwc3/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index dfc9c85ad8b70756d8f177d41bd53a7f412afbd9..985213deb4f1c96282138a98bf5e2aa4d65cbca6 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -70,8 +70,7 @@ static int dwc3_get_dr_mode(struct dwc3 *dwc)
 		 * specified or set to OTG, then set the mode to peripheral.
 		 */
 		if (mode == USB_DR_MODE_OTG && !dwc->edev &&
-		    (!IS_ENABLED(CONFIG_USB_ROLE_SWITCH) ||
-		     !of_property_read_bool(dwc->dev->of_node, "usb-role-switch")) &&
+		    (!of_property_read_bool(dwc->dev->of_node, "usb-role-switch")) &&
 		    !DWC3_VER_IS_PRIOR(DWC3, 330A))
 			mode = USB_DR_MODE_PERIPHERAL;
 	}

---
base-commit: 7be8b1bcb8aeb249e9d55f70ccb5ea93711e8efa
change-id: 20250805-fix-dwc3-dr-mode-99b4893c2531

Best regards,
-- 
Stefan Kerkmann <s.kerkmann@pengutronix.de>




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb: dwc3: remove CONFIG_USB_ROLE_SWITCH in condition
  2025-08-05 14:38 [PATCH] usb: dwc3: remove CONFIG_USB_ROLE_SWITCH in condition Stefan Kerkmann
@ 2025-08-05 15:55 ` Ahmad Fatoum
  2025-08-06  7:17   ` Stefan Kerkmann
  2025-08-06  4:55 ` Sascha Hauer
  1 sibling, 1 reply; 4+ messages in thread
From: Ahmad Fatoum @ 2025-08-05 15:55 UTC (permalink / raw)
  To: Stefan Kerkmann, Sascha Hauer, BAREBOX

On 05.08.25 16:38, Stefan Kerkmann wrote:
> CONFIG_USB_ROLE_SWITCH is only defined in the kernel and is always
> undefined in barebox.
> 
> Signed-off-by: Stefan Kerkmann <s.kerkmann@pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

Does this fix an annoying warning from the driver?

I wondered about this before...

Cheers,
Ahmad

> ---
>  drivers/usb/dwc3/core.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index dfc9c85ad8b70756d8f177d41bd53a7f412afbd9..985213deb4f1c96282138a98bf5e2aa4d65cbca6 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -70,8 +70,7 @@ static int dwc3_get_dr_mode(struct dwc3 *dwc)
>  		 * specified or set to OTG, then set the mode to peripheral.
>  		 */
>  		if (mode == USB_DR_MODE_OTG && !dwc->edev &&
> -		    (!IS_ENABLED(CONFIG_USB_ROLE_SWITCH) ||
> -		     !of_property_read_bool(dwc->dev->of_node, "usb-role-switch")) &&
> +		    (!of_property_read_bool(dwc->dev->of_node, "usb-role-switch")) &&
>  		    !DWC3_VER_IS_PRIOR(DWC3, 330A))
>  			mode = USB_DR_MODE_PERIPHERAL;
>  	}
> 
> ---
> base-commit: 7be8b1bcb8aeb249e9d55f70ccb5ea93711e8efa
> change-id: 20250805-fix-dwc3-dr-mode-99b4893c2531
> 
> Best regards,


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb: dwc3: remove CONFIG_USB_ROLE_SWITCH in condition
  2025-08-05 14:38 [PATCH] usb: dwc3: remove CONFIG_USB_ROLE_SWITCH in condition Stefan Kerkmann
  2025-08-05 15:55 ` Ahmad Fatoum
@ 2025-08-06  4:55 ` Sascha Hauer
  1 sibling, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2025-08-06  4:55 UTC (permalink / raw)
  To: BAREBOX, Stefan Kerkmann


On Tue, 05 Aug 2025 16:38:48 +0200, Stefan Kerkmann wrote:
> CONFIG_USB_ROLE_SWITCH is only defined in the kernel and is always
> undefined in barebox.
> 
> 

Applied, thanks!

[1/1] usb: dwc3: remove CONFIG_USB_ROLE_SWITCH in condition
      https://git.pengutronix.de/cgit/barebox/commit/?id=fcd07ec1ec58 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb: dwc3: remove CONFIG_USB_ROLE_SWITCH in condition
  2025-08-05 15:55 ` Ahmad Fatoum
@ 2025-08-06  7:17   ` Stefan Kerkmann
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Kerkmann @ 2025-08-06  7:17 UTC (permalink / raw)
  To: Ahmad Fatoum, Sascha Hauer, BAREBOX

Hi Ahmad,

On 05.08.25 17:55, Ahmad Fatoum wrote:
> On 05.08.25 16:38, Stefan Kerkmann wrote:
>> CONFIG_USB_ROLE_SWITCH is only defined in the kernel and is always
>> undefined in barebox.
>>
>> Signed-off-by: Stefan Kerkmann <s.kerkmann@pengutronix.de>
> 
> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> 
> Does this fix an annoying warning from the driver?
> 

I do think so. My understanding is that this also coerced the mode to peripheral
even if otg was chosen as `!IS_ENABLED(CONFIG_USB_ROLE_SWITCH)` always evaluated
to true.

> I wondered about this before...
> 
> Cheers,
> Ahmad
> 

Cheers,
Stefan

>> ---
>>  drivers/usb/dwc3/core.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
>> index dfc9c85ad8b70756d8f177d41bd53a7f412afbd9..985213deb4f1c96282138a98bf5e2aa4d65cbca6 100644
>> --- a/drivers/usb/dwc3/core.c
>> +++ b/drivers/usb/dwc3/core.c
>> @@ -70,8 +70,7 @@ static int dwc3_get_dr_mode(struct dwc3 *dwc)
>>  		 * specified or set to OTG, then set the mode to peripheral.
>>  		 */
>>  		if (mode == USB_DR_MODE_OTG && !dwc->edev &&
>> -		    (!IS_ENABLED(CONFIG_USB_ROLE_SWITCH) ||
>> -		     !of_property_read_bool(dwc->dev->of_node, "usb-role-switch")) &&
>> +		    (!of_property_read_bool(dwc->dev->of_node, "usb-role-switch")) &&
>>  		    !DWC3_VER_IS_PRIOR(DWC3, 330A))
>>  			mode = USB_DR_MODE_PERIPHERAL;
>>  	}
>>
>> ---
>> base-commit: 7be8b1bcb8aeb249e9d55f70ccb5ea93711e8efa
>> change-id: 20250805-fix-dwc3-dr-mode-99b4893c2531
>>
>> Best regards,
> 
> 

-- 
Pengutronix e.K.                       | Stefan Kerkmann             |
Steuerwalder Str. 21                   | https://www.pengutronix.de/ |
31137 Hildesheim, Germany              | Phone: +49-5121-206917-128  |
Amtsgericht Hildesheim, HRA 2686       | Fax:   +49-5121-206917-9    |




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-06  7:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-05 14:38 [PATCH] usb: dwc3: remove CONFIG_USB_ROLE_SWITCH in condition Stefan Kerkmann
2025-08-05 15:55 ` Ahmad Fatoum
2025-08-06  7:17   ` Stefan Kerkmann
2025-08-06  4:55 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox