diff mbox series

[1/2] dt-bindings: remoteproc: imx_rproc: Support i.MX8MN/P MMIO

Message ID 20230707232626.374475-1-marex@denx.de (mailing list archive)
State Superseded
Headers show
Series [1/2] dt-bindings: remoteproc: imx_rproc: Support i.MX8MN/P MMIO | expand

Commit Message

Marek Vasut July 7, 2023, 11:26 p.m. UTC
The MX8M CM7 boot via SMC call is problematic, since not all versions
of ATF support this interface. Document MMIO support used to boot the
CM7 on MX8MN/MP instead and discern MMIO interface using DT compatible
string. Document GPR register syscon phandle which is required by the
MMIO interface too.

Signed-off-by: Marek Vasut <marex@denx.de>
---
Note that the MMIO being discerned using compatible string is similar
approach to "st,stm32mp1-rcc" vs "st,stm32mp1-rcc-secure".
---
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Conor Dooley <conor+dt@kernel.org>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-remoteproc@vger.kernel.org
---
 .../bindings/remoteproc/fsl,imx-rproc.yaml    | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

Peng Fan July 10, 2023, 1:20 a.m. UTC | #1
> Subject: [PATCH 1/2] dt-bindings: remoteproc: imx_rproc: Support
> i.MX8MN/P MMIO
> 
> The MX8M CM7 boot via SMC call is problematic, since not all versions of
> ATF support this interface. Document MMIO support used to boot the
> CM7 on MX8MN/MP instead and discern MMIO interface using DT
> compatible string. Document GPR register syscon phandle which is required
> by the MMIO interface too.
> 

How about introducing a Boolean property fsl,rproc-mmio and only
valid for i.MX8MN/P?

Regards,
Peng.
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> Note that the MMIO being discerned using compatible string is similar
> approach to "st,stm32mp1-rcc" vs "st,stm32mp1-rcc-secure".
> ---
> Cc: Bjorn Andersson <andersson@kernel.org>
> Cc: Conor Dooley <conor+dt@kernel.org>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Cc: NXP Linux Team <linux-imx@nxp.com>
> Cc: Peng Fan <peng.fan@nxp.com>
> Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: devicetree@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-remoteproc@vger.kernel.org
> ---
>  .../bindings/remoteproc/fsl,imx-rproc.yaml    | 20 +++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/remoteproc/fsl,imx-
> rproc.yaml b/Documentation/devicetree/bindings/remoteproc/fsl,imx-
> rproc.yaml
> index c940199ce89df..78bb976f738ee 100644
> --- a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
> +++ b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
> @@ -20,7 +20,9 @@ properties:
>        - fsl,imx7ulp-cm4
>        - fsl,imx8mm-cm4
>        - fsl,imx8mn-cm7
> +      - fsl,imx8mn-cm7-mmio
>        - fsl,imx8mp-cm7
> +      - fsl,imx8mp-cm7-mmio
>        - fsl,imx8mq-cm4
>        - fsl,imx8qm-cm4
>        - fsl,imx8qxp-cm4
> @@ -30,6 +32,11 @@ properties:
>    clocks:
>      maxItems: 1
> 
> +  gpr:
> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description:
> +      Phandle to IOMUXC GPR block which provide access to CM7 CPUWAIT
> bit.
> +
>    syscon:
>      $ref: /schemas/types.yaml#/definitions/phandle
>      description:
> @@ -84,6 +91,19 @@ properties:
>  required:
>    - compatible
> 
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          not:
> +            contains:
> +              enum:
> +                - fsl,imx8mn-cm7-mmio
> +                - fsl,imx8mp-cm7-mmio
> +    then:
> +      properties:
> +        gpr: false
> +
>  additionalProperties: false
> 
>  examples:
> --
> 2.40.1
Krzysztof Kozlowski July 10, 2023, 8:13 a.m. UTC | #2
On 08/07/2023 01:26, Marek Vasut wrote:
> The MX8M CM7 boot via SMC call is problematic, since not all versions
> of ATF support this interface. Document MMIO support used to boot the
> CM7 on MX8MN/MP instead and discern MMIO interface using DT compatible
> string. Document GPR register syscon phandle which is required by the
> MMIO interface too.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> Note that the MMIO being discerned using compatible string is similar
> approach to "st,stm32mp1-rcc" vs "st,stm32mp1-rcc-secure".
> ---

Same hardware should not have two compatibles, depending on the bus it is.

Best regards,
Krzysztof
Marek Vasut July 10, 2023, 9:10 a.m. UTC | #3
On 7/10/23 10:13, Krzysztof Kozlowski wrote:
> On 08/07/2023 01:26, Marek Vasut wrote:
>> The MX8M CM7 boot via SMC call is problematic, since not all versions
>> of ATF support this interface. Document MMIO support used to boot the
>> CM7 on MX8MN/MP instead and discern MMIO interface using DT compatible
>> string. Document GPR register syscon phandle which is required by the
>> MMIO interface too.
>>
>> Signed-off-by: Marek Vasut <marex@denx.de>
>> ---
>> Note that the MMIO being discerned using compatible string is similar
>> approach to "st,stm32mp1-rcc" vs "st,stm32mp1-rcc-secure".
>> ---
> 
> Same hardware should not have two compatibles, depending on the bus it is.

Yes, I know, but for whatever reason the ST does, so I picked the same 
approach here. What else would you suggest, boolean properly like Peng 
wrote ?

The compatible is also easier to handle on driver level, at least in 
Linux, see 2/2 .
Rob Herring (Arm) July 10, 2023, 3:09 p.m. UTC | #4
On Mon, Jul 10, 2023 at 11:10:48AM +0200, Marek Vasut wrote:
> On 7/10/23 10:13, Krzysztof Kozlowski wrote:
> > On 08/07/2023 01:26, Marek Vasut wrote:
> > > The MX8M CM7 boot via SMC call is problematic, since not all versions
> > > of ATF support this interface. Document MMIO support used to boot the
> > > CM7 on MX8MN/MP instead and discern MMIO interface using DT compatible
> > > string. Document GPR register syscon phandle which is required by the
> > > MMIO interface too.
> > > 
> > > Signed-off-by: Marek Vasut <marex@denx.de>
> > > ---
> > > Note that the MMIO being discerned using compatible string is similar
> > > approach to "st,stm32mp1-rcc" vs "st,stm32mp1-rcc-secure".
> > > ---
> > 
> > Same hardware should not have two compatibles, depending on the bus it is.
> 
> Yes, I know, but for whatever reason the ST does, so I picked the same
> approach here. What else would you suggest, boolean properly like Peng wrote
> ?
> 
> The compatible is also easier to handle on driver level, at least in Linux,
> see 2/2 .

IIRC, in the ST case, the programming model presented to the OS is 
different, so different compatibles. Seems like this case is similar.

However, can't you try and SMC call and if it fails, use MMIO?

Rob
Rob Herring (Arm) July 10, 2023, 3:11 p.m. UTC | #5
On Sat, Jul 08, 2023 at 01:26:25AM +0200, Marek Vasut wrote:
> The MX8M CM7 boot via SMC call is problematic, since not all versions
> of ATF support this interface. Document MMIO support used to boot the
> CM7 on MX8MN/MP instead and discern MMIO interface using DT compatible
> string. Document GPR register syscon phandle which is required by the
> MMIO interface too.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> Note that the MMIO being discerned using compatible string is similar
> approach to "st,stm32mp1-rcc" vs "st,stm32mp1-rcc-secure".
> ---
> Cc: Bjorn Andersson <andersson@kernel.org>
> Cc: Conor Dooley <conor+dt@kernel.org>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
> Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> Cc: NXP Linux Team <linux-imx@nxp.com>
> Cc: Peng Fan <peng.fan@nxp.com>
> Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: devicetree@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-remoteproc@vger.kernel.org
> ---
>  .../bindings/remoteproc/fsl,imx-rproc.yaml    | 20 +++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
> index c940199ce89df..78bb976f738ee 100644
> --- a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
> +++ b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
> @@ -20,7 +20,9 @@ properties:
>        - fsl,imx7ulp-cm4
>        - fsl,imx8mm-cm4
>        - fsl,imx8mn-cm7
> +      - fsl,imx8mn-cm7-mmio
>        - fsl,imx8mp-cm7
> +      - fsl,imx8mp-cm7-mmio
>        - fsl,imx8mq-cm4
>        - fsl,imx8qm-cm4
>        - fsl,imx8qxp-cm4
> @@ -30,6 +32,11 @@ properties:
>    clocks:
>      maxItems: 1
>  
> +  gpr:

fsl,gpr or fsl,iomuxc-gpr

> +    $ref: /schemas/types.yaml#/definitions/phandle
> +    description:
> +      Phandle to IOMUXC GPR block which provide access to CM7 CPUWAIT bit.
> +
>    syscon:
>      $ref: /schemas/types.yaml#/definitions/phandle
>      description:
> @@ -84,6 +91,19 @@ properties:
>  required:
>    - compatible
>  
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          not:
> +            contains:
> +              enum:
> +                - fsl,imx8mn-cm7-mmio
> +                - fsl,imx8mp-cm7-mmio
> +    then:
> +      properties:
> +        gpr: false
> +
>  additionalProperties: false
>  
>  examples:
> -- 
> 2.40.1
>
Marek Vasut July 10, 2023, 9:54 p.m. UTC | #6
On 7/10/23 17:09, Rob Herring wrote:
> On Mon, Jul 10, 2023 at 11:10:48AM +0200, Marek Vasut wrote:
>> On 7/10/23 10:13, Krzysztof Kozlowski wrote:
>>> On 08/07/2023 01:26, Marek Vasut wrote:
>>>> The MX8M CM7 boot via SMC call is problematic, since not all versions
>>>> of ATF support this interface. Document MMIO support used to boot the
>>>> CM7 on MX8MN/MP instead and discern MMIO interface using DT compatible
>>>> string. Document GPR register syscon phandle which is required by the
>>>> MMIO interface too.
>>>>
>>>> Signed-off-by: Marek Vasut <marex@denx.de>
>>>> ---
>>>> Note that the MMIO being discerned using compatible string is similar
>>>> approach to "st,stm32mp1-rcc" vs "st,stm32mp1-rcc-secure".
>>>> ---
>>>
>>> Same hardware should not have two compatibles, depending on the bus it is.
>>
>> Yes, I know, but for whatever reason the ST does, so I picked the same
>> approach here. What else would you suggest, boolean properly like Peng wrote
>> ?
>>
>> The compatible is also easier to handle on driver level, at least in Linux,
>> see 2/2 .
> 
> IIRC, in the ST case, the programming model presented to the OS is
> different, so different compatibles. Seems like this case is similar.
> 
> However, can't you try and SMC call and if it fails, use MMIO?

They already do that to determine the CM4 CPU state, and if the SMC 
errors out, then they indicate the CPU is detached. So no, not to my 
knowledge, which indeed would be my preferred solution though.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
index c940199ce89df..78bb976f738ee 100644
--- a/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
+++ b/Documentation/devicetree/bindings/remoteproc/fsl,imx-rproc.yaml
@@ -20,7 +20,9 @@  properties:
       - fsl,imx7ulp-cm4
       - fsl,imx8mm-cm4
       - fsl,imx8mn-cm7
+      - fsl,imx8mn-cm7-mmio
       - fsl,imx8mp-cm7
+      - fsl,imx8mp-cm7-mmio
       - fsl,imx8mq-cm4
       - fsl,imx8qm-cm4
       - fsl,imx8qxp-cm4
@@ -30,6 +32,11 @@  properties:
   clocks:
     maxItems: 1
 
+  gpr:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      Phandle to IOMUXC GPR block which provide access to CM7 CPUWAIT bit.
+
   syscon:
     $ref: /schemas/types.yaml#/definitions/phandle
     description:
@@ -84,6 +91,19 @@  properties:
 required:
   - compatible
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          not:
+            contains:
+              enum:
+                - fsl,imx8mn-cm7-mmio
+                - fsl,imx8mp-cm7-mmio
+    then:
+      properties:
+        gpr: false
+
 additionalProperties: false
 
 examples: