All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaud POULIQUEN <arnaud.pouliquen@st.com>
To: Rob Herring <robh@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Alexandre Torgue <alexandre.torgue@st.com>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	<devicetree@vger.kernel.org>,
	<linux-stm32@st-md-mailman.stormreply.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	Fabien Dessenne <fabien.dessenne@st.com>
Subject: Re: [PATCH] dt-bindings: stm32: convert mlahb to json-schema
Date: Mon, 16 Dec 2019 09:44:14 +0100	[thread overview]
Message-ID: <7ac83aa6-0ec6-db4f-556d-a17c28d2bcab@st.com> (raw)
In-Reply-To: <20191213213916.GA1292@bogus>

Hello Rob,

On 12/13/19 10:39 PM, Rob Herring wrote:
> On Thu, Nov 28, 2019 at 04:46:03PM +0100, Arnaud Pouliquen wrote:
>> Convert the ML-AHB bus bindings to DT schema format using json-schema
>>
>> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
>> ---
>> Notice that this patch requests an update of the simple-bus schema to add
>> the support of the "dma-ranges" property.
>> A Pull request has been sent in parallel to the dt-schema github repo:
>> https://github.com/devicetree-org/dt-schema/pull/30
>>
>> To remind the topic around the use of "dma-ranges" please
>> refer to following discussion: https://lkml.org/lkml/2019/4/3/1261
>> ---
>>  .../devicetree/bindings/arm/stm32/mlahb.txt   | 37 ----------
>>  .../bindings/arm/stm32/st,mlahb.yaml          | 69 +++++++++++++++++++
>>  2 files changed, 69 insertions(+), 37 deletions(-)
>>  delete mode 100644 Documentation/devicetree/bindings/arm/stm32/mlahb.txt
>>  create mode 100644 Documentation/devicetree/bindings/arm/stm32/st,mlahb.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/arm/stm32/mlahb.txt b/Documentation/devicetree/bindings/arm/stm32/mlahb.txt
>> deleted file mode 100644
>> index 25307aa1eb9b..000000000000
>> --- a/Documentation/devicetree/bindings/arm/stm32/mlahb.txt
>> +++ /dev/null
>> @@ -1,37 +0,0 @@
>> -ML-AHB interconnect bindings
>> -
>> -These bindings describe the STM32 SoCs ML-AHB interconnect bus which connects
>> -a Cortex-M subsystem with dedicated memories.
>> -The MCU SRAM and RETRAM memory parts can be accessed through different addresses
>> -(see "RAM aliases" in [1]) using different buses (see [2]) : balancing the
>> -Cortex-M firmware accesses among those ports allows to tune the system
>> -performance.
>> -
>> -[1]: https://www.st.com/resource/en/reference_manual/dm00327659.pdf
>> -[2]: https://wiki.st.com/stm32mpu/wiki/STM32MP15_RAM_mapping
>> -
>> -Required properties:
>> -- compatible: should be "simple-bus"
>> -- dma-ranges: describes memory addresses translation between the local CPU and
>> -	   the remote Cortex-M processor. Each memory region, is declared with
>> -	   3 parameters:
>> -		 - param 1: device base address (Cortex-M processor address)
>> -		 - param 2: physical base address (local CPU address)
>> -		 - param 3: size of the memory region.
>> -
>> -The Cortex-M remote processor accessed via the mlahb interconnect is described
>> -by a child node.
>> -
>> -Example:
>> -mlahb {
>> -	compatible = "simple-bus";
>> -	#address-cells = <1>;
>> -	#size-cells = <1>;
>> -	dma-ranges = <0x00000000 0x38000000 0x10000>,
>> -		     <0x10000000 0x10000000 0x60000>,
>> -		     <0x30000000 0x30000000 0x60000>;
>> -
>> -	m4_rproc: m4@10000000 {
>> -		...
>> -	};
>> -};
>> diff --git a/Documentation/devicetree/bindings/arm/stm32/st,mlahb.yaml b/Documentation/devicetree/bindings/arm/stm32/st,mlahb.yaml
>> new file mode 100644
>> index 000000000000..8ad3f7c7f9ab
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/arm/stm32/st,mlahb.yaml
>> @@ -0,0 +1,69 @@
>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: "http://devicetree.org/schemas/arm/stm32/st,mlahb.yaml#"
>> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
>> +
>> +title: STMicroelectronics STM32 ML-AHB interconnect bindings
>> +
>> +maintainers:
>> +  - Fabien Dessenne <fabien.dessenne@st.com>
>> +  - Arnaud Pouliquen <arnaud.pouliquen@st.com>
>> +
>> +description: |
>> +  These bindings describe the STM32 SoCs ML-AHB interconnect bus which connects
>> +  a Cortex-M subsystem with dedicated memories. The MCU SRAM and RETRAM memory
>> +  parts can be accessed through different addresses (see "RAM aliases" in [1])
>> +  using different buses (see [2]): balancing the Cortex-M firmware accesses
>> +  among those ports allows to tune the system performance.
>> +  [1]: https://www.st.com/resource/en/reference_manual/dm00327659.pdf
>> +  [2]: https://wiki.st.com/stm32mpu/wiki/STM32MP15_RAM_mapping
>> +
>> +allOf:
>> + - $ref: /schemas/simple-bus.yaml#
>> +
>> +properties:
>> +  compatible:
>> +    contains:
>> +      enum:
>> +        - st,mlahb
>> +
>> +  dma-ranges:
>> +    description: |
>> +      Describe memory addresses translation between the local CPU and the
>> +      remote Cortex-M processor. Each memory region, is declared with
>> +      3 parameters:
>> +      - param 1: device base address (Cortex-M processor address)
>> +      - param 2: physical base address (local CPU address)
>> +      - param 3: size of the memory region.
>> +    maxItems: 3
>> +
>> +  '#address-cells':
>> +    const: 1
>> +
>> +  '#size-cells':
>> +    const: 1
>> +
>> +required:
>> +  - compatible
>> +  - '#address-cells'
>> +  - '#size-cells'
>> +  - dma-ranges
>> +
>> +examples:
>> +  - |
>> +    mlahb: ahb {
>> +      compatible = "st,mlahb", "simple-bus";
>> +      #address-cells = <1>;
>> +      #size-cells = <1>;
>> +      reg = <0x10000000 0x40000>;
>> +      dma-ranges = <0x00000000 0x38000000 0x10000>,
>> +                   <0x10000000 0x10000000 0x60000>,
>> +                   <0x30000000 0x30000000 0x60000>;
>> +
> 
> Fails to build:
> 
> builds/robherring/linux-dt-review/Documentation/devicetree/bindings/arm/stm32/st,mlahb.example.dt.yaml: 
> ahb: 'ranges' is a required property
> 
> Run 'make dt_binding_check'

Yes, that why i posted in parallel the PR on the tool:
https://github.com/devicetree-org/dt-schema/pull/30. 

I don't know if you saw my answer on this post so i copy/paste  it here:

How to describe the stm32mp1 coprocessor mapping and translations based on this "ranges" requirement?

On stm32mp1 we have 2 RAM memories accessible by the Cortex-A7 running Linux and used by the Cortex-M4 coprocessor to run its code. Each Cortex has a specific mapping of the memories. Some memory translations are needed by:

- rproc driver to load the Cortex-M4 firmware in RAMs
- rpmsg & virtio frameworks for shared memory

Here is the memory mapping:

- RETRAM (64 kB);
  - Cortex-A7 @ : 0x38000000
  - Cortex-M4 @: 0x00000000
- MCUSRAM (up to 384 kB)
  - Cortex-A7 @ : 0x30000000 or 0x10000000 ( 2 addresses for the same memory)
  - Cortex-M4 @: 0x30000000 or 0x10000000 ( 2 addresses for the same memory)
  =>addresses used on both side depend on the MCURAM access optimization

Today our upstreamed solution is based on dma-range only (https://lkml.org/lkml/2019/4/3/1261)

What about adding an "unused" ranges property in DT to match the requirement?

	mlahb {
		compatible = "simple-bus";
		#address-cells = <1>;
		#size-cells = <1>;
		ranges = <0 0x38000000 0x10000>,
			       <1 0x10000000 0x60000>,
			       <2 0x30000000 0x60000>;
		dma-ranges = <0x00000000 0x38000000 0x10000>,
			     <0x10000000 0x10000000 0x60000>,
			     <0x30000000 0x30000000 0x60000>;

		m4_rproc: m4@10000000 {
		        ---
		};
	};

Thanks in advance for your feedback.
Regards,
Arnaud

> 
>> +      m4_rproc: m4@10000000 {
>> +       reg = <0x10000000 0x40000>;
>> +      };
>> +    };
>> +
>> +...
>> -- 
>> 2.17.1
>>

WARNING: multiple messages have this Message-ID (diff)
From: Arnaud POULIQUEN <arnaud.pouliquen@st.com>
To: Rob Herring <robh@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	devicetree@vger.kernel.org,
	Alexandre Torgue <alexandre.torgue@st.com>,
	linux-kernel@vger.kernel.org,
	Fabien Dessenne <fabien.dessenne@st.com>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] dt-bindings: stm32: convert mlahb to json-schema
Date: Mon, 16 Dec 2019 09:44:14 +0100	[thread overview]
Message-ID: <7ac83aa6-0ec6-db4f-556d-a17c28d2bcab@st.com> (raw)
In-Reply-To: <20191213213916.GA1292@bogus>

Hello Rob,

On 12/13/19 10:39 PM, Rob Herring wrote:
> On Thu, Nov 28, 2019 at 04:46:03PM +0100, Arnaud Pouliquen wrote:
>> Convert the ML-AHB bus bindings to DT schema format using json-schema
>>
>> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
>> ---
>> Notice that this patch requests an update of the simple-bus schema to add
>> the support of the "dma-ranges" property.
>> A Pull request has been sent in parallel to the dt-schema github repo:
>> https://github.com/devicetree-org/dt-schema/pull/30
>>
>> To remind the topic around the use of "dma-ranges" please
>> refer to following discussion: https://lkml.org/lkml/2019/4/3/1261
>> ---
>>  .../devicetree/bindings/arm/stm32/mlahb.txt   | 37 ----------
>>  .../bindings/arm/stm32/st,mlahb.yaml          | 69 +++++++++++++++++++
>>  2 files changed, 69 insertions(+), 37 deletions(-)
>>  delete mode 100644 Documentation/devicetree/bindings/arm/stm32/mlahb.txt
>>  create mode 100644 Documentation/devicetree/bindings/arm/stm32/st,mlahb.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/arm/stm32/mlahb.txt b/Documentation/devicetree/bindings/arm/stm32/mlahb.txt
>> deleted file mode 100644
>> index 25307aa1eb9b..000000000000
>> --- a/Documentation/devicetree/bindings/arm/stm32/mlahb.txt
>> +++ /dev/null
>> @@ -1,37 +0,0 @@
>> -ML-AHB interconnect bindings
>> -
>> -These bindings describe the STM32 SoCs ML-AHB interconnect bus which connects
>> -a Cortex-M subsystem with dedicated memories.
>> -The MCU SRAM and RETRAM memory parts can be accessed through different addresses
>> -(see "RAM aliases" in [1]) using different buses (see [2]) : balancing the
>> -Cortex-M firmware accesses among those ports allows to tune the system
>> -performance.
>> -
>> -[1]: https://www.st.com/resource/en/reference_manual/dm00327659.pdf
>> -[2]: https://wiki.st.com/stm32mpu/wiki/STM32MP15_RAM_mapping
>> -
>> -Required properties:
>> -- compatible: should be "simple-bus"
>> -- dma-ranges: describes memory addresses translation between the local CPU and
>> -	   the remote Cortex-M processor. Each memory region, is declared with
>> -	   3 parameters:
>> -		 - param 1: device base address (Cortex-M processor address)
>> -		 - param 2: physical base address (local CPU address)
>> -		 - param 3: size of the memory region.
>> -
>> -The Cortex-M remote processor accessed via the mlahb interconnect is described
>> -by a child node.
>> -
>> -Example:
>> -mlahb {
>> -	compatible = "simple-bus";
>> -	#address-cells = <1>;
>> -	#size-cells = <1>;
>> -	dma-ranges = <0x00000000 0x38000000 0x10000>,
>> -		     <0x10000000 0x10000000 0x60000>,
>> -		     <0x30000000 0x30000000 0x60000>;
>> -
>> -	m4_rproc: m4@10000000 {
>> -		...
>> -	};
>> -};
>> diff --git a/Documentation/devicetree/bindings/arm/stm32/st,mlahb.yaml b/Documentation/devicetree/bindings/arm/stm32/st,mlahb.yaml
>> new file mode 100644
>> index 000000000000..8ad3f7c7f9ab
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/arm/stm32/st,mlahb.yaml
>> @@ -0,0 +1,69 @@
>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: "http://devicetree.org/schemas/arm/stm32/st,mlahb.yaml#"
>> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
>> +
>> +title: STMicroelectronics STM32 ML-AHB interconnect bindings
>> +
>> +maintainers:
>> +  - Fabien Dessenne <fabien.dessenne@st.com>
>> +  - Arnaud Pouliquen <arnaud.pouliquen@st.com>
>> +
>> +description: |
>> +  These bindings describe the STM32 SoCs ML-AHB interconnect bus which connects
>> +  a Cortex-M subsystem with dedicated memories. The MCU SRAM and RETRAM memory
>> +  parts can be accessed through different addresses (see "RAM aliases" in [1])
>> +  using different buses (see [2]): balancing the Cortex-M firmware accesses
>> +  among those ports allows to tune the system performance.
>> +  [1]: https://www.st.com/resource/en/reference_manual/dm00327659.pdf
>> +  [2]: https://wiki.st.com/stm32mpu/wiki/STM32MP15_RAM_mapping
>> +
>> +allOf:
>> + - $ref: /schemas/simple-bus.yaml#
>> +
>> +properties:
>> +  compatible:
>> +    contains:
>> +      enum:
>> +        - st,mlahb
>> +
>> +  dma-ranges:
>> +    description: |
>> +      Describe memory addresses translation between the local CPU and the
>> +      remote Cortex-M processor. Each memory region, is declared with
>> +      3 parameters:
>> +      - param 1: device base address (Cortex-M processor address)
>> +      - param 2: physical base address (local CPU address)
>> +      - param 3: size of the memory region.
>> +    maxItems: 3
>> +
>> +  '#address-cells':
>> +    const: 1
>> +
>> +  '#size-cells':
>> +    const: 1
>> +
>> +required:
>> +  - compatible
>> +  - '#address-cells'
>> +  - '#size-cells'
>> +  - dma-ranges
>> +
>> +examples:
>> +  - |
>> +    mlahb: ahb {
>> +      compatible = "st,mlahb", "simple-bus";
>> +      #address-cells = <1>;
>> +      #size-cells = <1>;
>> +      reg = <0x10000000 0x40000>;
>> +      dma-ranges = <0x00000000 0x38000000 0x10000>,
>> +                   <0x10000000 0x10000000 0x60000>,
>> +                   <0x30000000 0x30000000 0x60000>;
>> +
> 
> Fails to build:
> 
> builds/robherring/linux-dt-review/Documentation/devicetree/bindings/arm/stm32/st,mlahb.example.dt.yaml: 
> ahb: 'ranges' is a required property
> 
> Run 'make dt_binding_check'

Yes, that why i posted in parallel the PR on the tool:
https://github.com/devicetree-org/dt-schema/pull/30. 

I don't know if you saw my answer on this post so i copy/paste  it here:

How to describe the stm32mp1 coprocessor mapping and translations based on this "ranges" requirement?

On stm32mp1 we have 2 RAM memories accessible by the Cortex-A7 running Linux and used by the Cortex-M4 coprocessor to run its code. Each Cortex has a specific mapping of the memories. Some memory translations are needed by:

- rproc driver to load the Cortex-M4 firmware in RAMs
- rpmsg & virtio frameworks for shared memory

Here is the memory mapping:

- RETRAM (64 kB);
  - Cortex-A7 @ : 0x38000000
  - Cortex-M4 @: 0x00000000
- MCUSRAM (up to 384 kB)
  - Cortex-A7 @ : 0x30000000 or 0x10000000 ( 2 addresses for the same memory)
  - Cortex-M4 @: 0x30000000 or 0x10000000 ( 2 addresses for the same memory)
  =>addresses used on both side depend on the MCURAM access optimization

Today our upstreamed solution is based on dma-range only (https://lkml.org/lkml/2019/4/3/1261)

What about adding an "unused" ranges property in DT to match the requirement?

	mlahb {
		compatible = "simple-bus";
		#address-cells = <1>;
		#size-cells = <1>;
		ranges = <0 0x38000000 0x10000>,
			       <1 0x10000000 0x60000>,
			       <2 0x30000000 0x60000>;
		dma-ranges = <0x00000000 0x38000000 0x10000>,
			     <0x10000000 0x10000000 0x60000>,
			     <0x30000000 0x30000000 0x60000>;

		m4_rproc: m4@10000000 {
		        ---
		};
	};

Thanks in advance for your feedback.
Regards,
Arnaud

> 
>> +      m4_rproc: m4@10000000 {
>> +       reg = <0x10000000 0x40000>;
>> +      };
>> +    };
>> +
>> +...
>> -- 
>> 2.17.1
>>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-12-16  8:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-28 15:46 [PATCH] dt-bindings: stm32: convert mlahb to json-schema Arnaud Pouliquen
2019-11-28 15:46 ` Arnaud Pouliquen
2019-12-13 21:39 ` Rob Herring
2019-12-13 21:39   ` Rob Herring
2019-12-16  8:44   ` Arnaud POULIQUEN [this message]
2019-12-16  8:44     ` Arnaud POULIQUEN
2019-12-16 17:10     ` Rob Herring
2019-12-16 17:10       ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7ac83aa6-0ec6-db4f-556d-a17c28d2bcab@st.com \
    --to=arnaud.pouliquen@st.com \
    --cc=alexandre.torgue@st.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=fabien.dessenne@st.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mark.rutland@arm.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.