2024-01-21 22:42:25

by Marijn Suijten

[permalink] [raw]
Subject: [PATCH v2 0/6] arm64: dts: qcom: msm8956-loire: SDCard and USB support

Add pinctrl nodes to enable SD Cards to work on the Sony Loire platform,
and define extcon nodes in PMI8950 to feed into the ci-hdrc driver as it
cannot figure out the presence of a USB cable (nor the desired role
based on the ID pin) on its own. While at it, extend PMI8950 with some
more channels with now-available VADC_ register constants.

Depends on:
- dt-bindings: iio: qcom-spmi-vadc: Add definitions for USB DP/DM VADCs:
https://lore.kernel.org/linux-arm-msm/[email protected]/

Changes since v1:
- Moved pinctrl-names before pinctrl-N (Konrad);
- Keep status=okay last in OTG node (Konrad);
- Rename `adc-chan@` node names to `channel@` (my own patch from a long
time ago).

v1: https://lore.kernel.org/linux-arm-msm/[email protected]/

Marijn Suijten (6):
arm64: dts: qcom: pmi8950: Add USB vbus and id sensing nodes
arm64: dts: qcom: msm8956-loire: Add usb vbus and id extcons to
ci-hdrc
arm64: dts: qcom: pmi8950: Add missing ADC channels
arm64: dts: qcom: msm8976: Declare and use SDC1 pins
arm64: dts: qcom: msm8976: Declare and use SDC2 pins
arm64: dts: qcom: msm8956-loire: Add SD Card Detect to SDC2 pin states

.../qcom/msm8956-sony-xperia-loire-kugo.dts | 6 ++
.../dts/qcom/msm8956-sony-xperia-loire.dtsi | 25 +++++
arch/arm64/boot/dts/qcom/msm8976.dtsi | 100 ++++++++++++++++++
arch/arm64/boot/dts/qcom/pmi8950.dtsi | 38 +++++++
4 files changed, 169 insertions(+)

--
2.39.0

---
Marijn Suijten (6):
arm64: dts: qcom: pmi8950: Add USB vbus and id sensing nodes
arm64: dts: qcom: msm8956-loire: Add usb vbus and id extcons to ci-hdrc
arm64: dts: qcom: pmi8950: Add missing ADC channels
arm64: dts: qcom: msm8976: Declare and use SDC1 pins
arm64: dts: qcom: msm8976: Declare and use SDC2 pins
arm64: dts: qcom: msm8956-loire: Add SD Card Detect to SDC2 pin states

.../dts/qcom/msm8956-sony-xperia-loire-kugo.dts | 6 ++
.../boot/dts/qcom/msm8956-sony-xperia-loire.dtsi | 25 ++++++
arch/arm64/boot/dts/qcom/msm8976.dtsi | 100 +++++++++++++++++++++
arch/arm64/boot/dts/qcom/pmi8950.dtsi | 38 ++++++++
4 files changed, 169 insertions(+)
---
base-commit: ad5c60d66016e544c51ed98635a74073f761f45d
change-id: 20240121-msm8976-dt-73f42eeef1bc

Best regards,
--
Marijn Suijten <[email protected]>



2024-01-21 22:42:40

by Marijn Suijten

[permalink] [raw]
Subject: [PATCH v2 6/6] arm64: dts: qcom: msm8956-loire: Add SD Card Detect to SDC2 pin states

In addition to the SDC2 pins, set the SD Card Detect pin in a sane state
to be used as an interrupt when an SD Card is slotted in or removed.

Signed-off-by: Marijn Suijten <[email protected]>
---
arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi b/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi
index b0b83edd3627..75412e37334c 100644
--- a/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi
@@ -264,10 +264,27 @@ &sdhc_1 {
status = "okay";
};

+&sdc2_off_state {
+ sd-cd-pins {
+ pins = "gpio100";
+ function = "gpio";
+ drive-strength = <2>;
+ bias-disable;
+ };
+};
+
&sdc2_on_state {
clk-pins {
drive-strength = <10>;
};
+
+ sd-cd-pins {
+ pins = "gpio100";
+ function = "gpio";
+ drive-strength = <2>;
+ input-enable;
+ bias-pull-up;
+ };
};

&sdhc_2 {

--
2.43.0


Subject: Re: [PATCH v2 6/6] arm64: dts: qcom: msm8956-loire: Add SD Card Detect to SDC2 pin states

Il 21/01/24 23:33, Marijn Suijten ha scritto:
> In addition to the SDC2 pins, set the SD Card Detect pin in a sane state
> to be used as an interrupt when an SD Card is slotted in or removed.
>
> Signed-off-by: Marijn Suijten <[email protected]>
> ---
> arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi b/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi
> index b0b83edd3627..75412e37334c 100644
> --- a/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi
> +++ b/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi
> @@ -264,10 +264,27 @@ &sdhc_1 {
> status = "okay";
> };
>
> +&sdc2_off_state {
> + sd-cd-pins {
> + pins = "gpio100";
> + function = "gpio";
> + drive-strength = <2>;
> + bias-disable;
> + };

Are you sure that you really don't want card detect during system suspend?

You could simply add a sdc2-cd-pins out of sdc2_{on,off}_state and add use it for
both default and sleep.

pinctrl-0 = <&sdc2_on_state>, <&sdc2_card_det_n>;
pinctrl-1 = <&sdc2_off_state>;

Cheers,
Angelo

> +};
> +
> &sdc2_on_state {
> clk-pins {
> drive-strength = <10>;
> };
> +
> + sd-cd-pins {
> + pins = "gpio100";
> + function = "gpio";
> + drive-strength = <2>;
> + input-enable;
> + bias-pull-up;
> + };
> };
>
> &sdhc_2 {
>



2024-01-22 13:49:16

by Marijn Suijten

[permalink] [raw]
Subject: Re: Re: [PATCH v2 6/6] arm64: dts: qcom: msm8956-loire: Add SD Card Detect to SDC2 pin states

On 2024-01-22 12:48:27, AngeloGioacchino Del Regno wrote:
> Il 21/01/24 23:33, Marijn Suijten ha scritto:
> > In addition to the SDC2 pins, set the SD Card Detect pin in a sane state
> > to be used as an interrupt when an SD Card is slotted in or removed.
> >
> > Signed-off-by: Marijn Suijten <[email protected]>
> > ---
> > arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi | 17 +++++++++++++++++
> > 1 file changed, 17 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi b/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi
> > index b0b83edd3627..75412e37334c 100644
> > --- a/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi
> > +++ b/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi
> > @@ -264,10 +264,27 @@ &sdhc_1 {
> > status = "okay";
> > };
> >
> > +&sdc2_off_state {
> > + sd-cd-pins {
> > + pins = "gpio100";
> > + function = "gpio";
> > + drive-strength = <2>;
> > + bias-disable;
> > + };
>
> Are you sure that you really don't want card detect during system suspend?

Does it make a difference if the rest of pinctrl and the SDHCI controller are
also turned off?

> You could simply add a sdc2-cd-pins out of sdc2_{on,off}_state and add use it for
> both default and sleep.

This sounds close to what Konrad suggested by using a new block wit its own
label rather than extending the existing state.

> pinctrl-0 = <&sdc2_on_state>, <&sdc2_card_det_n>;
> pinctrl-1 = <&sdc2_off_state>;

You said both, but it's not in pinctrl-1 here? (And might unselect bias-pull-up
implicitly instead of explicitly selecting bias-disable via an off node?)

- Marijn

> Cheers,
> Angelo
>
> > +};
> > +
> > &sdc2_on_state {
> > clk-pins {
> > drive-strength = <10>;
> > };
> > +
> > + sd-cd-pins {
> > + pins = "gpio100";
> > + function = "gpio";
> > + drive-strength = <2>;
> > + input-enable;
> > + bias-pull-up;
> > + };
> > };
> >
> > &sdhc_2 {
> >
>
>

Subject: Re: [PATCH v2 6/6] arm64: dts: qcom: msm8956-loire: Add SD Card Detect to SDC2 pin states

Il 22/01/24 14:49, Marijn Suijten ha scritto:
> On 2024-01-22 12:48:27, AngeloGioacchino Del Regno wrote:
>> Il 21/01/24 23:33, Marijn Suijten ha scritto:
>>> In addition to the SDC2 pins, set the SD Card Detect pin in a sane state
>>> to be used as an interrupt when an SD Card is slotted in or removed.
>>>
>>> Signed-off-by: Marijn Suijten <[email protected]>
>>> ---
>>> arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi | 17 +++++++++++++++++
>>> 1 file changed, 17 insertions(+)
>>>
>>> diff --git a/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi b/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi
>>> index b0b83edd3627..75412e37334c 100644
>>> --- a/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi
>>> +++ b/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi
>>> @@ -264,10 +264,27 @@ &sdhc_1 {
>>> status = "okay";
>>> };
>>>
>>> +&sdc2_off_state {
>>> + sd-cd-pins {
>>> + pins = "gpio100";
>>> + function = "gpio";
>>> + drive-strength = <2>;
>>> + bias-disable;
>>> + };
>>
>> Are you sure that you really don't want card detect during system suspend?
>
> Does it make a difference if the rest of pinctrl and the SDHCI controller are
> also turned off?
>
>> You could simply add a sdc2-cd-pins out of sdc2_{on,off}_state and add use it for
>> both default and sleep.
>
> This sounds close to what Konrad suggested by using a new block wit its own
> label rather than extending the existing state.
>
>> pinctrl-0 = <&sdc2_on_state>, <&sdc2_card_det_n>;
>> pinctrl-1 = <&sdc2_off_state>;
>
> You said both, but it's not in pinctrl-1 here? (And might unselect bias-pull-up
> implicitly instead of explicitly selecting bias-disable via an off node?)
>

I meant to add it to both, sorry.

In any case, take the typo'ed example as a simplification of your first version :-)


> - Marijn
>
>> Cheers,
>> Angelo
>>
>>> +};
>>> +
>>> &sdc2_on_state {
>>> clk-pins {
>>> drive-strength = <10>;
>>> };
>>> +
>>> + sd-cd-pins {
>>> + pins = "gpio100";
>>> + function = "gpio";
>>> + drive-strength = <2>;
>>> + input-enable;
>>> + bias-pull-up;
>>> + };
>>> };
>>>
>>> &sdhc_2 {
>>>
>>
>>


2024-01-22 17:05:09

by Marijn Suijten

[permalink] [raw]
Subject: Re: Re: [PATCH v2 6/6] arm64: dts: qcom: msm8956-loire: Add SD Card Detect to SDC2 pin states

On 2024-01-22 15:59:37, AngeloGioacchino Del Regno wrote:
> Il 22/01/24 14:49, Marijn Suijten ha scritto:
> > On 2024-01-22 12:48:27, AngeloGioacchino Del Regno wrote:
> >> Il 21/01/24 23:33, Marijn Suijten ha scritto:
> >>> In addition to the SDC2 pins, set the SD Card Detect pin in a sane state
> >>> to be used as an interrupt when an SD Card is slotted in or removed.
> >>>
> >>> Signed-off-by: Marijn Suijten <[email protected]>
> >>> ---
> >>> arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi | 17 +++++++++++++++++
> >>> 1 file changed, 17 insertions(+)
> >>>
> >>> diff --git a/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi b/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi
> >>> index b0b83edd3627..75412e37334c 100644
> >>> --- a/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi
> >>> +++ b/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi
> >>> @@ -264,10 +264,27 @@ &sdhc_1 {
> >>> status = "okay";
> >>> };
> >>>
> >>> +&sdc2_off_state {
> >>> + sd-cd-pins {
> >>> + pins = "gpio100";
> >>> + function = "gpio";
> >>> + drive-strength = <2>;
> >>> + bias-disable;
> >>> + };
> >>
> >> Are you sure that you really don't want card detect during system suspend?
> >
> > Does it make a difference if the rest of pinctrl and the SDHCI controller are
> > also turned off?
> >
> >> You could simply add a sdc2-cd-pins out of sdc2_{on,off}_state and add use it for
> >> both default and sleep.
> >
> > This sounds close to what Konrad suggested by using a new block wit its own
> > label rather than extending the existing state.
> >
> >> pinctrl-0 = <&sdc2_on_state>, <&sdc2_card_det_n>;
> >> pinctrl-1 = <&sdc2_off_state>;
> >
> > You said both, but it's not in pinctrl-1 here? (And might unselect bias-pull-up
> > implicitly instead of explicitly selecting bias-disable via an off node?)
> >
>
> I meant to add it to both, sorry.
>
> In any case, take the typo'ed example as a simplification of your first version :-)

Okay, I'll resend a version that creates a new pinctrl node and applies it to both cases.

Unfortunately I can no longer test and confirm that it makes a difference
to have the card-detect IRQ always biased, even while the SDHCI controller
is "asleep" or off, so I'll trust your word for it. If I remember correctly
downstream turns it off as well?

- Marijn

Subject: Re: [PATCH v2 6/6] arm64: dts: qcom: msm8956-loire: Add SD Card Detect to SDC2 pin states

Il 22/01/24 16:15, Marijn Suijten ha scritto:
> On 2024-01-22 15:59:37, AngeloGioacchino Del Regno wrote:
>> Il 22/01/24 14:49, Marijn Suijten ha scritto:
>>> On 2024-01-22 12:48:27, AngeloGioacchino Del Regno wrote:
>>>> Il 21/01/24 23:33, Marijn Suijten ha scritto:
>>>>> In addition to the SDC2 pins, set the SD Card Detect pin in a sane state
>>>>> to be used as an interrupt when an SD Card is slotted in or removed.
>>>>>
>>>>> Signed-off-by: Marijn Suijten <[email protected]>
>>>>> ---
>>>>> arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi | 17 +++++++++++++++++
>>>>> 1 file changed, 17 insertions(+)
>>>>>
>>>>> diff --git a/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi b/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi
>>>>> index b0b83edd3627..75412e37334c 100644
>>>>> --- a/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi
>>>>> +++ b/arch/arm64/boot/dts/qcom/msm8956-sony-xperia-loire.dtsi
>>>>> @@ -264,10 +264,27 @@ &sdhc_1 {
>>>>> status = "okay";
>>>>> };
>>>>>
>>>>> +&sdc2_off_state {
>>>>> + sd-cd-pins {
>>>>> + pins = "gpio100";
>>>>> + function = "gpio";
>>>>> + drive-strength = <2>;
>>>>> + bias-disable;
>>>>> + };
>>>>
>>>> Are you sure that you really don't want card detect during system suspend?
>>>
>>> Does it make a difference if the rest of pinctrl and the SDHCI controller are
>>> also turned off?
>>>
>>>> You could simply add a sdc2-cd-pins out of sdc2_{on,off}_state and add use it for
>>>> both default and sleep.
>>>
>>> This sounds close to what Konrad suggested by using a new block wit its own
>>> label rather than extending the existing state.
>>>
>>>> pinctrl-0 = <&sdc2_on_state>, <&sdc2_card_det_n>;
>>>> pinctrl-1 = <&sdc2_off_state>;
>>>
>>> You said both, but it's not in pinctrl-1 here? (And might unselect bias-pull-up
>>> implicitly instead of explicitly selecting bias-disable via an off node?)
>>>
>>
>> I meant to add it to both, sorry.
>>
>> In any case, take the typo'ed example as a simplification of your first version :-)
>
> Okay, I'll resend a version that creates a new pinctrl node and applies it to both cases.
>
> Unfortunately I can no longer test and confirm that it makes a difference
> to have the card-detect IRQ always biased, even while the SDHCI controller
> is "asleep" or off, so I'll trust your word for it. If I remember correctly
> downstream turns it off as well?

Marijn, I don't remember anything about a downstream kernel from 10 years ago..!

But yes, it's okay to do so - the worst case is that it won't wake up, but that
won't happen, as it's going to generate an interrupt and wake up the entire system
which includes the SDHCI controller.

Go on!

Cheers,
Angelo