Re: [PATCHv10 4/4] dt: mailbox: add generic bindings
From: Mark Brown
Date: Mon Aug 04 2014 - 10:41:26 EST
On Sat, Aug 02, 2014 at 01:17:18PM +0530, Jassi Brar wrote:
> On 2 August 2014 00:13, Mark Brown <broonie@xxxxxxxxxx> wrote:
> > On Fri, Aug 01, 2014 at 06:02:45PM +0530, Jassi Brar wrote:
> > Can I suggest that if we do want to avoid strings for some reason (it's
> > not obvious to me why)
> The string and index are both to be taken from DT node of client.
> pwr_cntrl: power {
> ...
> mbox-names = "pwr-ctrl", "rpc";
> mboxes = <&mailbox 0
> &mailbox 1>;
> };
> The xlate() will map string onto index. So rather than the client
> driver specify, say, "rpc" while requesting mailbox channel, it can
> directly specify index 1.
The whole point with specifying an array of names as well as the array
of mboxes is that you don't then need to do that in the driver code, it
provides a layer of indirection between the array indexes and the
identification of the resources. This improves the legibility of the
driver (since you're asking for things by name rather than random
number) and DT (since there's a bit less of counting through potentially
long lists and making sure you edit the right entry. It also makes life
easier if a future version of the binding allows one of the existing
mailboxes to be omitted since you don't need to have blank entries.
> > then we include a recommendation to provide
> > defines in a header file in order to improve legibility. That's pretty
> > minor, though.
> Sorry I don't understand.
If there's defines in the DT header files (which would hopefully go
along with the bindings in some future where we actually split the
bindings out) then the driver can use those names rather than having
numbers in it.
While I think about it it would be good to be able to encourage people
to have things like <&mailbox 0> being able to be written as <&mailbox
NAME>.
Attachment:
signature.asc
Description: Digital signature