lkml.org 
[lkml]   [2014]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] pinctrl: bcm2835: Start GPIO numeration at zero
On 10/27/2014 05:05 PM, Matthias Klein wrote:
>
> Am 27.10.2014 um 23:44 schrieb Stephen Warren:
>> On 10/27/2014 04:09 PM, Matthias Klein wrote:
>>> Numerate the GPIOs from 0..53 instead of 202..255.
>>
>> What's the motivation for this? The GPIO IDs should all come from DT,
>> which encodes everything as an ID relative to a particular
>> controllers, and hence the actual value of the base address should be
>> irrelevant.
>
> - To be in sync with the GPIO numbers in the datasheet / documentation

I assume that's only relevant because of the second point; the GPIO IDs
in DT files already match the datasheet.

> - For userland applications which rely on these GPIO numbers

This isn't a scalable solution for that; this "fix" can only work for a
single GPIO controller in any one system. It'd be better for all usage
to search for the correct GPIO controller in sysfs, find the base
address of that, and then add on the controller-relative GPIO ID. That
way, the same approach is taken irrespective of which GPIO controller is
in use, and there are no special cases.

Perhaps this could be simplified (removing the need to adding
base+offset to get the Linux ID) if the GPIO core exported a
per-controller directory in sysfs for GPIO manipulation (the files in
which used controller-relative numbering), rather than having a single
directory using Linux-internal global GPIO numbering; something like
/sys/class/gpio/gpio@7e200000/export which uses ID 0..N vs.
/sys/class/gpio/export which uses IDs X..X+N where X is arbitary.


\
 
 \ /
  Last update: 2014-10-28 01:21    [W:0.250 / U:0.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site