[PATCH v3] gpio: mxc_gpio: fix reading state of GPIO pins in output mode

Marek Vasut marex at denx.de
Wed Aug 28 14:28:58 CEST 2024


On 8/28/24 9:58 AM, Lothar Waßmann wrote:
> Hi,

Hi,

> On Wed, 28 Aug 2024 09:49:44 +0200 (CEST) Tomas Paukrt wrote:
>>> You may give a look to this
>>>
>>> https://lore.kernel.org/u-boot/57015C5F.3080209@denx.de/
>>>
>>> Regards,
>>> Peng.
>>
>> The Linux driver uses the DR register for about 9 years and
>> the NXP U-Boot driver uses the DR register for about 7 years,
>> so only the mainline U-Boot driver still uses the PSR register.
>>
>> Please give a look to:
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=442b2494b17d1a4f0a14721580271eb23ebffd42
>> https://github.com/nxp-imx/uboot-imx/commit/4afc3f90943c6b117f79b66d2cd04e64f437b0c2
>>
> Reading the PSR (with SION set) has the advantage that it provides the
> _actual_ pin state rather than the programmed output value even in case
> external hardware drives against the output driver.
> This is especially useful for Opendrain outputs or in case the output
> driver is disabled via the pad_ctl register.

Right, that ^ is the important part here.

But, this patch at least makes the driver behave the same way Linux 
driver behaves -- output pins: read from DR, input pins: read from PSR 
-- does it not ?


More information about the U-Boot mailing list