powerdomain: add check ack signal function [1/1]

PD#SWPL-31141

Problem:
powerdomain add ack signal check function

Solution:
modify the code

Verify:
S905D3

Change-Id: I3eb16e613d16bcc867501181968b58ff55243883
Signed-off-by: zhiqiang liang <zhiqiang.liang@amlogic.com>
This commit is contained in:
zhiqiang liang
2020-07-02 15:14:40 +08:00
committed by Chris
parent e8cc1330bd
commit 165e1ea9a2

View File

@@ -38,6 +38,7 @@
//ao reg
#define AO_RTI_GEN_PWR_SLEEP0 0x0
#define AO_RTI_GEN_PWR_ISO0 0x4
#define AO_RTI_GEN_PWR_ACK0 0x8
//mempd reg
#define HHI_MEM_PD_REG0 0x0
@@ -470,8 +471,21 @@ static void iso_switch(int pwr_domain, bool pwr_switch)
spin_unlock_irqrestore(&s_pd->iso_lock, flags);
}
static bool check_ack(int pwr_domain)
{
bool ack;
unsigned int value;
value = readl(s_pd->ao_addr + AO_RTI_GEN_PWR_ACK0);
ack = (value & (0x1 << pwr_domain)) == (0x1 << pwr_domain) ? 1 : 0;
return ack;
}
void power_domain_switch(int pwr_domain, bool pwr_switch)
{
bool ack_flag;
if (pwr_switch == PWR_ON) {
/* Powerup Power Domain */
power_switch(pwr_domain, PWR_ON);
@@ -479,6 +493,10 @@ void power_domain_switch(int pwr_domain, bool pwr_switch)
/* Powerup memories */
mem_pd_switch(pwr_domain, PWR_ON);
do {
ack_flag = check_ack(pwr_domain);
} while (ack_flag);
usleep_range(100, 150);
reset_switch(pwr_domain, PWR_OFF);