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, _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"