diff mbox series

[6/8] ARM: dts: stm32: enable optee firmware and SCMI support on STM32MP15

Message ID 20220422150952.20587-7-alexandre.torgue@foss.st.com (mailing list archive)
State New, archived
Headers show
Series Add SCMI version of ST boards | expand

Commit Message

Alexandre TORGUE April 22, 2022, 3:09 p.m. UTC
Enable optee and SCMI clocks/reset protocols support.

Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>

Comments

Marek Vasut April 22, 2022, 4:32 p.m. UTC | #1
On 4/22/22 17:09, Alexandre Torgue wrote:
> Enable optee and SCMI clocks/reset protocols support.
> 
> Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
> 
> diff --git a/arch/arm/boot/dts/stm32mp151.dtsi b/arch/arm/boot/dts/stm32mp151.dtsi
> index 7fdc324b3cf9..1b2fd3426a81 100644
> --- a/arch/arm/boot/dts/stm32mp151.dtsi
> +++ b/arch/arm/boot/dts/stm32mp151.dtsi
> @@ -115,6 +115,33 @@
>   		status = "disabled";
>   	};
>   
> +	firmware {
> +		optee: optee {
> +			compatible = "linaro,optee-tz";
> +			method = "smc";
> +			status = "disabled";
> +		};

Doesn't this TEE node get automatically generated and patched into DT by 
the TEE ? I think OpTee-OS does that.
Etienne CARRIERE April 25, 2022, 10:19 a.m. UTC | #2
Hello Marek,

> From: Marek Vasut <marex@denx.de>
> 
> > On 4/22/22 17:09, Alexandre Torgue wrote:
> > Enable optee and SCMI clocks/reset protocols support.
> > 
> > Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
> > 
> > diff --git a/arch/arm/boot/dts/stm32mp151.dtsi
> > b/arch/arm/boot/dts/stm32mp151.dtsi
> > index 7fdc324b3cf9..1b2fd3426a81 100644
> > --- a/arch/arm/boot/dts/stm32mp151.dtsi
> > +++ b/arch/arm/boot/dts/stm32mp151.dtsi
> > @@ -115,6 +115,33 @@
> >                status = "disabled";
> >        };
> >   
> > +     firmware {
> > +             optee: optee {
> > +                     compatible = "linaro,optee-tz";
> > +                     method = "smc";
> > +                     status = "disabled";
> > +             };
> 
> Doesn't this TEE node get automatically generated and patched into DT by 
> the TEE ? I think OpTee-OS does that.

OP-TEE OS does that if it gets passed the DT from early boot stage which is not always the case.

Etienne
Marek Vasut April 25, 2022, 10:25 a.m. UTC | #3
On 4/25/22 12:19, Etienne CARRIERE wrote:
> Hello Marek,

Hi,

>> From: Marek Vasut <marex@denx.de>
>>
>>> On 4/22/22 17:09, Alexandre Torgue wrote:
>>> Enable optee and SCMI clocks/reset protocols support.
>>>
>>> Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
>>>
>>> diff --git a/arch/arm/boot/dts/stm32mp151.dtsi
>>> b/arch/arm/boot/dts/stm32mp151.dtsi
>>> index 7fdc324b3cf9..1b2fd3426a81 100644
>>> --- a/arch/arm/boot/dts/stm32mp151.dtsi
>>> +++ b/arch/arm/boot/dts/stm32mp151.dtsi
>>> @@ -115,6 +115,33 @@
>>>                  status = "disabled";
>>>          };
>>>     
>>> +     firmware {
>>> +             optee: optee {
>>> +                     compatible = "linaro,optee-tz";
>>> +                     method = "smc";
>>> +                     status = "disabled";
>>> +             };
>>
>> Doesn't this TEE node get automatically generated and patched into DT by
>> the TEE ? I think OpTee-OS does that.
> 
> OP-TEE OS does that if it gets passed the DT from early boot stage which is not always the case.

Shouldn't that be something to fix ?

I think R-Car3 does that already.
Rouven Czerwinski April 25, 2022, 10:30 a.m. UTC | #4
Hi,

On Mon, 2022-04-25 at 12:25 +0200, Marek Vasut wrote:
> On 4/25/22 12:19, Etienne CARRIERE wrote:
> > Hello Marek,
> 
> Hi,
> 
> > > From: Marek Vasut <marex@denx.de>
> > > 
> > > > On 4/22/22 17:09, Alexandre Torgue wrote:
> > > > Enable optee and SCMI clocks/reset protocols support.
> > > > 
> > > > Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
> > > > 
> > > > diff --git a/arch/arm/boot/dts/stm32mp151.dtsi
> > > > b/arch/arm/boot/dts/stm32mp151.dtsi
> > > > index 7fdc324b3cf9..1b2fd3426a81 100644
> > > > --- a/arch/arm/boot/dts/stm32mp151.dtsi
> > > > +++ b/arch/arm/boot/dts/stm32mp151.dtsi
> > > > @@ -115,6 +115,33 @@
> > > >                  status = "disabled";
> > > >          };
> > > >     
> > > > +     firmware {
> > > > +             optee: optee {
> > > > +                     compatible = "linaro,optee-tz";
> > > > +                     method = "smc";
> > > > +                     status = "disabled";
> > > > +             };
> > > 
> > > Doesn't this TEE node get automatically generated and patched into DT by
> > > the TEE ? I think OpTee-OS does that.
> > 
> > OP-TEE OS does that if it gets passed the DT from early boot stage which is not always the case.
> 
> Shouldn't that be something to fix ?
> 
> I think R-Car3 does that already.

FWIW it's also possible for OP-TEE to generate a device tree overlay
which can be applied by later boot stages.

Drawback is that you either need an additional parameter to pass
between boot stages (address of the DT overlay) or it needs to be
hardcoded. Hardcoding has it's own bag of drawbacks, but it's what we
do for some i.MX6 platforms within barebox. However there is no TF-A
there, so only OP-TEE and Barebox need to agree on the fixed location
beforehand.

Best regards,
Rouven Czerwinski
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/stm32mp151.dtsi b/arch/arm/boot/dts/stm32mp151.dtsi
index 7fdc324b3cf9..1b2fd3426a81 100644
--- a/arch/arm/boot/dts/stm32mp151.dtsi
+++ b/arch/arm/boot/dts/stm32mp151.dtsi
@@ -115,6 +115,33 @@ 
 		status = "disabled";
 	};
 
+	firmware {
+		optee: optee {
+			compatible = "linaro,optee-tz";
+			method = "smc";
+			status = "disabled";
+		};
+
+		scmi: scmi {
+			compatible = "linaro,scmi-optee";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			linaro,optee-channel-id = <0>;
+			shmem = <&scmi_shm>;
+			status = "disabled";
+
+			scmi_clk: protocol@14 {
+				reg = <0x14>;
+				#clock-cells = <1>;
+			};
+
+			scmi_reset: protocol@16 {
+				reg = <0x16>;
+				#reset-cells = <1>;
+			};
+		};
+	};
+
 	soc {
 		compatible = "simple-bus";
 		#address-cells = <1>;
@@ -122,6 +149,20 @@ 
 		interrupt-parent = <&intc>;
 		ranges;
 
+		scmi_sram: sram@2ffff000 {
+			compatible = "mmio-sram";
+			reg = <0x2ffff000 0x1000>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0 0x2ffff000 0x1000>;
+
+			scmi_shm: scmi-sram@0 {
+				compatible = "arm,scmi-shmem";
+				reg = <0 0x80>;
+				status = "disabled";
+			};
+		};
+
 		timers2: timer@40000000 {
 			#address-cells = <1>;
 			#size-cells = <0>;