diff options
author | loos <loos@FreeBSD.org> | 2016-03-21 03:39:38 +0000 |
---|---|---|
committer | loos <loos@FreeBSD.org> | 2016-03-21 03:39:38 +0000 |
commit | 6f3cbbbc4b50d58a88894702a4b727adfc4ed780 (patch) | |
tree | 68e82a871dd717a1c32e6e507c2311136caebf92 | |
parent | 9b9af6bda46f5b65184ff0fb62d93dbad9640a0c (diff) | |
download | FreeBSD-src-6f3cbbbc4b50d58a88894702a4b727adfc4ed780.zip FreeBSD-src-6f3cbbbc4b50d58a88894702a4b727adfc4ed780.tar.gz |
Use the internal references for ADC, this fixes the ADC readings on uBMC.
Tested on BBB and uBMC.
Sponsored by: Rubicon Communications (Netgate)
-rw-r--r-- | sys/arm/ti/ti_adc.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/sys/arm/ti/ti_adc.c b/sys/arm/ti/ti_adc.c index d65afc6..f11091f 100644 --- a/sys/arm/ti/ti_adc.c +++ b/sys/arm/ti/ti_adc.c @@ -161,11 +161,9 @@ ti_adc_input_setup(struct ti_adc_softc *sc, int32_t ain) /* 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 *sc) /* 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, |