[PATCH] powerpc: mpc8xxx_gpio: Add ability to mask off unused GPIO pins

Anton Vorontsov avorontsov at ru.mvista.com
Tue Dec 8 13:16:38 EST 2009


On Mon, Dec 07, 2009 at 10:23:18AM -0600, Peter Tyser wrote:
[...]
> > 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 at gmail.com
irc://irc.freenode.net/bd2


More information about the Linuxppc-dev mailing list