2020-07-27 09:26:22

by Amelie Delaunay

[permalink] [raw]
Subject: [PATCH v4 3/3] usb: dwc2: don't use ID/Vbus detection if usb-role-switch on STM32MP15 SoCs

If usb-role-switch is present in the device tree, it means that ID and Vbus
signals are not connected to the OTG controller but to an external
component (GPIOs, Type-C controller). In this configuration, usb role
switch is used to force valid sessions on STM32MP15 SoCs.

Acked-by: Minas Harutyunyan <[email protected]>
Signed-off-by: Amelie Delaunay <[email protected]>
---
No changes in v4.
---
drivers/usb/dwc2/params.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
index a3611cdd1dea..65f8596f6795 100644
--- a/drivers/usb/dwc2/params.c
+++ b/drivers/usb/dwc2/params.c
@@ -183,9 +183,11 @@ static void dwc2_set_stm32mp15_fsotg_params(struct dwc2_hsotg *hsotg)
static void dwc2_set_stm32mp15_hsotg_params(struct dwc2_hsotg *hsotg)
{
struct dwc2_core_params *p = &hsotg->params;
+ struct device_node *np = hsotg->dev->of_node;

p->otg_cap = DWC2_CAP_PARAM_NO_HNP_SRP_CAPABLE;
- p->activate_stm_id_vb_detection = true;
+ p->activate_stm_id_vb_detection =
+ !of_property_read_bool(np, "usb-role-switch");
p->host_rx_fifo_size = 440;
p->host_nperio_tx_fifo_size = 256;
p->host_perio_tx_fifo_size = 256;
--
2.17.1


2020-07-27 19:03:12

by Martin Blumenstingl

[permalink] [raw]
Subject: Re: [PATCH v4 3/3] usb: dwc2: don't use ID/Vbus detection if usb-role-switch on STM32MP15 SoCs

Hi Amelie,

On Mon, Jul 27, 2020 at 11:23 AM Amelie Delaunay <[email protected]> wrote:
[...]
> diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
> index a3611cdd1dea..65f8596f6795 100644
> --- a/drivers/usb/dwc2/params.c
> +++ b/drivers/usb/dwc2/params.c
> @@ -183,9 +183,11 @@ static void dwc2_set_stm32mp15_fsotg_params(struct dwc2_hsotg *hsotg)
> static void dwc2_set_stm32mp15_hsotg_params(struct dwc2_hsotg *hsotg)
> {
> struct dwc2_core_params *p = &hsotg->params;
> + struct device_node *np = hsotg->dev->of_node;
>
> p->otg_cap = DWC2_CAP_PARAM_NO_HNP_SRP_CAPABLE;
> - p->activate_stm_id_vb_detection = true;
> + p->activate_stm_id_vb_detection =
> + !of_property_read_bool(np, "usb-role-switch");
the rest of params.c uses device_property_read_* instead of of_read_property_*
I thought I'd mention it so you can decide yourself whether this is
fine or needs to be changed


Martin

2020-07-27 19:47:22

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v4 3/3] usb: dwc2: don't use ID/Vbus detection if usb-role-switch on STM32MP15 SoCs

On Mon, Jul 27, 2020 at 10:04 PM Martin Blumenstingl
<[email protected]> wrote:
> On Mon, Jul 27, 2020 at 11:23 AM Amelie Delaunay <[email protected]> wrote:

> > - p->activate_stm_id_vb_detection = true;
> > + p->activate_stm_id_vb_detection =
> > + !of_property_read_bool(np, "usb-role-switch");
> the rest of params.c uses device_property_read_* instead of of_read_property_*
> I thought I'd mention it so you can decide yourself whether this is
> fine or needs to be changed

Better to change and leave all on one line.

--
With Best Regards,
Andy Shevchenko

2020-07-28 07:28:58

by Amelie Delaunay

[permalink] [raw]
Subject: Re: [PATCH v4 3/3] usb: dwc2: don't use ID/Vbus detection if usb-role-switch on STM32MP15 SoCs

Hi,

On 7/27/20 9:44 PM, Andy Shevchenko wrote:
> On Mon, Jul 27, 2020 at 10:04 PM Martin Blumenstingl
> <[email protected]> wrote:
>> On Mon, Jul 27, 2020 at 11:23 AM Amelie Delaunay <[email protected]> wrote:
>
>> > -       p->activate_stm_id_vb_detection = true;
>> > +       p->activate_stm_id_vb_detection =
>> > +               !of_property_read_bool(np, "usb-role-switch");
>> the rest of params.c uses device_property_read_* instead of of_read_property_*
>> I thought I'd mention it so you can decide yourself whether this is
>> fine or needs to be changed
>
> Better to change and leave all on one line.
>

Thank you both for your review. I'll change it in upcoming v5. I'm still
not used to exceed the 80 columns :)

Regards,
Amelie

> --
> With Best Regards,
> Andy Shevchenko