byt: call poll_for_register_delay to wait register idle

Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
This commit is contained in:
Rander Wang 2018-09-25 12:59:24 +08:00
parent a5963cf740
commit 5d4cb92310
1 changed files with 6 additions and 14 deletions

View File

@ -126,7 +126,7 @@ static void irq_handler(void *arg)
int ipc_pmc_send_msg(uint32_t message)
{
uint32_t ipclpesch;
int try = 0;
int ret;
trace_ipc("SMs");
@ -142,21 +142,13 @@ int ipc_pmc_send_msg(uint32_t message)
shim_write(SHIM_IPCLPESCL, 0);
shim_write(SHIM_IPCLPESCH, SHIM_IPCLPESCH_BUSY | message);
/* check status */
ipclpesch = shim_read(SHIM_IPCLPESCH);
while (ipclpesch & SHIM_IPCLPESCH_BUSY) {
/* now wait for clock change */
idelay(PLATFORM_LPE_DELAY);
ipclpesch = shim_read(SHIM_IPCLPESCH);
try++;
if (try > 10)
break;
}
/* wait for idle status */
ret = poll_for_register_delay(SHIM_BASE + SHIM_IPCLPESCH,
SHIM_IPCLPESCH_BUSY, 0,
PLATFORM_LPE_DELAY);
/* did command succeed */
if (ipclpesch & SHIM_IPCLPESCH_BUSY) {
if (ret < 0) {
trace_ipc_error("ePf");
return -EINVAL;
}