[PATCH 2/3] dt-bindings: mailbox: starfive: Add StarFive Meu Mailbox Driver

Joshua Yeong posted 3 patches 2 years ago
[PATCH 2/3] dt-bindings: mailbox: starfive: Add StarFive Meu Mailbox Driver
Posted by Joshua Yeong 2 years ago
The StarFive Meu Mailbox allow communication between AP and SCP cores
through mailbox doorbell.

Co-developed-by: Sia Jee Heng <jeeheng.sia@starfivetech.com>
Signed-off-by: Sia Jee Heng <jeeheng.sia@starfivetech.com>
Signed-off-by: Joshua Yeong <joshua.yeong@starfivetech.com>
Reviewed-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
---
 .../bindings/mailbox/starfive-meu.yaml        | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mailbox/starfive-meu.yaml

diff --git a/Documentation/devicetree/bindings/mailbox/starfive-meu.yaml b/Documentation/devicetree/bindings/mailbox/starfive-meu.yaml
new file mode 100644
index 000000000000..dbc5cfdb90ff
--- /dev/null
+++ b/Documentation/devicetree/bindings/mailbox/starfive-meu.yaml
@@ -0,0 +1,66 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mailbox/starfive-meu.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: StarFive MEU Mailbox Controller
+
+maintainers:
+  - Jee Heng Sia <jeeheng.sia@starfivetech.com>
+  - Joshua Yeong <joshua.yeong@starfivetech.com>
+
+description: |
+  StarFive's Message-Exchange-Unit (MEU) is a mailbox controller that has 62
+  independent doorbells. Each MEU channel consist of 31 doorbells and consist of
+  a pair of Tx/Rx links that shall communicates with remote processor. The
+  sender set the bit in the SET register to indicate data readiness for the
+  receiver. An interrupt will be raised whenever receiving notification doorbell
+  from remote processor. The receiver will clear the bit in the CLR register
+  upon handling the doorbell notification. The sender should poll the STAT
+  register before starting any transaction to ensure all on-going doorbells are
+  processed.
+
+properties:
+  compatible:
+    enum:
+      - starfive,jh8100-meu
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    items:
+      - description: mailbox0
+      - description: mailbox1
+
+  '#mbox-cells':
+    description: represents index of the mailbox/doorbell paired channel
+      channel  0 - 30 for mailbox0 doorbell
+      channel 31 - 61 for mailbox1 doorbell
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - '#mbox-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    soc {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        meu: mailbox@1f370000 {
+            compatible = "starfive,jh8100-meu";
+            reg = <0x0 0x1f370000 0 0x8000>;
+            interrupts = <170>, /* Mailbox0 */
+                         <171>; /* Mailbox1 */
+            #mbox-cells = <1>;
+        };
+    };
+
+...
-- 
2.25.1
Re: [PATCH 2/3] dt-bindings: mailbox: starfive: Add StarFive Meu Mailbox Driver
Posted by Conor Dooley 2 years ago
On Mon, Dec 18, 2023 at 02:12:00PM +0800, Joshua Yeong wrote:
> The StarFive Meu Mailbox allow communication between AP and SCP cores
> through mailbox doorbell.
> 
> Co-developed-by: Sia Jee Heng <jeeheng.sia@starfivetech.com>
> Signed-off-by: Sia Jee Heng <jeeheng.sia@starfivetech.com>
> Signed-off-by: Joshua Yeong <joshua.yeong@starfivetech.com>
> Reviewed-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
> ---
>  .../bindings/mailbox/starfive-meu.yaml        | 66 +++++++++++++++++++
>  1 file changed, 66 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mailbox/starfive-meu.yaml
> 
> diff --git a/Documentation/devicetree/bindings/mailbox/starfive-meu.yaml b/Documentation/devicetree/bindings/mailbox/starfive-meu.yaml
> new file mode 100644
> index 000000000000..dbc5cfdb90ff
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mailbox/starfive-meu.yaml
> @@ -0,0 +1,66 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/mailbox/starfive-meu.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: StarFive MEU Mailbox Controller
> +
> +maintainers:
> +  - Jee Heng Sia <jeeheng.sia@starfivetech.com>
> +  - Joshua Yeong <joshua.yeong@starfivetech.com>
> +
> +description: |
> +  StarFive's Message-Exchange-Unit (MEU) is a mailbox controller that has 62
> +  independent doorbells. Each MEU channel consist of 31 doorbells and consist of
> +  a pair of Tx/Rx links that shall communicates with remote processor. The
> +  sender set the bit in the SET register to indicate data readiness for the
> +  receiver. An interrupt will be raised whenever receiving notification doorbell
> +  from remote processor. The receiver will clear the bit in the CLR register
> +  upon handling the doorbell notification. The sender should poll the STAT
> +  register before starting any transaction to ensure all on-going doorbells are
> +  processed.

What is/are the consumer(s) of this mailbox?
Is part of your RPMI implementation?

Cheers,
Conor.

> +
> +properties:
> +  compatible:
> +    enum:
> +      - starfive,jh8100-meu
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    items:
> +      - description: mailbox0
> +      - description: mailbox1
> +
> +  '#mbox-cells':
> +    description: represents index of the mailbox/doorbell paired channel
> +      channel  0 - 30 for mailbox0 doorbell
> +      channel 31 - 61 for mailbox1 doorbell
> +    const: 1
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - '#mbox-cells'
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    soc {
> +        #address-cells = <2>;
> +        #size-cells = <2>;
> +
> +        meu: mailbox@1f370000 {
> +            compatible = "starfive,jh8100-meu";
> +            reg = <0x0 0x1f370000 0 0x8000>;
> +            interrupts = <170>, /* Mailbox0 */
> +                         <171>; /* Mailbox1 */
> +            #mbox-cells = <1>;
> +        };
> +    };
> +
> +...
> -- 
> 2.25.1
> 
Re: [PATCH 2/3] dt-bindings: mailbox: starfive: Add StarFive Meu Mailbox Driver
Posted by Joshua Yeong 2 years ago
On 18/12/2023 7:17 PM, Conor Dooley wrote:
> On Mon, Dec 18, 2023 at 02:12:00PM +0800, Joshua Yeong wrote:
>> The StarFive Meu Mailbox allow communication between AP and SCP cores
>> through mailbox doorbell.
>>
>> Co-developed-by: Sia Jee Heng <jeeheng.sia@starfivetech.com>
>> Signed-off-by: Sia Jee Heng <jeeheng.sia@starfivetech.com>
>> Signed-off-by: Joshua Yeong <joshua.yeong@starfivetech.com>
>> Reviewed-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
>> ---
>>   .../bindings/mailbox/starfive-meu.yaml        | 66 +++++++++++++++++++
>>   1 file changed, 66 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/mailbox/starfive-meu.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/mailbox/starfive-meu.yaml b/Documentation/devicetree/bindings/mailbox/starfive-meu.yaml
>> new file mode 100644
>> index 000000000000..dbc5cfdb90ff
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/mailbox/starfive-meu.yaml
>> @@ -0,0 +1,66 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/mailbox/starfive-meu.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: StarFive MEU Mailbox Controller
>> +
>> +maintainers:
>> +  - Jee Heng Sia <jeeheng.sia@starfivetech.com>
>> +  - Joshua Yeong <joshua.yeong@starfivetech.com>
>> +
>> +description: |
>> +  StarFive's Message-Exchange-Unit (MEU) is a mailbox controller that has 62
>> +  independent doorbells. Each MEU channel consist of 31 doorbells and consist of
>> +  a pair of Tx/Rx links that shall communicates with remote processor. The
>> +  sender set the bit in the SET register to indicate data readiness for the
>> +  receiver. An interrupt will be raised whenever receiving notification doorbell
>> +  from remote processor. The receiver will clear the bit in the CLR register
>> +  upon handling the doorbell notification. The sender should poll the STAT
>> +  register before starting any transaction to ensure all on-going doorbells are
>> +  processed.
> What is/are the consumer(s) of this mailbox?
> Is part of your RPMI implementation?
>
> Cheers,
> Conor.

Yes, it would be part of StarFive RPMI implementation.

Regards,
Joshua

>
>> +
>> +properties:
>> +  compatible:
>> +    enum:
>> +      - starfive,jh8100-meu
>> +
>> +  reg:
>> +    maxItems: 1
>> +
>> +  interrupts:
>> +    items:
>> +      - description: mailbox0
>> +      - description: mailbox1
>> +
>> +  '#mbox-cells':
>> +    description: represents index of the mailbox/doorbell paired channel
>> +      channel  0 - 30 for mailbox0 doorbell
>> +      channel 31 - 61 for mailbox1 doorbell
>> +    const: 1
>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +  - interrupts
>> +  - '#mbox-cells'
>> +
>> +additionalProperties: false
>> +
>> +examples:
>> +  - |
>> +    soc {
>> +        #address-cells = <2>;
>> +        #size-cells = <2>;
>> +
>> +        meu: mailbox@1f370000 {
>> +            compatible = "starfive,jh8100-meu";
>> +            reg = <0x0 0x1f370000 0 0x8000>;
>> +            interrupts = <170>, /* Mailbox0 */
>> +                         <171>; /* Mailbox1 */
>> +            #mbox-cells = <1>;
>> +        };
>> +    };
>> +
>> +...
>> -- 
>> 2.25.1
>>
Re: [PATCH 2/3] dt-bindings: mailbox: starfive: Add StarFive Meu Mailbox Driver
Posted by Conor Dooley 1 year, 12 months ago
On Tue, Dec 19, 2023 at 01:52:53PM +0800, Joshua Yeong wrote:
> On 18/12/2023 7:17 PM, Conor Dooley wrote:
> > On Mon, Dec 18, 2023 at 02:12:00PM +0800, Joshua Yeong wrote:
> > > The StarFive Meu Mailbox allow communication between AP and SCP cores
> > > through mailbox doorbell.
> > > 
> > > Co-developed-by: Sia Jee Heng <jeeheng.sia@starfivetech.com>
> > > Signed-off-by: Sia Jee Heng <jeeheng.sia@starfivetech.com>
> > > Signed-off-by: Joshua Yeong <joshua.yeong@starfivetech.com>
> > > Reviewed-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
> > > ---
> > >   .../bindings/mailbox/starfive-meu.yaml        | 66 +++++++++++++++++++
> > >   1 file changed, 66 insertions(+)
> > >   create mode 100644 Documentation/devicetree/bindings/mailbox/starfive-meu.yaml
> > > 
> > > diff --git a/Documentation/devicetree/bindings/mailbox/starfive-meu.yaml b/Documentation/devicetree/bindings/mailbox/starfive-meu.yaml
> > > new file mode 100644
> > > index 000000000000..dbc5cfdb90ff
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/mailbox/starfive-meu.yaml
> > > @@ -0,0 +1,66 @@
> > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/mailbox/starfive-meu.yaml#

Filename should match the compatible.

> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: StarFive MEU Mailbox Controller
> > > +
> > > +maintainers:
> > > +  - Jee Heng Sia <jeeheng.sia@starfivetech.com>
> > > +  - Joshua Yeong <joshua.yeong@starfivetech.com>
> > > +
> > > +description: |

This | is not needed, there's no formatting here to preserve.

> > > +  StarFive's Message-Exchange-Unit (MEU) is a mailbox controller that has 62
> > > +  independent doorbells. Each MEU channel consist of 31 doorbells and consist of
> > > +  a pair of Tx/Rx links that shall communicates with remote processor. The
> > > +  sender set the bit in the SET register to indicate data readiness for the
> > > +  receiver. An interrupt will be raised whenever receiving notification doorbell
> > > +  from remote processor. The receiver will clear the bit in the CLR register
> > > +  upon handling the doorbell notification. The sender should poll the STAT
> > > +  register before starting any transaction to ensure all on-going doorbells are
> > > +  processed.
> > What is/are the consumer(s) of this mailbox?
> > Is part of your RPMI implementation?
> > 
> > Cheers,
> > Conor.
> 
> Yes, it would be part of StarFive RPMI implementation.

I see. Seems a bit weird to submit the mailbox provider without a
consumer, since it'll be dead code until a provider arrives, but that's
for the mailbox driver maintainer to decide if he has a problem with.

> 
> Regards,
> Joshua
> 
> > 
> > > +
> > > +properties:
> > > +  compatible:
> > > +    enum:
> > > +      - starfive,jh8100-meu

I would just make this const: starfive,jh8100-meu unless you already
expect your other SoCs to use a different programming model.

> > > +
> > > +  reg:
> > > +    maxItems: 1
> > > +
> > > +  interrupts:
> > > +    items:
> > > +      - description: mailbox0
> > > +      - description: mailbox1
> > > +
> > > +  '#mbox-cells':
> > > +    description: represents index of the mailbox/doorbell paired channel

> > > +      channel  0 - 30 for mailbox0 doorbell
> > > +      channel 31 - 61 for mailbox1 doorbell

I'd probably move this channel to doorbell interrupt mapping into the
main description and leave this as just

'#mbox-cells':
  const: 1

> > > +    const: 1
> > > +
> > > +required:
> > > +  - compatible
> > > +  - reg
> > > +  - interrupts
> > > +  - '#mbox-cells'
> > > +
> > > +additionalProperties: false
> > > +
> > > +examples:
> > > +  - |
> > > +    soc {
> > > +        #address-cells = <2>;
> > > +        #size-cells = <2>;
> > > +
> > > +        meu: mailbox@1f370000 {

Drop the label here, it has no user.

> > > +            compatible = "starfive,jh8100-meu";
> > > +            reg = <0x0 0x1f370000 0 0x8000>;
> > > +            interrupts = <170>, /* Mailbox0 */
> > > +                         <171>; /* Mailbox1 */

I'd also probably drop the comments here, since the binding enforces
this ordering.

Cheers,
Conor.

> > > +            #mbox-cells = <1>;
> > > +        };
> > > +    };
> > > +
> > > +...
> > > -- 
> > > 2.25.1
> > >