Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Dec 2016 02:18:08 +0000 (UTC)
From:      Luiz Otavio O Souza <loos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r310886 - head/sys/arm/ti/am335x
Message-ID:  <201612310218.uBV2I89a025322@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: loos
Date: Sat Dec 31 02:18:08 2016
New Revision: 310886
URL: https://svnweb.freebsd.org/changeset/base/310886

Log:
  Fixes the sensor initialization, always reset the digital outputs to start.
  
  Obtained from:	pfSense
  MFC after:	3 days
  Sponsored by:	Rubicon Communications, LLC (Netgate)

Modified:
  head/sys/arm/ti/am335x/am335x_scm.c

Modified: head/sys/arm/ti/am335x/am335x_scm.c
==============================================================================
--- head/sys/arm/ti/am335x/am335x_scm.c	Sat Dec 31 02:02:42 2016	(r310885)
+++ head/sys/arm/ti/am335x/am335x_scm.c	Sat Dec 31 02:18:08 2016	(r310886)
@@ -110,11 +110,14 @@ am335x_scm_attach(device_t dev)
 	struct sysctl_oid_list *tree;
 	uint32_t reg;
 
-	/* Set ADC to continous mode, clear output reset. */
-	reg = SCM_BGAP_CLRZ | SCM_BGAP_CONTCONV;
-	ti_scm_reg_write_4(SCM_BGAP_CTRL, reg);
-	/* Flush write. */
+	/* Reset the digital outputs. */
+	ti_scm_reg_write_4(SCM_BGAP_CTRL, 0);
+	ti_scm_reg_read_4(SCM_BGAP_CTRL, &reg);
+	DELAY(500);
+	/* Set continous mode. */
+	ti_scm_reg_write_4(SCM_BGAP_CTRL, SCM_BGAP_CONTCONV);
 	ti_scm_reg_read_4(SCM_BGAP_CTRL, &reg);
+	DELAY(500);
 	/* Start the ADC conversion. */
 	reg = SCM_BGAP_CLRZ | SCM_BGAP_CONTCONV | SCM_BGAP_SOC;
 	ti_scm_reg_write_4(SCM_BGAP_CTRL, reg);



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