Re: [PATCH] powerpc: mpc8xxx_gpio: Add ability to mask off unused GPIO pins
From: Anton Vorontsov <hidden>
Date: 2009-12-08 02:16:38
Also in:
linux-devicetree
On Mon, Dec 07, 2009 at 10:23:18AM -0600, Peter Tyser wrote: [...]
quoted
Yes, badly designed hardware deserves ugly hacks in the platform code. ;-) So for this problem, just request these gpios in the platform code.I'd wager lots of boards have GPIO pins that a user shouldn't play around with once Linux boots up. Like GPIO pins used to program an FPGA,
What if I do want to program/upgrade an FPGA, say from the userspace? [...]
In any case, my high-level thought process is: 1. Currently, the "ngpio" value is wrong for some processors and should be fixed. 2. Adding a new "fsl,gpio-mask" gpio solves #1, and has the benefit of allowing the device tree to easily reserve GPIO pins which should not be used in Linux.
OK, if you're so eager to fix this... I'd suggest to not put this
stuff into device tree. We have compatible property that describes
the device.
So, in the driver, you can just do
if (of_device_is_compatible("fsl,foo-gpiochip"))
mask = ...;
else if (of_device_is_compatible("fsl,bar-gpiochip"))
mask = ...;
If you want to solve "dangerous" GPIOs problem, then I'd say
chosen {
linux,dangerous-gpios = <&pio1 0 0 &pio1 1 0
&pio2 4 0 &pio1 5 0>;
};
And then you can have a generic driver that looks for
linux,dangerous-gpios and requests them at boot.
Thanks,
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2