From 60f631c04816428a904ab50088b8e9f5c14cd3a2 Mon Sep 17 00:00:00 2001 From: Bard Liao Date: Sun, 17 Jan 2021 11:26:21 +0800 Subject: [PATCH] soundwire: cadence_master: wait for HW reset before clock stop We set CDNS_MCP_CONTROL_HW_RST and do config update in sdw_cdns_exit_reset. The reset state will be pending for clocks period, and The CDNS_MCP_ CONTROL_HW_RST is self cleared. We have to make sure the bit has been cleared before doing another config update. Otherwise, we will do HW reset accidentally when we call cdns_config_update() in sdw_cdns_clock_stop(). Signed-off-by: Bard Liao --- drivers/soundwire/cadence_master.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c index d05442e646a383..3466b31617acf9 100644 --- a/drivers/soundwire/cadence_master.c +++ b/drivers/soundwire/cadence_master.c @@ -1410,6 +1410,12 @@ int sdw_cdns_clock_stop(struct sdw_cdns *cdns, bool block_wake) */ cdns_enable_slave_interrupts(cdns, false); + ret = cdns_set_wait(cdns, CDNS_MCP_CONTROL, CDNS_MCP_CONTROL_HW_RST, 0); + if (ret < 0) { + dev_err(cdns->dev, "cdns HW reset not finished yet %d\n", ret); + return ret; + } + /* * For specific platforms, it is required to be able to put * master into a state in which it ignores wake-up trials