Hi Fabio,

On Sunday, September 29, 2013 8:58:09 PM, Fabio Estevam wrote:
> Hi Benoît,
> 
> On Sun, Sep 29, 2013 at 3:50 PM, Benoît Thébaudeau
> <benoit.thebaud...@advansee.com> wrote:
> 
> > Can you test again without any GPIO patch, but with SION set for this pin
> > in the
> > IOMUXC? According to the reference manual, SION not being set in the IOMUXC
> > is
> > the only reason that would prevent PSR from reading the pin level in GPIO
> > output
> > mode.
> 
> Yes, from the feedback from a colleague the SION bit plays a role here:
> 
> "The RM does not describe this clear. The fact should be:
> 
> PSR for input, DR for output.
> PSR can be for output only when SION bit is set (now PSR = DR). "

Yes, that's well explained in the i.MX6Q RM:
"
28.4.2.1 GPIO Read Mode
The programming sequence for reading input signals should be as follows:
1. Configure IOMUX to select GPIO mode (Via IOMUX Controller (IOMUXC) ).
2. Configure GPIO direction register to input (GPIO_GDIR[GDIR] set to 0b).
3. Read value from data register/pad status register.
[...]
NOTE
While the GPIO direction is set to input (GPIO_GDIR = 0), a
read access to GPIO_DR does not return GPIO_DR data.
Instead, it returns the GPIO_PSR data, which is the
corresponding input signal value.

28.4.2.2 GPIO Write Mode
The programming sequence for driving output signals should be as follows:
1. Configure IOMUX to select GPIO mode (Via IOMUXC), also enable SION if need
to read loopback pad value through PSR
2. Configure GPIO direction register to output (GPIO_GDIR[GDIR] set to 1b).
3. Write value to data register (GPIO_DR).
"

So:
 - in input mode: DR = PSR = pin,
 - in output mode: DR is applied to the pin, and the pin level can be read back
   through PSR if SION is set (i.e. PSR = DR unless there is a hardware
   conflict).

Hence, gpio_get_value() should be left unchanged (using PSR in all cases), and
SION should be set for all GPIOs in the i.MX6 pin definition header files.

Best regards,
Benoît
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to