2010/2/20 Uwe Kleine-König <span dir="ltr"><<a href="mailto:u.kleine-koenig@pengutronix.de" target="_blank">u.kleine-koenig@pengutronix.de</a>></span><div class="im"><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hey Kevin,<br>
<div><br>
> +/*<br>
> + * Note!<br>
> + * Muxed GP pins need to be setup to the GP state in the board level<br>
> + * code prior to using this driver.<br>
</div>This is done by the imx machines, too, and I wonder if it's worth to try<br>
to get rid of that or at least let the gpio_direction_... functions fail<br>
if the pin isn't muxed as gpio. Thoughts?<br>
<br></blockquote></div><div>HI Uwe,<br><br>In the current function of the driver, the assumption is that if an out pin<br>
is used, it has already been muxed correctly, so requesting an output<br>
for a pin not muxed as a GPI/O will work fine and even setting it's pin<br>
level will work, but the level won't appear on the external pin. If<br>something decides to switch the mux after that state is programmed,<br>then the currently programmed output level will show up on that pin.<br><br>
For state muxing, I would prefer to not have the GPIO driver change an<br>existing mux state to make a GPIO work. I don't return an error now<br>when a output state is used and is not muxed for an output state. But<br>
its painless to add this.<br><br>GPI pins and GPIO pins configured as inputs always work regardless<br>of the muxed pin state and would never need to have a fail check, its<br>basically a raw pin state read.<br><br></div>
<div class="im">
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I didn't check the alternative functionalities for the gpios on lpc32xx,<br>
but what happens if any gpio is requested and the direction configured?<br>
Does it interfer with system functions? (E.g. if a pin is used in a<br>
dedicated say i2c function, does it make the i2c driver non-functional<br>
if I do gpio_direction_output(i2cpin, 1)?)<br>
<br>
</blockquote></div><div><br>Setting a GPIO direction or output state will not effect a peripheral pin<br>(on this part) when muxed for the peripheral. (ie, setting a GPIO to output<br>and switching it to low when its shared with a UART pin and the mux is<br>
setup for UART).<br><br>thanks,<br>Kevin<br><br></div>Best regards<br>
Uwe<br>
<font color="#888888"><br>
--<br>
Pengutronix e.K. | Uwe Kleine-König |<br>
Industrial Linux Solutions | <a href="http://www.pengutronix.de/" target="_blank">http://www.pengutronix.de/</a> |</font>