Re: [RFC 5/6] firmware: scmi: add pseudo pinctrl protocol support on sandbox

2023-09-10 Thread AKASHI Takahiro
On Sun, Sep 10, 2023 at 01:13:28PM -0600, Simon Glass wrote:
> Hi AKASHI,
> 
> On Tue, 5 Sept 2023 at 20:41, AKASHI Takahiro
>  wrote:
> >
> > With this patch, sandbox SCMI agent can handle pinctrl protocol.
> > This feature is used in an unit test for SCMI pinctrl.
> >
> > Signed-off-by: AKASHI Takahiro 
> > ---
> >  arch/sandbox/dts/test.dts  | 115 
> >  drivers/firmware/scmi/sandbox-scmi_agent.c | 722 +
> >  2 files changed, 837 insertions(+)
> >
> > diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> > index dc0bfdfb6e4b..d2ddea801995 100644
> > --- a/arch/sandbox/dts/test.dts
> > +++ b/arch/sandbox/dts/test.dts
> > @@ -723,9 +723,124 @@
> > };
> > };
> > };
> > +
> > +   pinctrl_scmi: protocol@19 {
> > +   reg = <0x19>;
> > +
> > +   pinctrl-names = "default","alternate";
> > +   pinctrl-0 = <_pinctrl_gpios>, 
> > <_pinctrl_i2s>;
> > +   pinctrl-1 = <_pinctrl_spi>, 
> > <_pinctrl_i2c>;
> > +
> > +#if 0
> 
> Are these alternatives that you are testing?

I should have had more explanation.
Yes, as I mentioned in the cover letter (and patch#4), there
are two alternatives for defining SCMI pinctrl based gpio devices.
Actually, this "#if" corresponds to the case (B) where gpio node
is located under scmi node.

Since I didn't come up with any good way to switch two cases dynamically
in the test, I had modified this option manually.
(I left two "#if" here as the patch was an RFC, any way.)

Thanks,
-Takahiro Akashi

> 
> The bindings  look OK to me - is this how it is done in Linux?
> 
> Regards,
> Simon


Re: [RFC 5/6] firmware: scmi: add pseudo pinctrl protocol support on sandbox

2023-09-10 Thread Simon Glass
Hi AKASHI,

On Tue, 5 Sept 2023 at 20:41, AKASHI Takahiro
 wrote:
>
> With this patch, sandbox SCMI agent can handle pinctrl protocol.
> This feature is used in an unit test for SCMI pinctrl.
>
> Signed-off-by: AKASHI Takahiro 
> ---
>  arch/sandbox/dts/test.dts  | 115 
>  drivers/firmware/scmi/sandbox-scmi_agent.c | 722 +
>  2 files changed, 837 insertions(+)
>
> diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
> index dc0bfdfb6e4b..d2ddea801995 100644
> --- a/arch/sandbox/dts/test.dts
> +++ b/arch/sandbox/dts/test.dts
> @@ -723,9 +723,124 @@
> };
> };
> };
> +
> +   pinctrl_scmi: protocol@19 {
> +   reg = <0x19>;
> +
> +   pinctrl-names = "default","alternate";
> +   pinctrl-0 = <_pinctrl_gpios>, 
> <_pinctrl_i2s>;
> +   pinctrl-1 = <_pinctrl_spi>, 
> <_pinctrl_i2c>;
> +
> +#if 0

Are these alternatives that you are testing?

The bindings  look OK to me - is this how it is done in Linux?

Regards,
Simon


[RFC 5/6] firmware: scmi: add pseudo pinctrl protocol support on sandbox

2023-09-05 Thread AKASHI Takahiro
With this patch, sandbox SCMI agent can handle pinctrl protocol.
This feature is used in an unit test for SCMI pinctrl.

Signed-off-by: AKASHI Takahiro 
---
 arch/sandbox/dts/test.dts  | 115 
 drivers/firmware/scmi/sandbox-scmi_agent.c | 722 +
 2 files changed, 837 insertions(+)

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index dc0bfdfb6e4b..d2ddea801995 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -723,9 +723,124 @@
};
};
};
+
+   pinctrl_scmi: protocol@19 {
+   reg = <0x19>;
+
+   pinctrl-names = "default","alternate";
+   pinctrl-0 = <_pinctrl_gpios>, 
<_pinctrl_i2s>;
+   pinctrl-1 = <_pinctrl_spi>, 
<_pinctrl_i2c>;
+
+#if 0
+   scmi_pinctrl_gpio_a: scmi_gpios {
+   gpio-controller;
+   #gpio-cells = <2>;
+   gpio-bank-name = "scmi_gpios";
+   ngpios = <4>;
+   gpio-ranges = <_scmi 0 5 4>,
+ <_scmi 4 0 0>;
+   gpio-ranges-group-names = "",
+ "GPIO_B";
+
+   hog_input_1 {
+   gpio-hog;
+   input;
+   gpios = <1 GPIO_ACTIVE_HIGH>;
+   };
+   hog_output_3 {
+   gpio-hog;
+   output-high;
+   output-mode;
+   output-value = <1>;
+   gpios = <3 GPIO_ACTIVE_HIGH>;
+   };
+   };
+#endif
+
+   scmi_pinctrl_gpios: gpios-pins {
+   gpio0 {
+   pins = "P5";
+   function = "GPIO";
+   bias-pull-up;
+   // input-disable;
+   input-mode = <0>;
+   };
+   gpio1 {
+   pins = "P6";
+   function = "GPIO";
+   // output-high;
+   output-mode;
+   output-value = <1>;
+   drive-open-drain;
+   };
+   gpio2 {
+   pinmux = ;
+   bias-pull-down;
+   // input-enable;
+   input-mode;
+   };
+   gpio3 {
+   pinmux = ;
+   bias-disable;
+   };
+   };
+
+   scmi_pinctrl_i2c: i2c-pins {
+   groups {
+   groups = "I2C_UART";
+   function = "I2C";
+   };
+
+   pins {
+   pins = "P0", "P1";
+   drive-open-drain;
+   };
+   };
+
+   scmi_pinctrl_i2s: i2s-pins {
+   groups = "SPI_I2S";
+   function = "I2S";
+   };
+
+   scmi_pinctrl_spi: spi-pins {
+   groups = "SPI_I2S";
+   function = "SPI";
+
+   cs {
+   pinmux = ,
+;
+