svn commit: r320456 - head/sys/arm/freescale/imx

Ian Lepore ian at FreeBSD.org
Wed Jun 28 20:28:48 UTC 2017


Author: ian
Date: Wed Jun 28 20:28:47 2017
New Revision: 320456
URL: https://svnweb.freebsd.org/changeset/base/320456

Log:
  Implement gpio input by reading the pad state register, not the data register.
  
  When a pin is set for input the value in the DR will be the same as the PSR.
  
  When a pin is set for output the value in the DR is the value output to the
  pad, and the value in the PSR is the actual electrical level sensed on the
  pad, and they can be different if the pad is configured for open-drain mode
  and some other entity on the board is driving the line low.

Modified:
  head/sys/arm/freescale/imx/imx_gpio.c

Modified: head/sys/arm/freescale/imx/imx_gpio.c
==============================================================================
--- head/sys/arm/freescale/imx/imx_gpio.c	Wed Jun 28 19:08:07 2017	(r320455)
+++ head/sys/arm/freescale/imx/imx_gpio.c	Wed Jun 28 20:28:47 2017	(r320456)
@@ -644,7 +644,7 @@ imx51_gpio_pin_get(device_t dev, uint32_t pin, unsigne
 	if (pin >= sc->gpio_npins)
 		return (EINVAL);
 
-	*val = (READ4(sc, IMX_GPIO_DR_REG) >> pin) & 1;
+	*val = (READ4(sc, IMX_GPIO_PSR_REG) >> pin) & 1;
 
 	return (0);
 }


More information about the svn-src-head mailing list