[PATCH v3 3/6] adc: meson-saradc: skip hardware init only if ADC is enabled

Marek Szyprowski m.szyprowski at samsung.com
Wed Dec 16 08:51:55 CET 2020


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 at samsung.com>
Reviewed-by: Neil Armstrong <narmstrong at baylibre.com>
Tested-by: Jaehoon Chung <jh80.chung at samsung.com>
Reviewed-by: Jaehoon Chung <jh80.chung at samsung.com>
---
 drivers/adc/meson-saradc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/adc/meson-saradc.c b/drivers/adc/meson-saradc.c
index 998cef24d8..ce7ae990ad 100644
--- a/drivers/adc/meson-saradc.c
+++ b/drivers/adc/meson-saradc.c
@@ -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);
 
-- 
2.17.1



More information about the U-Boot mailing list