]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
adc: meson-saradc: skip hardware init only if ADC is enabled
authorMarek Szyprowski <m.szyprowski@samsung.com>
Wed, 16 Dec 2020 07:51:55 +0000 (08:51 +0100)
committerNeil Armstrong <narmstrong@baylibre.com>
Mon, 11 Jan 2021 13:59:54 +0000 (14:59 +0100)
The driver skips hardware initialization if it is already configured by
the earlier bootloader stage (BL30). Skip the initialization only if the
hardware is really initialized and enabled.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
drivers/adc/meson-saradc.c

index 998cef24d88715f428adc355ba24a30a3b05a43b..ce7ae990ad025c4d7d10c8d88791f679df9cc6b4 100644 (file)
@@ -512,8 +512,11 @@ static int meson_saradc_init(struct meson_saradc_priv *priv)
         * reading the temperature sensor.
         */
        regmap_read(priv->regmap, MESON_SAR_ADC_REG3, &regval);
-       if (regval & MESON_SAR_ADC_REG3_BL30_INITIALIZED)
-               return 0;
+       if (regval & MESON_SAR_ADC_REG3_BL30_INITIALIZED) {
+               regmap_read(priv->regmap, MESON_SAR_ADC_REG3, &regval);
+               if (regval & MESON_SAR_ADC_REG3_ADC_EN)
+                       return 0;
+       }
 
        meson_saradc_stop_sample_engine(priv);