diff mbox series

[v3,12/14] dts: sdm845-db845c: add u-boot fixups

Message ID 20240319-b4-qcom-livetree-v3-12-e1b38d9b4fa4@linaro.org
State New
Headers show
Series Qualcomm platform USB support | expand

Commit Message

Caleb Connolly March 19, 2024, 12:22 p.m. UTC
The USB VBUS supply for the type-A port is enabled via a GPIO regulator.
This is incorrectly modelled in Linux where only the PCIe dependency is
expressed. Add a U-Boot specific dtsi snippet so that this supply will
get enabled when initialising USB.

Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
---
 arch/arm/dts/sdm845-db845c-u-boot.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Sumit Garg March 19, 2024, 1:55 p.m. UTC | #1
On Tue, 19 Mar 2024 at 17:52, Caleb Connolly <caleb.connolly@linaro.org> wrote:
>
> The USB VBUS supply for the type-A port is enabled via a GPIO regulator.
> This is incorrectly modelled in Linux where only the PCIe dependency is
> expressed.

Can we send a fix for the Linux kernel DTS to correctly model it? We
can then later get rid of this modification once that is accepted.

-Sumit

> Add a U-Boot specific dtsi snippet so that this supply will
> get enabled when initialising USB.
>
> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
> ---
>  arch/arm/dts/sdm845-db845c-u-boot.dtsi | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/arch/arm/dts/sdm845-db845c-u-boot.dtsi b/arch/arm/dts/sdm845-db845c-u-boot.dtsi
> new file mode 100644
> index 000000000000..3c83e21251c4
> --- /dev/null
> +++ b/arch/arm/dts/sdm845-db845c-u-boot.dtsi
> @@ -0,0 +1,8 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +/* This GPIO must be turned on to enable the 5v VBUS
> + * supply on the USB port.
> + */
> +&usb_2_dwc3 {
> +       vbus-supply = <&pcie0_3p3v_dual>;
> +};
>
> --
> 2.44.0
>
Caleb Connolly March 20, 2024, 12:33 p.m. UTC | #2
On 19/03/2024 13:55, Sumit Garg wrote:
> On Tue, 19 Mar 2024 at 17:52, Caleb Connolly <caleb.connolly@linaro.org> wrote:
>>
>> The USB VBUS supply for the type-A port is enabled via a GPIO regulator.
>> This is incorrectly modelled in Linux where only the PCIe dependency is
>> expressed.
> 
> Can we send a fix for the Linux kernel DTS to correctly model it? We
> can then later get rid of this modification once that is accepted.

I spoke to Bjorn about this and apparently the correct way to model this
will be to have a usb-connector node with a vbus-supply property. There
is some work underway in Linux to support this kind of thing already.

In the mean time he suggested to just make the regulator always-on, so I
sent a patch to do that [1]. I actually hit this issue when booting from
USB as the PCIe drivers aren't available in the initramfs, so USB never
turns on, and the always-on hack fixes that.

In the mean time, we'll still need this vbus-supply reference as U-Boot
doesn't automatically probe regulators.
> 
> -Sumit
> 
>> Add a U-Boot specific dtsi snippet so that this supply will
>> get enabled when initialising USB.
>>
>> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
>> ---
>>  arch/arm/dts/sdm845-db845c-u-boot.dtsi | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/arch/arm/dts/sdm845-db845c-u-boot.dtsi b/arch/arm/dts/sdm845-db845c-u-boot.dtsi
>> new file mode 100644
>> index 000000000000..3c83e21251c4
>> --- /dev/null
>> +++ b/arch/arm/dts/sdm845-db845c-u-boot.dtsi
>> @@ -0,0 +1,8 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +
>> +/* This GPIO must be turned on to enable the 5v VBUS
>> + * supply on the USB port.
>> + */
>> +&usb_2_dwc3 {
>> +       vbus-supply = <&pcie0_3p3v_dual>;
>> +};
>>
>> --
>> 2.44.0
>>
Caleb Connolly March 20, 2024, 12:34 p.m. UTC | #3
On 20/03/2024 12:33, Caleb Connolly wrote:
> 
> 
> On 19/03/2024 13:55, Sumit Garg wrote:
>> On Tue, 19 Mar 2024 at 17:52, Caleb Connolly <caleb.connolly@linaro.org> wrote:
>>>
>>> The USB VBUS supply for the type-A port is enabled via a GPIO regulator.
>>> This is incorrectly modelled in Linux where only the PCIe dependency is
>>> expressed.
>>
>> Can we send a fix for the Linux kernel DTS to correctly model it? We
>> can then later get rid of this modification once that is accepted.
> 
> I spoke to Bjorn about this and apparently the correct way to model this
> will be to have a usb-connector node with a vbus-supply property. There
> is some work underway in Linux to support this kind of thing already.
> 
> In the mean time he suggested to just make the regulator always-on, so I
> sent a patch to do that [1]. I actually hit this issue when booting from
> USB as the PCIe drivers aren't available in the initramfs, so USB never
> turns on, and the always-on hack fixes that.
> 
> In the mean time, we'll still need this vbus-supply reference as U-Boot
> doesn't automatically probe regulators.

oh, forgot the link!

[1]:
https://lore.kernel.org/linux-arm-msm/20240320122515.3243711-1-caleb.connolly@linaro.org/
>>
>> -Sumit
>>
>>> Add a U-Boot specific dtsi snippet so that this supply will
>>> get enabled when initialising USB.
>>>
>>> Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
>>> ---
>>>  arch/arm/dts/sdm845-db845c-u-boot.dtsi | 8 ++++++++
>>>  1 file changed, 8 insertions(+)
>>>
>>> diff --git a/arch/arm/dts/sdm845-db845c-u-boot.dtsi b/arch/arm/dts/sdm845-db845c-u-boot.dtsi
>>> new file mode 100644
>>> index 000000000000..3c83e21251c4
>>> --- /dev/null
>>> +++ b/arch/arm/dts/sdm845-db845c-u-boot.dtsi
>>> @@ -0,0 +1,8 @@
>>> +// SPDX-License-Identifier: GPL-2.0
>>> +
>>> +/* This GPIO must be turned on to enable the 5v VBUS
>>> + * supply on the USB port.
>>> + */
>>> +&usb_2_dwc3 {
>>> +       vbus-supply = <&pcie0_3p3v_dual>;
>>> +};
>>>
>>> --
>>> 2.44.0
>>>
>
Sumit Garg March 21, 2024, 4:53 a.m. UTC | #4
On Wed, 20 Mar 2024 at 18:04, Caleb Connolly <caleb.connolly@linaro.org> wrote:
>
>
>
> On 20/03/2024 12:33, Caleb Connolly wrote:
> >
> >
> > On 19/03/2024 13:55, Sumit Garg wrote:
> >> On Tue, 19 Mar 2024 at 17:52, Caleb Connolly <caleb.connolly@linaro.org> wrote:
> >>>
> >>> The USB VBUS supply for the type-A port is enabled via a GPIO regulator.
> >>> This is incorrectly modelled in Linux where only the PCIe dependency is
> >>> expressed.
> >>
> >> Can we send a fix for the Linux kernel DTS to correctly model it? We
> >> can then later get rid of this modification once that is accepted.
> >
> > I spoke to Bjorn about this and apparently the correct way to model this
> > will be to have a usb-connector node with a vbus-supply property. There
> > is some work underway in Linux to support this kind of thing already.
> >
> > In the mean time he suggested to just make the regulator always-on, so I
> > sent a patch to do that [1]. I actually hit this issue when booting from
> > USB as the PCIe drivers aren't available in the initramfs, so USB never
> > turns on, and the always-on hack fixes that.
> >
> > In the mean time, we'll still need this vbus-supply reference as U-Boot
> > doesn't automatically probe regulators.
>

Try adding regulators_enable_boot_on() to the common board code. With
that there shouldn't be any need for this vbus-supply reference.

> oh, forgot the link!
>
> [1]:
> https://lore.kernel.org/linux-arm-msm/20240320122515.3243711-1-caleb.connolly@linaro.org/

-Sumit
diff mbox series

Patch

diff --git a/arch/arm/dts/sdm845-db845c-u-boot.dtsi b/arch/arm/dts/sdm845-db845c-u-boot.dtsi
new file mode 100644
index 000000000000..3c83e21251c4
--- /dev/null
+++ b/arch/arm/dts/sdm845-db845c-u-boot.dtsi
@@ -0,0 +1,8 @@ 
+// SPDX-License-Identifier: GPL-2.0
+
+/* This GPIO must be turned on to enable the 5v VBUS
+ * supply on the USB port.
+ */
+&usb_2_dwc3 {
+	vbus-supply = <&pcie0_3p3v_dual>;
+};