Re: [PATCH v1 5/5] ASoC: tegra: ahub: Reset hardware properly

From: Dmitry Osipenko
Date: Fri Jan 15 2021 - 08:04:00 EST


12.01.2021 15:58, Dmitry Osipenko пишет:
> Assert hardware reset before clocks are enabled and then de-assert it
> after clocks are enabled. This brings hardware into a predictable state
> and removes relying on implicit de-assertion of resets which is done by
> the clk driver.
>
> Tested-by: Peter Geis <pgwipeout@xxxxxxxxx>
> Tested-by: Nicolas Chauvet <kwizart@xxxxxxxxx>
> Signed-off-by: Dmitry Osipenko <digetx@xxxxxxxxx>
> ---
> sound/soc/tegra/tegra30_ahub.c | 33 ++++++++++++++++-----------------
> sound/soc/tegra/tegra30_ahub.h | 1 +
> 2 files changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c
> index 4dbb58f7ea36..246cf6a373a1 100644
> --- a/sound/soc/tegra/tegra30_ahub.c
> +++ b/sound/soc/tegra/tegra30_ahub.c
> @@ -65,10 +65,20 @@ static int tegra30_ahub_runtime_resume(struct device *dev)
> {
> int ret;
>
> + ret = reset_control_assert(ahub->reset);
> + if (ret)
> + return ret;
> +
> ret = clk_bulk_prepare_enable(ahub->nclocks, ahub->clocks);
> if (ret)
> return ret;
>
> + ret = reset_control_reset(ahub->reset);
> + if (ret) {
> + clk_bulk_disable_unprepare(ahub->nclocks, ahub->clocks);
> + return ret;
> + }
> +
> regcache_cache_only(ahub->regmap_apbif, false);
> regcache_cache_only(ahub->regmap_ahub, false);

I just realized that this is incorrect version of the patch which misses
the regcache syncing after the h/w reset. I'll make a v2.