From: Eugen Hristev Date: Wed, 1 Sep 2021 12:30:05 +0000 (+0300) Subject: iio: adc: at91-sama5d2_adc: initialize hardware after clock is started X-Git-Tag: v5.16-rc1~119^2~23^2~124 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=eaefa151f48a3305cf73cbc02890eb63cdb48b16;p=thirdparty%2Fkernel%2Flinux.git iio: adc: at91-sama5d2_adc: initialize hardware after clock is started The hw_init hardware init call must happen after the clock is prepared and enabled. Otherwise, writing to the registers might lead to a block or external abort. Signed-off-by: Eugen Hristev Link: https://lore.kernel.org/r/20210901123013.329792-3-eugen.hristev@microchip.com Signed-off-by: Jonathan Cameron --- diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index ea5ca163d8796..1f4d461c2c18a 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -1833,12 +1833,12 @@ static int at91_adc_probe(struct platform_device *pdev) goto vref_disable; } - at91_adc_hw_init(indio_dev); - ret = clk_prepare_enable(st->per_clk); if (ret) goto vref_disable; + at91_adc_hw_init(indio_dev); + platform_set_drvdata(pdev, indio_dev); ret = at91_adc_buffer_and_trigger_init(&pdev->dev, indio_dev);