Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Mar 2016 03:39:38 +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: r297134 - head/sys/arm/ti
Message-ID:  <201603210339.u2L3dcJt098121@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: loos
Date: Mon Mar 21 03:39:38 2016
New Revision: 297134
URL: https://svnweb.freebsd.org/changeset/base/297134

Log:
  Use the internal references for ADC, this fixes the ADC readings on uBMC.
  
  Tested on BBB and uBMC.
  
  Sponsored by:	Rubicon Communications (Netgate)

Modified:
  head/sys/arm/ti/ti_adc.c

Modified: head/sys/arm/ti/ti_adc.c
==============================================================================
--- head/sys/arm/ti/ti_adc.c	Mon Mar 21 03:29:45 2016	(r297133)
+++ head/sys/arm/ti/ti_adc.c	Mon Mar 21 03:39:38 2016	(r297134)
@@ -161,11 +161,9 @@ ti_adc_input_setup(struct ti_adc_softc *
 
 	/* Set the negative voltage reference. */
 	val &= ~ADC_STEP_RFM_MSK;
-	val |= ADC_STEP_RFM_VREFN << ADC_STEP_RFM_SHIFT;
 
 	/* Set the positive voltage reference. */
 	val &= ~ADC_STEP_RFP_MSK;
-	val |= ADC_STEP_RFP_VREFP << ADC_STEP_RFP_SHIFT;
 
 	/* Set the samples average. */
 	val &= ~ADC_STEP_AVG_MSK;
@@ -450,11 +448,9 @@ ti_adc_idlestep_init(struct ti_adc_softc
 
 	/* Set the negative voltage reference. */
 	val &= ~ADC_STEP_RFM_MSK;
-	val |= ADC_STEP_RFM_VREFN << ADC_STEP_RFM_SHIFT;
 
 	/* Set the positive voltage reference. */
 	val &= ~ADC_STEP_RFP_MSK;
-	val |= ADC_STEP_RFP_VREFP << ADC_STEP_RFP_SHIFT;
 
 	/* Connect the input to VREFN. */
 	val &= ~ADC_STEP_INP_MSK;
@@ -484,6 +480,11 @@ ti_adc_attach(device_t dev)
 	sc = device_get_softc(dev);
 	sc->sc_dev = dev;
 
+	/* Activate the ADC_TSC module. */
+	err = ti_prcm_clk_enable(TSC_ADC_CLK);
+	if (err)
+		return (err);
+
 	rid = 0;
 	sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
 	    RF_ACTIVE);
@@ -509,11 +510,6 @@ ti_adc_attach(device_t dev)
 		return (ENXIO);
 	}
 
-	/* Activate the ADC_TSC module. */
-	err = ti_prcm_clk_enable(TSC_ADC_CLK);
-	if (err)
-		return (err);
-
 	/* Check the ADC revision. */
 	rev = ADC_READ4(sc, ADC_REVISION);
 	device_printf(dev,



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