Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Jun 2017 20:28:47 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r320456 - head/sys/arm/freescale/imx
Message-ID:  <201706282028.v5SKSl6p095564@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706282028.v5SKSl6p095564>