Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: qcom: reset: Ensure write completion on reset de/assertion

Trying to toggle the resets in a rapid fashion can lead to the changes
not actually arriving at the clock controller block when we expect them
to. This was observed at least on SM8250.

Read back the value after regmap_update_bits to ensure write completion.

Fixes: b36ba30c8ac6 ("clk: qcom: Add reset controller support")
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20240105-topic-venus_reset-v2-3-c37eba13b5ce@linaro.org
Signed-off-by: Bjorn Andersson <andersson@kernel.org>

authored by

Konrad Dybcio and committed by
Bjorn Andersson
2f8cf2c3 eda40d9c

+6 -1
+6 -1
drivers/clk/qcom/reset.c
··· 33 33 map = &rst->reset_map[id]; 34 34 mask = map->bitmask ? map->bitmask : BIT(map->bit); 35 35 36 - return regmap_update_bits(rst->regmap, map->reg, mask, assert ? mask : 0); 36 + regmap_update_bits(rst->regmap, map->reg, mask, assert ? mask : 0); 37 + 38 + /* Read back the register to ensure write completion, ignore the value */ 39 + regmap_read(rst->regmap, map->reg, &mask); 40 + 41 + return 0; 37 42 } 38 43 39 44 static int qcom_reset_assert(struct reset_controller_dev *rcdev, unsigned long id)