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 <eugen.hristev@microchip.com>
Link: https://lore.kernel.org/r/20210901123013.329792-3-eugen.hristev@microchip.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Eugen Hristev 2021-09-01 15:30:05 +03:00 committed by Jonathan Cameron
parent f928670651
commit eaefa151f4

View file

@ -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);