RE: [PATCH v2 2/7] dt-bindings: pinctrl: Add RZ/A1 bindings doc
From: Chris Brandt
Date: Wed Mar 29 2017 - 10:10:12 EST
On Wednesday, March 29, 2017, Linus Walleij:
> If you prefer to use preprocessor macros or whatever to make the bitmasks
> or how you want to organize the constants in your include files is not my
> concern, do whatever you seem fit, just pack it into a 32bit thing somehow
> which makes sense from a maintenance point of view.
OK, I think everyone agrees that a single 32-bit value is fine because macros
will also for good readability and maintenance.
> >> Not only because it will save use from having a loong list(*) of
> >> macros that has to be kept up to date when/if new RZ hardware will
> >> arrive, but also because of readability and simplicity for down-stream
> and BSP users.
> >> Speaking of which, I would like to know what does Chris think of this.
> >
> > The list of macros would be very long, especially against the
> > different packaging version of the RZ/A1 series. 11 ports, 16-pins for
> > each port, 8 different function options for each pin....2 different
> package/pin variations.
> >
> > And at the end of the day....there is no benefit for the user over
> > just using a macro.
>
> I don't know who has this idea that you could not use macros, certainly
> not me. Some misunderstanding must be going on. For what I'm concerned you
> can write hex numbers in the pinmux = <0x12345678>;
>
> > The reason for the "FLAGS" is to work around a quirky hardware design
> (in my opinion).
>
> The flags I don't like at all, and think they should be converted to
> generic pin config because they have nothing to do with muxing.
>
> But I will point that out in the specific patch adding them.
OK, I think I understand your issue a little better of mixing user-defined config
with generic pinmux.
From our perspective, the FLAGS (BI_DIR, SWIO_IN, and SWIO_OUT ) were not really
optional when selecting what you want the pin to do....so we considered it part
of the pin-mux.
In the hardware manual, there are tables that say that for 'some' certain
pins/functions "just setting the pin to a function is not enough...you need to make
another register setting (that may or may not make sense), otherwise it's not going
to work".
So, trying to get the driver to be that smart across all the different pin/package
variations seems to be way too ugly (and a maintenance nightmare). Simply putting
that in the DT binding was much more cleaner.
As for how to pass this HW info into the driver, I'll move over to the other email
thread where you started to give some suggestions...
Chris