diff mbox series

[v5,10/10] arm64: dts: actions: Add uSD support for Cubieboard7

Message ID 1593701576-28580-11-git-send-email-amittomer25@gmail.com (mailing list archive)
State New, archived
Headers show
Series Add MMC and DMA support for Actions S700 | expand

Commit Message

Amit Tomer July 2, 2020, 2:52 p.m. UTC
This commit adds uSD support for Cubieboard7 board based on Actions Semi
S700 SoC. SD0 is connected to uSD slot. Since there is no PMIC support
added yet, fixed regulator has been used as a regulator node.

Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
---
Changes since v4:
	* No change.
Changes since v3:
        * No change.
Changes since v2:
        * No change.
Changes since v1:
        * No change.
Changes since RFC:
        * No change.
---
 arch/arm64/boot/dts/actions/s700-cubieboard7.dts | 41 ++++++++++++++++++++++++
 arch/arm64/boot/dts/actions/s700.dtsi            |  1 +
 2 files changed, 42 insertions(+)

Comments

Manivannan Sadhasivam July 12, 2020, 5:30 p.m. UTC | #1
On Thu, Jul 02, 2020 at 08:22:56PM +0530, Amit Singh Tomar wrote:
> This commit adds uSD support for Cubieboard7 board based on Actions Semi
> S700 SoC. SD0 is connected to uSD slot. Since there is no PMIC support
> added yet, fixed regulator has been used as a regulator node.
> 
> Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
> ---
> Changes since v4:
> 	* No change.
> Changes since v3:
>         * No change.
> Changes since v2:
>         * No change.
> Changes since v1:
>         * No change.
> Changes since RFC:
>         * No change.
> ---
>  arch/arm64/boot/dts/actions/s700-cubieboard7.dts | 41 ++++++++++++++++++++++++
>  arch/arm64/boot/dts/actions/s700.dtsi            |  1 +
>  2 files changed, 42 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/actions/s700-cubieboard7.dts b/arch/arm64/boot/dts/actions/s700-cubieboard7.dts
> index 63e375cd9eb4..ec117eb12f3a 100644
> --- a/arch/arm64/boot/dts/actions/s700-cubieboard7.dts
> +++ b/arch/arm64/boot/dts/actions/s700-cubieboard7.dts
> @@ -13,6 +13,7 @@
>  
>  	aliases {
>  		serial3 = &uart3;
> +		mmc0 = &mmc0;
>  	};
>  
>  	chosen {
> @@ -28,6 +29,23 @@
>  		device_type = "memory";
>  		reg = <0x1 0xe0000000 0x0 0x0>;
>  	};
> +
> +	/* Fixed regulator used in the absence of PMIC */
> +	vcc_3v1: vcc-3v1 {
> +		compatible = "regulator-fixed";
> +		regulator-name = "fixed-3.1V";
> +		regulator-min-microvolt = <3100000>;
> +		regulator-max-microvolt = <3100000>;
> +	};

Is this regulator used somewhere?

Thanks,
Mani

> +
> +	/* Fixed regulator used in the absence of PMIC */
> +	sd_vcc: sd-vcc {
> +		compatible = "regulator-fixed";
> +		regulator-name = "fixed-3.1V";
> +		regulator-min-microvolt = <3100000>;
> +		regulator-max-microvolt = <3100000>;
> +		regulator-always-on;
> +	};
>  };
>  
>  &i2c0 {
> @@ -81,6 +99,14 @@
>  			bias-pull-up;
>  		};
>  	};
> +
> +	mmc0_default: mmc0_default {
> +		pinmux {
> +			groups = "sd0_d0_mfp", "sd0_d1_mfp", "sd0_d2_d3_mfp",
> +				 "sd0_cmd_mfp", "sd0_clk_mfp";
> +			function = "sd0";
> +		};
> +	};
>  };
>  
>  &timer {
> @@ -90,3 +116,18 @@
>  &uart3 {
>  	status = "okay";
>  };
> +
> +/* uSD */
> +&mmc0 {
> +	status = "okay";
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&mmc0_default>;
> +	cd-gpios = <&pinctrl 120 GPIO_ACTIVE_LOW>;
> +	no-sdio;
> +	no-mmc;
> +	no-1-8-v;
> +	bus-width = <4>;
> +	vmmc-supply = <&sd_vcc>;
> +	vqmmc-supply = <&sd_vcc>;
> +};
> +
> diff --git a/arch/arm64/boot/dts/actions/s700.dtsi b/arch/arm64/boot/dts/actions/s700.dtsi
> index 9ed88aafc2da..ba498cf9217d 100644
> --- a/arch/arm64/boot/dts/actions/s700.dtsi
> +++ b/arch/arm64/boot/dts/actions/s700.dtsi
> @@ -4,6 +4,7 @@
>   */
>  
>  #include <dt-bindings/clock/actions,s700-cmu.h>
> +#include <dt-bindings/gpio/gpio.h>
>  #include <dt-bindings/interrupt-controller/arm-gic.h>
>  #include <dt-bindings/power/owl-s700-powergate.h>
>  #include <dt-bindings/reset/actions,s700-reset.h>
> -- 
> 2.7.4
>
Amit Tomer July 12, 2020, 6:45 p.m. UTC | #2
Hi,

On Sun, Jul 12, 2020 at 11:00 PM Manivannan Sadhasivam
<manivannan.sadhasivam@linaro.org> wrote:
>
> On Thu, Jul 02, 2020 at 08:22:56PM +0530, Amit Singh Tomar wrote:
> > This commit adds uSD support for Cubieboard7 board based on Actions Semi
> > S700 SoC. SD0 is connected to uSD slot. Since there is no PMIC support
> > added yet, fixed regulator has been used as a regulator node.
> >
> > Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
> > ---
> > Changes since v4:
> >       * No change.
> > Changes since v3:
> >         * No change.
> > Changes since v2:
> >         * No change.
> > Changes since v1:
> >         * No change.
> > Changes since RFC:
> >         * No change.
> > ---
> >  arch/arm64/boot/dts/actions/s700-cubieboard7.dts | 41 ++++++++++++++++++++++++
> >  arch/arm64/boot/dts/actions/s700.dtsi            |  1 +
> >  2 files changed, 42 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/actions/s700-cubieboard7.dts b/arch/arm64/boot/dts/actions/s700-cubieboard7.dts
> > index 63e375cd9eb4..ec117eb12f3a 100644
> > --- a/arch/arm64/boot/dts/actions/s700-cubieboard7.dts
> > +++ b/arch/arm64/boot/dts/actions/s700-cubieboard7.dts
> > @@ -13,6 +13,7 @@
> >
> >       aliases {
> >               serial3 = &uart3;
> > +             mmc0 = &mmc0;
> >       };
> >
> >       chosen {
> > @@ -28,6 +29,23 @@
> >               device_type = "memory";
> >               reg = <0x1 0xe0000000 0x0 0x0>;
> >       };
> > +
> > +     /* Fixed regulator used in the absence of PMIC */
> > +     vcc_3v1: vcc-3v1 {
> > +             compatible = "regulator-fixed";
> > +             regulator-name = "fixed-3.1V";
> > +             regulator-min-microvolt = <3100000>;
> > +             regulator-max-microvolt = <3100000>;
> > +     };
>
> Is this regulator used somewhere?

This is something I copied from bubblegum dts as I wasn't sure what is right way
to include these regulators.

Also, another day tested it without having these regulators in , and
still it seems to
work.  So should these be removed ?

Thanks
-Amit
Andre Przywara July 12, 2020, 11:17 p.m. UTC | #3
On 12/07/2020 19:45, Amit Tomer wrote:

Hi,

> On Sun, Jul 12, 2020 at 11:00 PM Manivannan Sadhasivam
> <manivannan.sadhasivam@linaro.org> wrote:
>>
>> On Thu, Jul 02, 2020 at 08:22:56PM +0530, Amit Singh Tomar wrote:
>>> This commit adds uSD support for Cubieboard7 board based on Actions Semi
>>> S700 SoC. SD0 is connected to uSD slot. Since there is no PMIC support
>>> added yet, fixed regulator has been used as a regulator node.
>>>
>>> Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
>>> ---
>>> Changes since v4:
>>>       * No change.
>>> Changes since v3:
>>>         * No change.
>>> Changes since v2:
>>>         * No change.
>>> Changes since v1:
>>>         * No change.
>>> Changes since RFC:
>>>         * No change.
>>> ---
>>>  arch/arm64/boot/dts/actions/s700-cubieboard7.dts | 41 ++++++++++++++++++++++++
>>>  arch/arm64/boot/dts/actions/s700.dtsi            |  1 +
>>>  2 files changed, 42 insertions(+)
>>>
>>> diff --git a/arch/arm64/boot/dts/actions/s700-cubieboard7.dts b/arch/arm64/boot/dts/actions/s700-cubieboard7.dts
>>> index 63e375cd9eb4..ec117eb12f3a 100644
>>> --- a/arch/arm64/boot/dts/actions/s700-cubieboard7.dts
>>> +++ b/arch/arm64/boot/dts/actions/s700-cubieboard7.dts
>>> @@ -13,6 +13,7 @@
>>>
>>>       aliases {
>>>               serial3 = &uart3;
>>> +             mmc0 = &mmc0;
>>>       };
>>>
>>>       chosen {
>>> @@ -28,6 +29,23 @@
>>>               device_type = "memory";
>>>               reg = <0x1 0xe0000000 0x0 0x0>;
>>>       };
>>> +
>>> +     /* Fixed regulator used in the absence of PMIC */
>>> +     vcc_3v1: vcc-3v1 {
>>> +             compatible = "regulator-fixed";
>>> +             regulator-name = "fixed-3.1V";
>>> +             regulator-min-microvolt = <3100000>;
>>> +             regulator-max-microvolt = <3100000>;
>>> +     };
>>
>> Is this regulator used somewhere?
> 
> This is something I copied from bubblegum dts as I wasn't sure what is right way
> to include these regulators.

But this regulator is only used for the eMMC there, which we apparently
don't have on the Cubieboard 7?

> Also, another day tested it without having these regulators in , and
> still it seems to
> work.  So should these be removed ?

If there are not even referenced in the .dts, then fixed regulators are
rather pointless. So yes, please remove this vcc-3v1 one.

What is the story with the other regulator? Is there a PMIC or a power
switch for the SD card? Or is the power supply actually hardwired?

Cheers,
Andre
Manivannan Sadhasivam July 13, 2020, 3 a.m. UTC | #4
On Mon, Jul 13, 2020 at 12:15:28AM +0530, Amit Tomer wrote:
> Hi,
> 
> On Sun, Jul 12, 2020 at 11:00 PM Manivannan Sadhasivam
> <manivannan.sadhasivam@linaro.org> wrote:
> >
> > On Thu, Jul 02, 2020 at 08:22:56PM +0530, Amit Singh Tomar wrote:
> > > This commit adds uSD support for Cubieboard7 board based on Actions Semi
> > > S700 SoC. SD0 is connected to uSD slot. Since there is no PMIC support
> > > added yet, fixed regulator has been used as a regulator node.
> > >
> > > Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
> > > ---
> > > Changes since v4:
> > >       * No change.
> > > Changes since v3:
> > >         * No change.
> > > Changes since v2:
> > >         * No change.
> > > Changes since v1:
> > >         * No change.
> > > Changes since RFC:
> > >         * No change.
> > > ---
> > >  arch/arm64/boot/dts/actions/s700-cubieboard7.dts | 41 ++++++++++++++++++++++++
> > >  arch/arm64/boot/dts/actions/s700.dtsi            |  1 +
> > >  2 files changed, 42 insertions(+)
> > >
> > > diff --git a/arch/arm64/boot/dts/actions/s700-cubieboard7.dts b/arch/arm64/boot/dts/actions/s700-cubieboard7.dts
> > > index 63e375cd9eb4..ec117eb12f3a 100644
> > > --- a/arch/arm64/boot/dts/actions/s700-cubieboard7.dts
> > > +++ b/arch/arm64/boot/dts/actions/s700-cubieboard7.dts
> > > @@ -13,6 +13,7 @@
> > >
> > >       aliases {
> > >               serial3 = &uart3;
> > > +             mmc0 = &mmc0;
> > >       };
> > >
> > >       chosen {
> > > @@ -28,6 +29,23 @@
> > >               device_type = "memory";
> > >               reg = <0x1 0xe0000000 0x0 0x0>;
> > >       };
> > > +
> > > +     /* Fixed regulator used in the absence of PMIC */
> > > +     vcc_3v1: vcc-3v1 {
> > > +             compatible = "regulator-fixed";
> > > +             regulator-name = "fixed-3.1V";
> > > +             regulator-min-microvolt = <3100000>;
> > > +             regulator-max-microvolt = <3100000>;
> > > +     };
> >
> > Is this regulator used somewhere?
> 
> This is something I copied from bubblegum dts as I wasn't sure what is right way
> to include these regulators.
> 
> Also, another day tested it without having these regulators in , and
> still it seems to
> work.  So should these be removed ?
> 

Fixed regulators are used to nicely model the regulators which aren't tied to
any PMIC. But for some cases we use them to represent supplies when there is
no support for the specific PMIC present in the kernel and they are turned
on/configured by the bootloader (this is what happening here).

And there is no use of declaring fixed regulators when there is no consumer.
Even if you don't define these, the corresponding supplies in the board will
always be in the same state configured by the bootloader. So I'd suggest you
to remove this for now.

Since I don't have the schematics to check, please make sure you name the
regulators as mentioned in the schematics (this could vary from board to board,
so don't just copy from others).

Thanks,
Mani

> Thanks
> -Amit
Amit Tomer July 13, 2020, 9:03 a.m. UTC | #5
Hi,

> But this regulator is only used for the eMMC there, which we apparently
> don't have on the Cubieboard 7?

We do have eMMC present on Cubieboard 7 (both the versions of Cubieboard7), and
the regulator name is similar to what is used in
"s900-bubblegum-96.dts" .i.e. "vcc_3v1".

But Since this patch doesn't enable eMMC, it does make sense to remove this
"vcc_3v1" regulator and keep the other one.

> > Also, another day tested it without having these regulators in , and
> > still it seems to
> > work.  So should these be removed ?
>
> If there are not even referenced in the .dts, then fixed regulators are
> rather pointless. So yes, please remove this vcc-3v1 one.

Sure, I would do this.

> What is the story with the other regulator? Is there a PMIC or a power
> switch for the SD card? Or is the power supply actually hardwired?

SD_VCC is connected to SWITCH/LDO which gets input from ATM2603C PMIC.
This seems to be enabled by default ( in early bootloaders I guess).

Thanks
-Amit.
Amit Tomer July 13, 2020, 9:08 a.m. UTC | #6
Hi,

> Fixed regulators are used to nicely model the regulators which aren't tied to
> any PMIC. But for some cases we use them to represent supplies when there is
> no support for the specific PMIC present in the kernel and they are turned
> on/configured by the bootloader (this is what happening here).
>
> And there is no use of declaring fixed regulators when there is no consumer.
> Even if you don't define these, the corresponding supplies in the board will
> always be in the same state configured by the bootloader. So I'd suggest you
> to remove this for now.

Checked the schematics and regulator name is the same for both eMMC and uSD
Shall we keep uSD regulator sd_vcc to be consistent across ACTIONS platform?

> Since I don't have the schematics to check, please make sure you name the
> regulators as mentioned in the schematics (this could vary from board to board,
> so don't just copy from others).
>

Sure, point noted.

Thanks
-Amit.
Manivannan Sadhasivam July 17, 2020, 2:40 p.m. UTC | #7
On Mon, Jul 13, 2020 at 02:38:55PM +0530, Amit Tomer wrote:
> Hi,
> 
> > Fixed regulators are used to nicely model the regulators which aren't tied to
> > any PMIC. But for some cases we use them to represent supplies when there is
> > no support for the specific PMIC present in the kernel and they are turned
> > on/configured by the bootloader (this is what happening here).
> >
> > And there is no use of declaring fixed regulators when there is no consumer.
> > Even if you don't define these, the corresponding supplies in the board will
> > always be in the same state configured by the bootloader. So I'd suggest you
> > to remove this for now.
> 
> Checked the schematics and regulator name is the same for both eMMC and uSD

Okay, fine.

> Shall we keep uSD regulator sd_vcc to be consistent across ACTIONS platform?
> 

No. As I said before it depends on the individual board schematics.

Thanks,
Mani

> > Since I don't have the schematics to check, please make sure you name the
> > regulators as mentioned in the schematics (this could vary from board to board,
> > so don't just copy from others).
> >
> 
> Sure, point noted.
> 
> Thanks
> -Amit.
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/actions/s700-cubieboard7.dts b/arch/arm64/boot/dts/actions/s700-cubieboard7.dts
index 63e375cd9eb4..ec117eb12f3a 100644
--- a/arch/arm64/boot/dts/actions/s700-cubieboard7.dts
+++ b/arch/arm64/boot/dts/actions/s700-cubieboard7.dts
@@ -13,6 +13,7 @@ 
 
 	aliases {
 		serial3 = &uart3;
+		mmc0 = &mmc0;
 	};
 
 	chosen {
@@ -28,6 +29,23 @@ 
 		device_type = "memory";
 		reg = <0x1 0xe0000000 0x0 0x0>;
 	};
+
+	/* Fixed regulator used in the absence of PMIC */
+	vcc_3v1: vcc-3v1 {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-3.1V";
+		regulator-min-microvolt = <3100000>;
+		regulator-max-microvolt = <3100000>;
+	};
+
+	/* Fixed regulator used in the absence of PMIC */
+	sd_vcc: sd-vcc {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-3.1V";
+		regulator-min-microvolt = <3100000>;
+		regulator-max-microvolt = <3100000>;
+		regulator-always-on;
+	};
 };
 
 &i2c0 {
@@ -81,6 +99,14 @@ 
 			bias-pull-up;
 		};
 	};
+
+	mmc0_default: mmc0_default {
+		pinmux {
+			groups = "sd0_d0_mfp", "sd0_d1_mfp", "sd0_d2_d3_mfp",
+				 "sd0_cmd_mfp", "sd0_clk_mfp";
+			function = "sd0";
+		};
+	};
 };
 
 &timer {
@@ -90,3 +116,18 @@ 
 &uart3 {
 	status = "okay";
 };
+
+/* uSD */
+&mmc0 {
+	status = "okay";
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc0_default>;
+	cd-gpios = <&pinctrl 120 GPIO_ACTIVE_LOW>;
+	no-sdio;
+	no-mmc;
+	no-1-8-v;
+	bus-width = <4>;
+	vmmc-supply = <&sd_vcc>;
+	vqmmc-supply = <&sd_vcc>;
+};
+
diff --git a/arch/arm64/boot/dts/actions/s700.dtsi b/arch/arm64/boot/dts/actions/s700.dtsi
index 9ed88aafc2da..ba498cf9217d 100644
--- a/arch/arm64/boot/dts/actions/s700.dtsi
+++ b/arch/arm64/boot/dts/actions/s700.dtsi
@@ -4,6 +4,7 @@ 
  */
 
 #include <dt-bindings/clock/actions,s700-cmu.h>
+#include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/power/owl-s700-powergate.h>
 #include <dt-bindings/reset/actions,s700-reset.h>