remoteproc: pas: Add Data Synchronization barrier before reading tcsr reg
Add memory barrier for data syncronization before reading the TCSR config register. The value written at Sub System is mismatching the read back value at APPS. Change-Id: I74862f6d8aa54a67988eca2fb9569e23cc89844a Signed-off-by: Gokul krishna Krishnakumar <quic_gokukris@quicinc.com> Signed-off-by: Kamati Srinivas <quic_kamasrin@quicinc.com>
This commit is contained in:
parent
8fff36db32
commit
c61660bfe4
@ -834,6 +834,22 @@ static irqreturn_t soccp_running_ack(int irq, void *data)
|
||||
* Return: 0 if the WFI status register reflects the requested state.
|
||||
*/
|
||||
static int rproc_config_check(struct qcom_adsp *adsp, u32 state)
|
||||
{
|
||||
unsigned int retry_num = 50;
|
||||
u32 val;
|
||||
|
||||
do {
|
||||
usleep_range(SOCCP_SLEEP_US, SOCCP_SLEEP_US + 100);
|
||||
/* Making sure the mem mapped io is read correctly*/
|
||||
dsb(sy);
|
||||
val = readl(adsp->config_addr);
|
||||
if ((state == SOCCP_D0) && (val == SOCCP_D1))
|
||||
return 0;
|
||||
} while (val != state && --retry_num);
|
||||
|
||||
return (val == state) ? 0 : -ETIMEDOUT;
|
||||
}
|
||||
static int rproc_config_check_atomic(struct qcom_adsp *adsp, u32 state)
|
||||
{
|
||||
u32 val;
|
||||
|
||||
@ -959,6 +975,7 @@ int rproc_set_state(struct rproc *rproc, bool state)
|
||||
|
||||
ret = rproc_config_check(adsp, SOCCP_D0);
|
||||
if (ret) {
|
||||
dsb(sy);
|
||||
dev_err(adsp->dev, "%s requested D3->D0: soccp failed to update tcsr val=%d\n",
|
||||
current->comm, readl(adsp->config_addr));
|
||||
goto soccp_out;
|
||||
@ -990,6 +1007,7 @@ int rproc_set_state(struct rproc *rproc, bool state)
|
||||
|
||||
ret = rproc_config_check(adsp, SOCCP_D3);
|
||||
if (ret) {
|
||||
dsb(sy);
|
||||
dev_err(adsp->dev, "%s requested D0->D3 failed: TCSR value:%d\n",
|
||||
current->comm, readl(adsp->config_addr));
|
||||
goto soccp_out;
|
||||
@ -1030,7 +1048,7 @@ static int rproc_panic_handler(struct notifier_block *this,
|
||||
dev_err(adsp->dev, "failed to update smem bits for D3 to D0\n");
|
||||
goto done;
|
||||
}
|
||||
ret = rproc_config_check(adsp, SOCCP_D0);
|
||||
ret = rproc_config_check_atomic(adsp, SOCCP_D0);
|
||||
if (ret)
|
||||
dev_err(adsp->dev, "failed to change to D0\n");
|
||||
done:
|
||||
@ -1044,10 +1062,13 @@ static void qcom_pas_handover(struct qcom_q6v5 *q6v5)
|
||||
|
||||
if (adsp->check_status) {
|
||||
ret = rproc_config_check(adsp, SOCCP_D3);
|
||||
dsb(sy);
|
||||
if (ret)
|
||||
dev_err(adsp->dev, "state not changed in handover\n");
|
||||
dev_err(adsp->dev, "state not changed in handover TCSR val = %d\n",
|
||||
readl(adsp->config_addr));
|
||||
else
|
||||
dev_info(adsp->dev, "state changed in handover for soccp!\n");
|
||||
dev_info(adsp->dev, "state changed in handover for soccp! TCSR val = %d\n",
|
||||
readl(adsp->config_addr));
|
||||
}
|
||||
disable_regulators(adsp);
|
||||
clk_disable_unprepare(adsp->aggre2_clk);
|
||||
|
Loading…
Reference in New Issue
Block a user