diff mbox series

board: st: stm32mp1: Consider USB cable connected when boot device is USB

Message ID 20220422073918.15918-1-patrice.chotard@foss.st.com
State Accepted
Commit 67899c2201a8009a1ea6bee55fe812fd298ca79e
Delegated to: Patrick Delaunay
Headers show
Series board: st: stm32mp1: Consider USB cable connected when boot device is USB | expand

Commit Message

Patrice CHOTARD April 22, 2022, 7:39 a.m. UTC
Always consider USB cable is connected when USB boot device is detected.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
---

 board/st/stm32mp1/stm32mp1.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Patrick DELAUNAY May 6, 2022, 8:51 a.m. UTC | #1
Hi,

On 4/22/22 09:39, Patrice Chotard wrote:
> Always consider USB cable is connected when USB boot device is detected.
>
> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
> ---
>
>   board/st/stm32mp1/stm32mp1.c | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
> index fff1880e5b..62a5fc23e6 100644
> --- a/board/st/stm32mp1/stm32mp1.c
> +++ b/board/st/stm32mp1/stm32mp1.c
> @@ -199,6 +199,13 @@ int g_dnl_board_usb_cable_connected(void)
>   	if (!IS_ENABLED(CONFIG_USB_GADGET_DWC2_OTG))
>   		return -ENODEV;
>   
> +	/*
> +	 * In case of USB boot device is detected, consider USB cable is
> +	 * connected
> +	 */
> +	if ((get_bootmode() & TAMP_BOOT_DEVICE_MASK) == BOOT_SERIAL_USB)
> +		return true;
> +
>   	/* if typec stusb160x is present, means DK1 or DK2 board */
>   	ret = stusb160x_cable_connected();
>   	if (ret >= 0)


Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

Thanks
Patrick
Patrice CHOTARD May 10, 2022, 8:42 a.m. UTC | #2
On 5/6/22 10:51, Patrick DELAUNAY wrote:
> Hi,
> 
> On 4/22/22 09:39, Patrice Chotard wrote:
>> Always consider USB cable is connected when USB boot device is detected.
>>
>> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
>> ---
>>
>>   board/st/stm32mp1/stm32mp1.c | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
>> index fff1880e5b..62a5fc23e6 100644
>> --- a/board/st/stm32mp1/stm32mp1.c
>> +++ b/board/st/stm32mp1/stm32mp1.c
>> @@ -199,6 +199,13 @@ int g_dnl_board_usb_cable_connected(void)
>>       if (!IS_ENABLED(CONFIG_USB_GADGET_DWC2_OTG))
>>           return -ENODEV;
>>   +    /*
>> +     * In case of USB boot device is detected, consider USB cable is
>> +     * connected
>> +     */
>> +    if ((get_bootmode() & TAMP_BOOT_DEVICE_MASK) == BOOT_SERIAL_USB)
>> +        return true;
>> +
>>       /* if typec stusb160x is present, means DK1 or DK2 board */
>>       ret = stusb160x_cable_connected();
>>       if (ret >= 0)
> 
> 
> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> 
> Thanks
> Patrick
> 
> 
Applied to u-boot-stm32

Thanks
Patrice
diff mbox series

Patch

diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index fff1880e5b..62a5fc23e6 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -199,6 +199,13 @@  int g_dnl_board_usb_cable_connected(void)
 	if (!IS_ENABLED(CONFIG_USB_GADGET_DWC2_OTG))
 		return -ENODEV;
 
+	/*
+	 * In case of USB boot device is detected, consider USB cable is
+	 * connected
+	 */
+	if ((get_bootmode() & TAMP_BOOT_DEVICE_MASK) == BOOT_SERIAL_USB)
+		return true;
+
 	/* if typec stusb160x is present, means DK1 or DK2 board */
 	ret = stusb160x_cable_connected();
 	if (ret >= 0)