From: dirk.behme@de•bosch.com (Dirk Behme)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 2/2] ARM: dts: imx6q: Invert the GPIO controller order
Date: Tue, 31 Jul 2012 10:15:11 +0200 [thread overview]
Message-ID: <5017940F.4070706@de.bosch.com> (raw)
In-Reply-To: <20120730142443.GL6802@n2100.arm.linux.org.uk>
On 30.07.2012 16:24, Russell King - ARM Linux wrote:
> On Mon, Jul 30, 2012 at 09:28:21AM +0200, Thomae Matthias (CM-AI/PJ-CF31) wrote:
>> I care about the global number because it is used to access GPIOs
>> from userspace via the Sysfs interface (see Documentation/gpio.txt).
>> Without the 2 patches, the GPIOs are mapped this way:
>>
>> gpiochip_add: registered GPIOs 224 to 255 on device: 209c000.gpio
>> gpiochip_add: registered GPIOs 192 to 223 on device: 20a0000.gpio
>> gpiochip_add: registered GPIOs 160 to 191 on device: 20a4000.gpio
>> gpiochip_add: registered GPIOs 128 to 159 on device: 20a8000.gpio
>> gpiochip_add: registered GPIOs 96 to 127 on device: 20ac000.gpio
>> gpiochip_add: registered GPIOs 64 to 95 on device: 20b0000.gpio
>> gpiochip_add: registered GPIOs 32 to 63 on device: 20b4000.gpio
>>
>> With the patches, the mapping looks like this:
>>
>> gpiochip_add: registered GPIOs 192 to 223 on device: 20b4000.gpio
>> gpiochip_add: registered GPIOs 160 to 191 on device: 20b0000.gpio
>> gpiochip_add: registered GPIOs 128 to 159 on device: 20ac000.gpio
>> gpiochip_add: registered GPIOs 96 to 127 on device: 20a8000.gpio
>> gpiochip_add: registered GPIOs 64 to 95 on device: 20a4000.gpio
>> gpiochip_add: registered GPIOs 32 to 63 on device: 20a0000.gpio
>> gpiochip_add: registered GPIOs 0 to 31 on device: 209c000.gpio
>>
>> I.e. pin 0 on gpio1 is now accessed via /sys/class/gpio/gpio0
>> instead of /sys/class/gpio/gpio224.
>
> I think you're caring too much about the numbers you see within the Linux
> kernel...
>
> So what happens when your platform is built as part of a single zImage
> along side a platform needing all the 256 GPIOs? If the answer is "it
> doesn't work" you need to go back and re-evaluate what you're doing.
>
> Especially with DT, you shouldn't need to worry about the absolute GPIO
> numbering.
Ok, thanks! If the patches we sent are not the way to go, maybe we need
a better understanding then. Trying to learn something, I'd like to ask:
From my understanding, a user in the _user_ space expects a 1:1 mapping:
user touching /sys/class/gpio/gpio0 -> controls HW GPIO bank 1 pin 0
...
user touching /sys/class/gpio/gpio31 -> controls HW GPIO bank 1 pin 31
...
user touching /sys/class/gpio/gpio223 -> controls HW GPIO bank 7 pin 31
Is this understanding wrong? Or is there a way to achieve this with the
existing DT logic?
The above is what we tried to achieve with our patches. Without the
patches, an unmodified DT and kernel gives us:
user touching /sys/class/gpio/gpio0 -> n/a (*)
...
user touching /sys/class/gpio/gpio32 -> controls HW GPIO bank 7 pin 0
...
user touching /sys/class/gpio/gpio224 -> controls HW GPIO bank 1 pin 0
...
user touching /sys/class/gpio/gpio255 -> controls HW GPIO bank 1 pin 31
(*) Note the offset of 32 due to ARCH_NR_GPIO is 256 while only 224
GPIOs are there. And the 'inverted' access order from bank 7 to 1.
Many thanks for the help and best regards
Dirk
next prev parent reply other threads:[~2012-07-31 8:15 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-25 12:37 [PATCH 1/2] ARM: i.MX6: set ARCH_NR_GPIO to 244 Dirk Behme
2012-07-25 12:37 ` [PATCH 2/2] ARM: dts: imx6q: Invert the GPIO controller order Dirk Behme
2012-07-28 13:41 ` Shawn Guo
2012-07-30 7:28 ` Thomae Matthias (CM-AI/PJ-CF31)
2012-07-30 9:01 ` Shawn Guo
2012-07-30 14:24 ` Russell King - ARM Linux
2012-07-31 8:15 ` Dirk Behme [this message]
2012-07-25 14:12 ` [PATCH 1/2] ARM: i.MX6: set ARCH_NR_GPIO to 244 Fabio Estevam
2012-07-25 14:51 ` Dirk Behme
2012-07-28 13:32 ` Shawn Guo
2012-07-29 16:18 ` Dirk Behme
2012-07-30 1:14 ` Shawn Guo
2012-07-30 6:40 ` Dirk Behme
2012-07-30 8:46 ` Shawn Guo
2012-07-30 11:14 ` Dirk Behme
2012-07-30 14:29 ` Russell King - ARM Linux
2012-07-31 1:16 ` Shawn Guo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5017940F.4070706@de.bosch.com \
--to=dirk.behme@de$(echo .)bosch.com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox