2018-07-26 06:55:46

by Oleksij Rempel

[permalink] [raw]
Subject: [PATCH v7 1/6] dt-bindings: mailbox: allow mbox-cells to be equal to 0

From: Dong Aisheng <[email protected]>

Mailbox devices may have only one channel which means the mbox-cells
at least 1 does not make sense for this type devices. Let's remove
that limitation to allow the mbox-cells to be equal to 0.

Cc: Mark Rutland <[email protected]>
Cc: Sudeep Holla <[email protected]>
Cc: [email protected]
Cc: [email protected]
Reviewed-by: Rob Herring <[email protected]>
Signed-off-by: Dong Aisheng <[email protected]>
---
Documentation/devicetree/bindings/mailbox/mailbox.txt | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/mailbox/mailbox.txt b/Documentation/devicetree/bindings/mailbox/mailbox.txt
index af8ecee2ac68..c2fcd054141a 100644
--- a/Documentation/devicetree/bindings/mailbox/mailbox.txt
+++ b/Documentation/devicetree/bindings/mailbox/mailbox.txt
@@ -6,8 +6,7 @@ assign appropriate mailbox channel to client drivers.
* Mailbox Controller

Required property:
-- #mbox-cells: Must be at least 1. Number of cells in a mailbox
- specifier.
+- #mbox-cells: Number of cells in a mailbox specifier.

Example:
mailbox: mailbox {
--
2.18.0



2018-07-26 09:43:07

by Jassi Brar

[permalink] [raw]
Subject: Re: [PATCH v7 1/6] dt-bindings: mailbox: allow mbox-cells to be equal to 0

On Thu, Jul 26, 2018 at 12:23 PM, Oleksij Rempel
<[email protected]> wrote:
> From: Dong Aisheng <[email protected]>
>
> Mailbox devices may have only one channel which means the mbox-cells
> at least 1 does not make sense for this type devices. Let's remove
> that limitation to allow the mbox-cells to be equal to 0.
>
OK

But please realise that you'll have to write more code -- implement
your own of_xlate() callback.
Most developers would prefer to call the only channel as channel
number 0, and use the common of_xlate implementation.

-jassi

2018-07-26 11:01:40

by Aisheng Dong

[permalink] [raw]
Subject: RE: [PATCH v7 1/6] dt-bindings: mailbox: allow mbox-cells to be equal to 0

> -----Original Message-----
> From: Jassi Brar [mailto:[email protected]]
> Sent: Thursday, July 26, 2018 5:42 PM
> To: Oleksij Rempel <[email protected]>
> Cc: Shawn Guo <[email protected]>; Fabio Estevam
> <[email protected]>; Rob Herring <[email protected]>; Mark
> Rutland <[email protected]>; A.s. Dong <[email protected]>;
> Vladimir Zapolskiy <[email protected]>; Sudeep Holla
> <[email protected]>; Devicetree List <[email protected]>;
> Linux Kernel Mailing List <[email protected]>; , Sascha Hauer
> <[email protected]>; , [email protected], linux-
> [email protected], srv_heupstream <linux-arm-
> [email protected]>; dl-linux-imx <[email protected]>
> Subject: Re: [PATCH v7 1/6] dt-bindings: mailbox: allow mbox-cells to be
> equal to 0
>
> On Thu, Jul 26, 2018 at 12:23 PM, Oleksij Rempel <[email protected]>
> wrote:
> > From: Dong Aisheng <[email protected]>
> >
> > Mailbox devices may have only one channel which means the mbox-cells
> > at least 1 does not make sense for this type devices. Let's remove
> > that limitation to allow the mbox-cells to be equal to 0.
> >
> OK
>
> But please realise that you'll have to write more code -- implement your own
> of_xlate() callback.
> Most developers would prefer to call the only channel as channel number 0,
> and use the common of_xlate implementation.
>

Yes, that's true because the common of_xlate assuming the mbox-cells is 1.
And there's already such users:
arch/arm/boot/dts/bcm283x.dtsi

More comments will be on your reply of patch-3.

Regards
Dong Aisheng

> -jassi

2018-07-26 11:38:49

by Jassi Brar

[permalink] [raw]
Subject: Re: [PATCH v7 1/6] dt-bindings: mailbox: allow mbox-cells to be equal to 0

On Thu, Jul 26, 2018 at 4:30 PM, A.s. Dong <[email protected]> wrote:
>> -----Original Message-----
>> From: Jassi Brar [mailto:[email protected]]
>> Sent: Thursday, July 26, 2018 5:42 PM
>> To: Oleksij Rempel <[email protected]>
>> Cc: Shawn Guo <[email protected]>; Fabio Estevam
>> <[email protected]>; Rob Herring <[email protected]>; Mark
>> Rutland <[email protected]>; A.s. Dong <[email protected]>;
>> Vladimir Zapolskiy <[email protected]>; Sudeep Holla
>> <[email protected]>; Devicetree List <[email protected]>;
>> Linux Kernel Mailing List <[email protected]>; , Sascha Hauer
>> <[email protected]>; , [email protected], linux-
>> [email protected], srv_heupstream <linux-arm-
>> [email protected]>; dl-linux-imx <[email protected]>
>> Subject: Re: [PATCH v7 1/6] dt-bindings: mailbox: allow mbox-cells to be
>> equal to 0
>>
>> On Thu, Jul 26, 2018 at 12:23 PM, Oleksij Rempel <[email protected]>
>> wrote:
>> > From: Dong Aisheng <[email protected]>
>> >
>> > Mailbox devices may have only one channel which means the mbox-cells
>> > at least 1 does not make sense for this type devices. Let's remove
>> > that limitation to allow the mbox-cells to be equal to 0.
>> >
>> OK
>>
>> But please realise that you'll have to write more code -- implement your own
>> of_xlate() callback.
>> Most developers would prefer to call the only channel as channel number 0,
>> and use the common of_xlate implementation.
>>
>
> Yes, that's true because the common of_xlate assuming the mbox-cells is 1.
> And there's already such users:
> arch/arm/boot/dts/bcm283x.dtsi
>
You mean that is a good thing, right?

2018-07-26 11:56:17

by Aisheng Dong

[permalink] [raw]
Subject: RE: [PATCH v7 1/6] dt-bindings: mailbox: allow mbox-cells to be equal to 0

> -----Original Message-----
> From: Jassi Brar [mailto:[email protected]]
> Sent: Thursday, July 26, 2018 7:37 PM
> To: A.s. Dong <[email protected]>
> Cc: Oleksij Rempel <[email protected]>; Shawn Guo
> <[email protected]>; Fabio Estevam <[email protected]>; Rob
> Herring <[email protected]>; Mark Rutland <[email protected]>;
> Vladimir Zapolskiy <[email protected]>; Sudeep Holla
> <[email protected]>; Devicetree List <[email protected]>;
> Linux Kernel Mailing List <[email protected]>; , Sascha Hauer
> <[email protected]>; , [email protected], linux-
> [email protected], srv_heupstream <linux-arm-
> [email protected]>; dl-linux-imx <[email protected]>
> Subject: Re: [PATCH v7 1/6] dt-bindings: mailbox: allow mbox-cells to be
> equal to 0
>
> On Thu, Jul 26, 2018 at 4:30 PM, A.s. Dong <[email protected]> wrote:
> >> -----Original Message-----
> >> From: Jassi Brar [mailto:[email protected]]
> >> Sent: Thursday, July 26, 2018 5:42 PM
> >> To: Oleksij Rempel <[email protected]>
> >> Cc: Shawn Guo <[email protected]>; Fabio Estevam
> >> <[email protected]>; Rob Herring <[email protected]>; Mark
> >> Rutland <[email protected]>; A.s. Dong <[email protected]>;
> >> Vladimir Zapolskiy <[email protected]>; Sudeep Holla
> >> <[email protected]>; Devicetree List <[email protected]>;
> >> Linux Kernel Mailing List <[email protected]>; , Sascha
> >> Hauer <[email protected]>; ,
> >> [email protected], linux-
> >> [email protected], srv_heupstream <linux-arm-
> >> [email protected]>; dl-linux-imx <[email protected]>
> >> Subject: Re: [PATCH v7 1/6] dt-bindings: mailbox: allow mbox-cells to
> >> be equal to 0
> >>
> >> On Thu, Jul 26, 2018 at 12:23 PM, Oleksij Rempel
> >> <[email protected]>
> >> wrote:
> >> > From: Dong Aisheng <[email protected]>
> >> >
> >> > Mailbox devices may have only one channel which means the
> >> > mbox-cells at least 1 does not make sense for this type devices.
> >> > Let's remove that limitation to allow the mbox-cells to be equal to 0.
> >> >
> >> OK
> >>
> >> But please realise that you'll have to write more code -- implement
> >> your own
> >> of_xlate() callback.
> >> Most developers would prefer to call the only channel as channel
> >> number 0, and use the common of_xlate implementation.
> >>
> >
> > Yes, that's true because the common of_xlate assuming the mbox-cells is 1.
> > And there's already such users:
> > arch/arm/boot/dts/bcm283x.dtsi
> >
> You mean that is a good thing, right?

No, I mean there's similar HW in kernel already that only has one channel.
Are you suggesting even for one channel mailbox, we should still use
Mbox-cells 1 and use 'mboxes = <&mailbox 0>' in devicetree?

Regards
Dong Aisheng

2018-07-26 12:05:42

by Jassi Brar

[permalink] [raw]
Subject: Re: [PATCH v7 1/6] dt-bindings: mailbox: allow mbox-cells to be equal to 0

On Thu, Jul 26, 2018 at 5:25 PM, A.s. Dong <[email protected]> wrote:
>> -----Original Message-----
>> From: Jassi Brar [mailto:[email protected]]
>> Sent: Thursday, July 26, 2018 7:37 PM
>> To: A.s. Dong <[email protected]>
>> Cc: Oleksij Rempel <[email protected]>; Shawn Guo
>> <[email protected]>; Fabio Estevam <[email protected]>; Rob
>> Herring <[email protected]>; Mark Rutland <[email protected]>;
>> Vladimir Zapolskiy <[email protected]>; Sudeep Holla
>> <[email protected]>; Devicetree List <[email protected]>;
>> Linux Kernel Mailing List <[email protected]>; , Sascha Hauer
>> <[email protected]>; , [email protected], linux-
>> [email protected], srv_heupstream <linux-arm-
>> [email protected]>; dl-linux-imx <[email protected]>
>> Subject: Re: [PATCH v7 1/6] dt-bindings: mailbox: allow mbox-cells to be
>> equal to 0
>>
>> On Thu, Jul 26, 2018 at 4:30 PM, A.s. Dong <[email protected]> wrote:
>> >> -----Original Message-----
>> >> From: Jassi Brar [mailto:[email protected]]
>> >> Sent: Thursday, July 26, 2018 5:42 PM
>> >> To: Oleksij Rempel <[email protected]>
>> >> Cc: Shawn Guo <[email protected]>; Fabio Estevam
>> >> <[email protected]>; Rob Herring <[email protected]>; Mark
>> >> Rutland <[email protected]>; A.s. Dong <[email protected]>;
>> >> Vladimir Zapolskiy <[email protected]>; Sudeep Holla
>> >> <[email protected]>; Devicetree List <[email protected]>;
>> >> Linux Kernel Mailing List <[email protected]>; , Sascha
>> >> Hauer <[email protected]>; ,
>> >> [email protected], linux-
>> >> [email protected], srv_heupstream <linux-arm-
>> >> [email protected]>; dl-linux-imx <[email protected]>
>> >> Subject: Re: [PATCH v7 1/6] dt-bindings: mailbox: allow mbox-cells to
>> >> be equal to 0
>> >>
>> >> On Thu, Jul 26, 2018 at 12:23 PM, Oleksij Rempel
>> >> <[email protected]>
>> >> wrote:
>> >> > From: Dong Aisheng <[email protected]>
>> >> >
>> >> > Mailbox devices may have only one channel which means the
>> >> > mbox-cells at least 1 does not make sense for this type devices.
>> >> > Let's remove that limitation to allow the mbox-cells to be equal to 0.
>> >> >
>> >> OK
>> >>
>> >> But please realise that you'll have to write more code -- implement
>> >> your own
>> >> of_xlate() callback.
>> >> Most developers would prefer to call the only channel as channel
>> >> number 0, and use the common of_xlate implementation.
>> >>
>> >
>> > Yes, that's true because the common of_xlate assuming the mbox-cells is 1.
>> > And there's already such users:
>> > arch/arm/boot/dts/bcm283x.dtsi
>> >
>> You mean that is a good thing, right?
>
> No, I mean there's similar HW in kernel already that only has one channel.
> Are you suggesting even for one channel mailbox, we should still use
> Mbox-cells 1 and use 'mboxes = <&mailbox 0>' in devicetree?
>
As i said, I am ok with the mbox-cells to be 0.

But if you have two instances of the controller, one with 4 channels
and the other with 1 channel. Then you can/should not have different
bindings.

And, if the controller can have only 1 channel, then please feel free
to have mbox-cells=0 and implement your own of_xlate().