GPIO - marking individual pins (not) available in device tree

Matt Sealey matt at genesi-usa.com
Wed Oct 29 06:46:38 EST 2008



Grant Likely wrote:

> At this level, the 'compatible = "gpio-group";' is completely
> irrelevant.  The binding for "crystalfontz,something-gpio" must
> specify that there are two subnodes; one named data-bus and one named
> rw-ctrl.  The driver, which binds against compatible in the parent
> node, would know to go looking for those child nodes and to use the
> gpios property inside them.  Simple.

Point taken.

>>> Does this mean "hard-coding"?
>> No. If you have an array of GPIO pins (gpios property) then how do you
>> determine which is for data and which is some control pin? Do you
>> associate these numbers in the driver somehow? Maybe a matchlist or
>> an array? Given pins A B C D E F G H I J where does the data bus
>> start and the control pins live? A and B? A and J? I and J?
> 
> You know because you document it in the binding.

I think having a working device tree and a seperate binding document
sometimes slows things down. If it is not patently obvious what you
mean from a device tree, in order to write a new driver, the device
tree is not doing it's job..

Where the binding must take it's cue from established documentation,
and follows existing procedures and semantics, the binding is important
(for instance there are a few ways to check an interrupt fired on
MPC5200B, and Linux/dts encodes them per ONE table in the docs, this
must be referenced somewhere at least)

>> It would be definitely frivolous to define a whole device tree binding
>> for the *order in which you MUST specify the gpios for this particular
>> device*. There is obviously an implicit ordering of the GPIOs to make
>> up the data bus (you'd expect an order from MSB to LSB.. or perhaps
>> LSB to MSB... that might be better defined than undefined)
> 
> Why is it frivolous?  We do this all the time for reg and irqs.

See above. Does every driver require a ratified device tree binding
which is collaborated and agreed upon even though it may be in use on
one or two boards which actually may never see the light of day (I
bet none of you will ever see the CPLD core I'm sitting in front of
right now..)

I think it should be obvious both from the tree and inside the driver
what magical little sections of code do without cross-referencing, I
do far too much cross-referencing in Linux as it is, and it's one thing
I'm a little sore to see keep reoccurring, that I have to have 3 windows
open to understand the intent of a 10 line snippet in a driver..

-- 
Matt Sealey <matt at genesi-usa.com>
Genesi, Manager, Developer Relations



More information about the devicetree-discuss mailing list