Re: [PATCH v2 01/14] Documentation: dt/bindings: Document pinctrl-ingenic
From: Linus Walleij
Date: Tue Jan 31 2017 - 07:59:49 EST
On Fri, Jan 27, 2017 at 4:27 PM, Paul Cercueil <paul@xxxxxxxxxxxxxxx> wrote:
>> In the former case, if this pertains to the *inside* of the SoC:
>> is it just different between jz4740 and jz4780?
>> In that case, just code this into the driver as .data to the .compatible
>> in the DT match. No special DT properties needed.
> Well, I've been taught that devicetree is for describing the hardware, and
> the driver code is for functionality. So that's why I put it in devicetree.
This is a gray area.
But as GPIO maintainer I'm not happy about encoding information
about the hardware, that can be deducted from the compatible-string,
into the devicetree.
I prefer to encode per-compatible hardware information tables into
the driver, as structs, and pick the right table based on the compatible
string as .data in the of match entry.
It's simple to retrieve into the driver using of_device_get_match_data()
> That's also the reason why I put the list of functions and groups in
> devicetree and not in the driver code.
I'm not super-happy about that either, and it's not the way I would
have done it but the argument has been made
that it is a lot of opaque data and people prefer to maintain it
in the device tree.
I accept it for functions and groups, but I don't like it.
I will not fold to any consistency arguments of the type "now
you allowed this one thing, so you must allow this other thing
so you are consistent", just no. I didn't like it the first time, so I'm
not liking it anymore the second time.
I guess if the DT people tell me it has to be done this way I would
accept it. After a lot of discussion. But noone has.
Please make it a table and put it in the driver instead.