diff mbox series

[V4,21/22] ARM: dts: stm32: Add bindings for USB on AV96

Message ID 20200401132237.60880-22-marex@denx.de (mailing list archive)
State New, archived
Headers show
Series ARM: dts: stm32: Repair AV96 board | expand

Commit Message

Marek Vasut April 1, 2020, 1:22 p.m. UTC
Fill in the bindings for USB host and gadget on AV96.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Patrick Delaunay <patrick.delaunay@st.com>
Cc: linux-stm32@st-md-mailman.stormreply.com
To: linux-arm-kernel@lists.infradead.org
---
V2: No change
V3: No change
---
 arch/arm/boot/dts/stm32mp157a-avenger96.dts | 31 +++++++++++++++++++++
 1 file changed, 31 insertions(+)

Comments

Manivannan Sadhasivam April 6, 2020, 7:22 a.m. UTC | #1
On Wed, Apr 01, 2020 at 03:22:36PM +0200, Marek Vasut wrote:
> Fill in the bindings for USB host and gadget on AV96.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>

I can't get the USB B-Micro OTG port to work with this patch. Do I need to
enable any configs other than PHY and USB DWC2 drivers?

Thanks,
Mani

> Cc: Alexandre Torgue <alexandre.torgue@st.com>
> Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
> Cc: Patrice Chotard <patrice.chotard@st.com>
> Cc: Patrick Delaunay <patrick.delaunay@st.com>
> Cc: linux-stm32@st-md-mailman.stormreply.com
> To: linux-arm-kernel@lists.infradead.org
> ---
> V2: No change
> V3: No change
> ---
>  arch/arm/boot/dts/stm32mp157a-avenger96.dts | 31 +++++++++++++++++++++
>  1 file changed, 31 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/stm32mp157a-avenger96.dts b/arch/arm/boot/dts/stm32mp157a-avenger96.dts
> index 2f5a53e1b50d..31f23e60629f 100644
> --- a/arch/arm/boot/dts/stm32mp157a-avenger96.dts
> +++ b/arch/arm/boot/dts/stm32mp157a-avenger96.dts
> @@ -544,3 +544,34 @@ bluetooth {
>  		shutdown-gpios = <&gpioz 6 GPIO_ACTIVE_HIGH>;
>  	};
>  };
> +
> +&usbh_ehci {
> +	phys = <&usbphyc_port0>;
> +	phy-names = "usb";
> +	status = "okay";
> +};
> +
> +&usbotg_hs {
> +	pinctrl-0 = <&usbotg_hs_pins_a>;
> +	pinctrl-names = "default";
> +	phy-names = "usb2-phy";
> +	phys = <&usbphyc_port1 0>;
> +	status = "okay";
> +	vbus-supply = <&vbus_otg>;
> +};
> +
> +&usbphyc {
> +	status = "okay";
> +};
> +
> +&usbphyc_port0 {
> +	phy-supply = <&vdd_usb>;
> +	vdda1v1-supply = <&reg11>;
> +	vdda1v8-supply = <&reg18>;
> +};
> +
> +&usbphyc_port1 {
> +	phy-supply = <&vdd_usb>;
> +	vdda1v1-supply = <&reg11>;
> +	vdda1v8-supply = <&reg18>;
> +};
> -- 
> 2.25.1
>
Marek Vasut April 6, 2020, 11:08 a.m. UTC | #2
On 4/6/20 9:22 AM, Manivannan Sadhasivam wrote:
> On Wed, Apr 01, 2020 at 03:22:36PM +0200, Marek Vasut wrote:
>> Fill in the bindings for USB host and gadget on AV96.
>>
>> Signed-off-by: Marek Vasut <marex@denx.de>
> 
> I can't get the USB B-Micro OTG port to work with this patch. Do I need to
> enable any configs other than PHY and USB DWC2 drivers?

Only the DWC2 GADGET (and possibly host, for dual-role) and some gadget
implementation (e.g. gadget zero).
Marek Vasut April 7, 2020, 6:37 p.m. UTC | #3
On 4/6/20 1:08 PM, Marek Vasut wrote:
> On 4/6/20 9:22 AM, Manivannan Sadhasivam wrote:
>> On Wed, Apr 01, 2020 at 03:22:36PM +0200, Marek Vasut wrote:
>>> Fill in the bindings for USB host and gadget on AV96.
>>>
>>> Signed-off-by: Marek Vasut <marex@denx.de>
>>
>> I can't get the USB B-Micro OTG port to work with this patch. Do I need to
>> enable any configs other than PHY and USB DWC2 drivers?
> 
> Only the DWC2 GADGET (and possibly host, for dual-role) and some gadget
> implementation (e.g. gadget zero).

I think I see what doesn't work for you.

It seems the following works on next:
power on -> plug in USB stick (or any other USB device) -> unplug ->
plug in usb host (e.g. PC)

But this does not:
power on -> plug in usb host (e.g. PC)
 - the PC is not detected

Did that ^ ever work for you before ? I suspect this is a bug in the
DWC2 driver. The OTG operation there is known to be flaky at best.
Manivannan Sadhasivam April 10, 2020, 9:08 a.m. UTC | #4
Hi,

On Tue, Apr 07, 2020 at 08:37:50PM +0200, Marek Vasut wrote:
> On 4/6/20 1:08 PM, Marek Vasut wrote:
> > On 4/6/20 9:22 AM, Manivannan Sadhasivam wrote:
> >> On Wed, Apr 01, 2020 at 03:22:36PM +0200, Marek Vasut wrote:
> >>> Fill in the bindings for USB host and gadget on AV96.
> >>>
> >>> Signed-off-by: Marek Vasut <marex@denx.de>
> >>
> >> I can't get the USB B-Micro OTG port to work with this patch. Do I need to
> >> enable any configs other than PHY and USB DWC2 drivers?
> > 
> > Only the DWC2 GADGET (and possibly host, for dual-role) and some gadget
> > implementation (e.g. gadget zero).
> 
> I think I see what doesn't work for you.
> 
> It seems the following works on next:
> power on -> plug in USB stick (or any other USB device) -> unplug ->
> plug in usb host (e.g. PC)
> 
> But this does not:
> power on -> plug in usb host (e.g. PC)
>  - the PC is not detected
> 

Both doesn't work. I have the rndis gadget configured in userspace but plugging
in the micro-b cable doesn't do anything.

> Did that ^ ever work for you before ? I suspect this is a bug in the
> DWC2 driver. The OTG operation there is known to be flaky at best.

Not on this board. I don't recall what happended with vendor image. But I do
have another STM32MP1 based 96Board (which will be submitted soon), there I can
get OTG port working.

But in that board a BG96 modem is connected to USB2 port on the board itself
which gets enumerated during probe.

Thanks,
Mani
Marek Vasut April 10, 2020, 9:16 a.m. UTC | #5
On 4/10/20 11:08 AM, Manivannan Sadhasivam wrote:
> Hi,

Hi,

> On Tue, Apr 07, 2020 at 08:37:50PM +0200, Marek Vasut wrote:
>> On 4/6/20 1:08 PM, Marek Vasut wrote:
>>> On 4/6/20 9:22 AM, Manivannan Sadhasivam wrote:
>>>> On Wed, Apr 01, 2020 at 03:22:36PM +0200, Marek Vasut wrote:
>>>>> Fill in the bindings for USB host and gadget on AV96.
>>>>>
>>>>> Signed-off-by: Marek Vasut <marex@denx.de>
>>>>
>>>> I can't get the USB B-Micro OTG port to work with this patch. Do I need to
>>>> enable any configs other than PHY and USB DWC2 drivers?
>>>
>>> Only the DWC2 GADGET (and possibly host, for dual-role) and some gadget
>>> implementation (e.g. gadget zero).
>>
>> I think I see what doesn't work for you.
>>
>> It seems the following works on next:
>> power on -> plug in USB stick (or any other USB device) -> unplug ->
>> plug in usb host (e.g. PC)
>>
>> But this does not:
>> power on -> plug in usb host (e.g. PC)
>>  - the PC is not detected
>>
> 
> Both doesn't work. I have the rndis gadget configured in userspace but plugging
> in the micro-b cable doesn't do anything.
> 
>> Did that ^ ever work for you before ? I suspect this is a bug in the
>> DWC2 driver. The OTG operation there is known to be flaky at best.
> 
> Not on this board. I don't recall what happended with vendor image. But I do
> have another STM32MP1 based 96Board (which will be submitted soon), there I can
> get OTG port working.
> 
> But in that board a BG96 modem is connected to USB2 port on the board itself
> which gets enumerated during probe.

But it's not configured as OTG on this other board, right ?
Manivannan Sadhasivam April 10, 2020, 11:34 a.m. UTC | #6
On Fri, Apr 10, 2020 at 11:16:53AM +0200, Marek Vasut wrote:
> On 4/10/20 11:08 AM, Manivannan Sadhasivam wrote:
> > Hi,
> 
> Hi,
> 
> > On Tue, Apr 07, 2020 at 08:37:50PM +0200, Marek Vasut wrote:
> >> On 4/6/20 1:08 PM, Marek Vasut wrote:
> >>> On 4/6/20 9:22 AM, Manivannan Sadhasivam wrote:
> >>>> On Wed, Apr 01, 2020 at 03:22:36PM +0200, Marek Vasut wrote:
> >>>>> Fill in the bindings for USB host and gadget on AV96.
> >>>>>
> >>>>> Signed-off-by: Marek Vasut <marex@denx.de>
> >>>>
> >>>> I can't get the USB B-Micro OTG port to work with this patch. Do I need to
> >>>> enable any configs other than PHY and USB DWC2 drivers?
> >>>
> >>> Only the DWC2 GADGET (and possibly host, for dual-role) and some gadget
> >>> implementation (e.g. gadget zero).
> >>
> >> I think I see what doesn't work for you.
> >>
> >> It seems the following works on next:
> >> power on -> plug in USB stick (or any other USB device) -> unplug ->
> >> plug in usb host (e.g. PC)
> >>
> >> But this does not:
> >> power on -> plug in usb host (e.g. PC)
> >>  - the PC is not detected
> >>
> > 
> > Both doesn't work. I have the rndis gadget configured in userspace but plugging
> > in the micro-b cable doesn't do anything.
> > 
> >> Did that ^ ever work for you before ? I suspect this is a bug in the
> >> DWC2 driver. The OTG operation there is known to be flaky at best.
> > 
> > Not on this board. I don't recall what happended with vendor image. But I do
> > have another STM32MP1 based 96Board (which will be submitted soon), there I can
> > get OTG port working.
> > 
> > But in that board a BG96 modem is connected to USB2 port on the board itself
> > which gets enumerated during probe.
> 
> But it's not configured as OTG on this other board, right ?

It is configured as a OTG port. But that board has a different issue which
resets the board when we connect any OTG cable to act as a host. That's not
related to DWC2 or this issue btw.

Anyway, I can't get OTG (device/host) to work on both old and new boards.

Thanks,
Mani
Marek Vasut April 10, 2020, 6:02 p.m. UTC | #7
On 4/10/20 1:34 PM, Manivannan Sadhasivam wrote:
> On Fri, Apr 10, 2020 at 11:16:53AM +0200, Marek Vasut wrote:
>> On 4/10/20 11:08 AM, Manivannan Sadhasivam wrote:
>>> Hi,
>>
>> Hi,
>>
>>> On Tue, Apr 07, 2020 at 08:37:50PM +0200, Marek Vasut wrote:
>>>> On 4/6/20 1:08 PM, Marek Vasut wrote:
>>>>> On 4/6/20 9:22 AM, Manivannan Sadhasivam wrote:
>>>>>> On Wed, Apr 01, 2020 at 03:22:36PM +0200, Marek Vasut wrote:
>>>>>>> Fill in the bindings for USB host and gadget on AV96.
>>>>>>>
>>>>>>> Signed-off-by: Marek Vasut <marex@denx.de>
>>>>>>
>>>>>> I can't get the USB B-Micro OTG port to work with this patch. Do I need to
>>>>>> enable any configs other than PHY and USB DWC2 drivers?
>>>>>
>>>>> Only the DWC2 GADGET (and possibly host, for dual-role) and some gadget
>>>>> implementation (e.g. gadget zero).
>>>>
>>>> I think I see what doesn't work for you.
>>>>
>>>> It seems the following works on next:
>>>> power on -> plug in USB stick (or any other USB device) -> unplug ->
>>>> plug in usb host (e.g. PC)
>>>>
>>>> But this does not:
>>>> power on -> plug in usb host (e.g. PC)
>>>>  - the PC is not detected
>>>>
>>>
>>> Both doesn't work. I have the rndis gadget configured in userspace but plugging
>>> in the micro-b cable doesn't do anything.
>>>
>>>> Did that ^ ever work for you before ? I suspect this is a bug in the
>>>> DWC2 driver. The OTG operation there is known to be flaky at best.
>>>
>>> Not on this board. I don't recall what happended with vendor image. But I do
>>> have another STM32MP1 based 96Board (which will be submitted soon), there I can
>>> get OTG port working.
>>>
>>> But in that board a BG96 modem is connected to USB2 port on the board itself
>>> which gets enumerated during probe.
>>
>> But it's not configured as OTG on this other board, right ?
> 
> It is configured as a OTG port. But that board has a different issue which
> resets the board when we connect any OTG cable to act as a host. That's not
> related to DWC2 or this issue btw.

Do I misunderstand the part where you claim there is a modem connected
to the DWC2 ? That would mean it's in Host mode, no ?

> Anyway, I can't get OTG (device/host) to work on both old and new boards.

Do you have 588-200 now too ?

I think there is some fix in current linux-next which partly fixes the
DWC2 role switching, so rebase this patchset on current linux-next and
see what happens. But it's still not perfect. I also think that ST
managed to side-step this issue by using the STUSB1600 chip, but I might
be wrong.
Manivannan Sadhasivam April 11, 2020, 4:12 a.m. UTC | #8
On Fri, Apr 10, 2020 at 08:02:51PM +0200, Marek Vasut wrote:
> On 4/10/20 1:34 PM, Manivannan Sadhasivam wrote:
> > On Fri, Apr 10, 2020 at 11:16:53AM +0200, Marek Vasut wrote:
> >> On 4/10/20 11:08 AM, Manivannan Sadhasivam wrote:
> >>> Hi,
> >>
> >> Hi,
> >>
> >>> On Tue, Apr 07, 2020 at 08:37:50PM +0200, Marek Vasut wrote:
> >>>> On 4/6/20 1:08 PM, Marek Vasut wrote:
> >>>>> On 4/6/20 9:22 AM, Manivannan Sadhasivam wrote:
> >>>>>> On Wed, Apr 01, 2020 at 03:22:36PM +0200, Marek Vasut wrote:
> >>>>>>> Fill in the bindings for USB host and gadget on AV96.
> >>>>>>>
> >>>>>>> Signed-off-by: Marek Vasut <marex@denx.de>
> >>>>>>
> >>>>>> I can't get the USB B-Micro OTG port to work with this patch. Do I need to
> >>>>>> enable any configs other than PHY and USB DWC2 drivers?
> >>>>>
> >>>>> Only the DWC2 GADGET (and possibly host, for dual-role) and some gadget
> >>>>> implementation (e.g. gadget zero).
> >>>>
> >>>> I think I see what doesn't work for you.
> >>>>
> >>>> It seems the following works on next:
> >>>> power on -> plug in USB stick (or any other USB device) -> unplug ->
> >>>> plug in usb host (e.g. PC)
> >>>>
> >>>> But this does not:
> >>>> power on -> plug in usb host (e.g. PC)
> >>>>  - the PC is not detected
> >>>>
> >>>
> >>> Both doesn't work. I have the rndis gadget configured in userspace but plugging
> >>> in the micro-b cable doesn't do anything.
> >>>
> >>>> Did that ^ ever work for you before ? I suspect this is a bug in the
> >>>> DWC2 driver. The OTG operation there is known to be flaky at best.
> >>>
> >>> Not on this board. I don't recall what happended with vendor image. But I do
> >>> have another STM32MP1 based 96Board (which will be submitted soon), there I can
> >>> get OTG port working.
> >>>
> >>> But in that board a BG96 modem is connected to USB2 port on the board itself
> >>> which gets enumerated during probe.
> >>
> >> But it's not configured as OTG on this other board, right ?
> > 
> > It is configured as a OTG port. But that board has a different issue which
> > resets the board when we connect any OTG cable to act as a host. That's not
> > related to DWC2 or this issue btw.
> 
> Do I misunderstand the part where you claim there is a modem connected
> to the DWC2 ? That would mean it's in Host mode, no ?
> 

Let me make it clear. On that board, the USB connection is almost similar to
Avenger96 except that there is only one host port used and it is connected to
the BG96 modem onboard. The other OTG port is connected to micro-b connector.

There I can _only_ get the OTG port to work in device mode. I haven't figured
out what is the exact issue yet. So in the meantime, I may use

dr_mode = "peripheral"

to avoid it being used as host. But on Avenger96 board, the host ports are
working but the OTG port is neither working as host nor as device.

> > Anyway, I can't get OTG (device/host) to work on both old and new boards.
> 
> Do you have 588-200 now too ?
> 

I have both 588-100 and 588-200 now. I told you that at the time of initial
upstreaming I had only 588-100 but later Arrow sent me the new board.

> I think there is some fix in current linux-next which partly fixes the
> DWC2 role switching, so rebase this patchset on current linux-next and
> see what happens. But it's still not perfect. I also think that ST
> managed to side-step this issue by using the STUSB1600 chip, but I might
> be wrong.

Okay, I'll try for both Avenger96 and Stinger96 (yeah that's the name of the
board I'm working on right now).

Thanks,
Mani
Marek Vasut April 12, 2020, 1:54 a.m. UTC | #9
On 4/11/20 6:12 AM, Manivannan Sadhasivam wrote:
> On Fri, Apr 10, 2020 at 08:02:51PM +0200, Marek Vasut wrote:
>> On 4/10/20 1:34 PM, Manivannan Sadhasivam wrote:
>>> On Fri, Apr 10, 2020 at 11:16:53AM +0200, Marek Vasut wrote:
>>>> On 4/10/20 11:08 AM, Manivannan Sadhasivam wrote:
>>>>> Hi,
>>>>
>>>> Hi,
>>>>
>>>>> On Tue, Apr 07, 2020 at 08:37:50PM +0200, Marek Vasut wrote:
>>>>>> On 4/6/20 1:08 PM, Marek Vasut wrote:
>>>>>>> On 4/6/20 9:22 AM, Manivannan Sadhasivam wrote:
>>>>>>>> On Wed, Apr 01, 2020 at 03:22:36PM +0200, Marek Vasut wrote:
>>>>>>>>> Fill in the bindings for USB host and gadget on AV96.
>>>>>>>>>
>>>>>>>>> Signed-off-by: Marek Vasut <marex@denx.de>
>>>>>>>>
>>>>>>>> I can't get the USB B-Micro OTG port to work with this patch. Do I need to
>>>>>>>> enable any configs other than PHY and USB DWC2 drivers?
>>>>>>>
>>>>>>> Only the DWC2 GADGET (and possibly host, for dual-role) and some gadget
>>>>>>> implementation (e.g. gadget zero).
>>>>>>
>>>>>> I think I see what doesn't work for you.
>>>>>>
>>>>>> It seems the following works on next:
>>>>>> power on -> plug in USB stick (or any other USB device) -> unplug ->
>>>>>> plug in usb host (e.g. PC)
>>>>>>
>>>>>> But this does not:
>>>>>> power on -> plug in usb host (e.g. PC)
>>>>>>  - the PC is not detected
>>>>>>
>>>>>
>>>>> Both doesn't work. I have the rndis gadget configured in userspace but plugging
>>>>> in the micro-b cable doesn't do anything.
>>>>>
>>>>>> Did that ^ ever work for you before ? I suspect this is a bug in the
>>>>>> DWC2 driver. The OTG operation there is known to be flaky at best.
>>>>>
>>>>> Not on this board. I don't recall what happended with vendor image. But I do
>>>>> have another STM32MP1 based 96Board (which will be submitted soon), there I can
>>>>> get OTG port working.
>>>>>
>>>>> But in that board a BG96 modem is connected to USB2 port on the board itself
>>>>> which gets enumerated during probe.
>>>>
>>>> But it's not configured as OTG on this other board, right ?
>>>
>>> It is configured as a OTG port. But that board has a different issue which
>>> resets the board when we connect any OTG cable to act as a host. That's not
>>> related to DWC2 or this issue btw.
>>
>> Do I misunderstand the part where you claim there is a modem connected
>> to the DWC2 ? That would mean it's in Host mode, no ?
>>
> 
> Let me make it clear. On that board, the USB connection is almost similar to
> Avenger96 except that there is only one host port used and it is connected to
> the BG96 modem onboard. The other OTG port is connected to micro-b connector.

So the BG96 modem is irrelevant, since it's connected to EHCI HCD,
different controller altogether.

> There I can _only_ get the OTG port to work in device mode. I haven't figured
> out what is the exact issue yet. So in the meantime, I may use
> 
> dr_mode = "peripheral"
> 
> to avoid it being used as host. But on Avenger96 board, the host ports are
> working but the OTG port is neither working as host nor as device.

Is there any difference in the DT between the AV96 and your custom board ?

In particular, look at
&pwr_regulators {
         vdd-supply = <&vdd_io>;
         vdd_3v3_usbfs-supply = <&vdd_usb>;
};

&usbotg_hs {} node and all the other usb* nodes.

>>> Anyway, I can't get OTG (device/host) to work on both old and new boards.
>>
>> Do you have 588-200 now too ?
>>
> 
> I have both 588-100 and 588-200 now. I told you that at the time of initial
> upstreaming I had only 588-100 but later Arrow sent me the new board.

OK good.

>> I think there is some fix in current linux-next which partly fixes the
>> DWC2 role switching, so rebase this patchset on current linux-next and
>> see what happens. But it's still not perfect. I also think that ST
>> managed to side-step this issue by using the STUSB1600 chip, but I might
>> be wrong.
> 
> Okay, I'll try for both Avenger96 and Stinger96 (yeah that's the name of the
> board I'm working on right now).

OK, so the OTG should be indeed almost identical.

Try the latest linux-next, the DWC2 behaves "better" in there. And try
plugging in some USB device first (like a USB stick), see if that's
detected.
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/stm32mp157a-avenger96.dts b/arch/arm/boot/dts/stm32mp157a-avenger96.dts
index 2f5a53e1b50d..31f23e60629f 100644
--- a/arch/arm/boot/dts/stm32mp157a-avenger96.dts
+++ b/arch/arm/boot/dts/stm32mp157a-avenger96.dts
@@ -544,3 +544,34 @@  bluetooth {
 		shutdown-gpios = <&gpioz 6 GPIO_ACTIVE_HIGH>;
 	};
 };
+
+&usbh_ehci {
+	phys = <&usbphyc_port0>;
+	phy-names = "usb";
+	status = "okay";
+};
+
+&usbotg_hs {
+	pinctrl-0 = <&usbotg_hs_pins_a>;
+	pinctrl-names = "default";
+	phy-names = "usb2-phy";
+	phys = <&usbphyc_port1 0>;
+	status = "okay";
+	vbus-supply = <&vbus_otg>;
+};
+
+&usbphyc {
+	status = "okay";
+};
+
+&usbphyc_port0 {
+	phy-supply = <&vdd_usb>;
+	vdda1v1-supply = <&reg11>;
+	vdda1v8-supply = <&reg18>;
+};
+
+&usbphyc_port1 {
+	phy-supply = <&vdd_usb>;
+	vdda1v1-supply = <&reg11>;
+	vdda1v8-supply = <&reg18>;
+};