]> git.dujemihanovic.xyz Git - u-boot.git/commit
gpio: mxc_gpio: fix reading state of GPIO pins in output mode
authorTomas Paukrt <tomaspaukrt@email.cz>
Wed, 28 Aug 2024 13:09:48 +0000 (15:09 +0200)
committerFabio Estevam <festevam@gmail.com>
Sat, 31 Aug 2024 01:32:29 +0000 (22:32 -0300)
commit75e8b677b7cc9a4ffddcf90d5c41afa7b7a19658
tree8e0d52740705b73eb3c8d7b0337452f003ca5a4d
parent61f64757ac41cabfd19c3bf8cee20f78ea9c0cfe
gpio: mxc_gpio: fix reading state of GPIO pins in output mode

The PSR register works correctly for GPIO pins in input mode,
but always returns 0 for GPIO pins in output mode unless the SION
bit is set.

The DR register should be used for GPIO pins in output mode
to allow correct getting of previously set output value.

Please note that the Linux gpio-mxc driver and the NXP U-Boot mxc_gpio
driver already use the DR register for all GPIO pins in output mode:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=442b2494b17d1a4f0a14721580271eb23ebffd42
https://github.com/nxp-imx/uboot-imx/commit/4afc3f90943c6b117f79b66d2cd04e64f437b0c2

Signed-off-by: Tomas Paukrt <tomaspaukrt@email.cz>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Fabio Estevam <festevam@gmail.com>
drivers/gpio/mxc_gpio.c