mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 09:49:21 +08:00
cxd56xx: use small lock in arch/arm/src/cxd56xx/cxd56_clock.c
Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
parent
53f4216977
commit
74dfcdfbd6
1 changed files with 9 additions and 8 deletions
|
@ -150,6 +150,7 @@ static void cxd56_scu_peri_clock_gating(const struct scu_peripheral *p,
|
|||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
static spinlock_t g_cxd56_clock_lock = SP_UNLOCKED;
|
||||
static struct power_domain g_digital;
|
||||
static struct power_domain g_analog;
|
||||
|
||||
|
@ -323,9 +324,9 @@ static void enable_pwd(int pdid)
|
|||
release_pwd_reset(domain);
|
||||
}
|
||||
|
||||
flags = spin_lock_irqsave(NULL);
|
||||
flags = spin_lock_irqsave(&g_cxd56_clock_lock);
|
||||
g_digital.refs[pdid]++;
|
||||
spin_unlock_irqrestore(NULL, flags);
|
||||
spin_unlock_irqrestore(&g_cxd56_clock_lock, flags);
|
||||
}
|
||||
|
||||
static void disable_pwd(int pdid)
|
||||
|
@ -337,9 +338,9 @@ static void disable_pwd(int pdid)
|
|||
stat = getreg32(CXD56_TOPREG_PWD_STAT);
|
||||
if (stat & domain)
|
||||
{
|
||||
flags = spin_lock_irqsave(NULL);
|
||||
flags = spin_lock_irqsave(&g_cxd56_clock_lock);
|
||||
g_digital.refs[pdid]--;
|
||||
spin_unlock_irqrestore(NULL, flags);
|
||||
spin_unlock_irqrestore(&g_cxd56_clock_lock, flags);
|
||||
if (g_digital.refs[pdid] == 0)
|
||||
{
|
||||
putreg32(domain << 16, CXD56_TOPREG_PWD_CTL);
|
||||
|
@ -361,9 +362,9 @@ static void enable_apwd(int apdid)
|
|||
do_power_control(CXD56_TOPREG_ANA_PW_STAT, domain, domain);
|
||||
}
|
||||
|
||||
flags = spin_lock_irqsave(NULL);
|
||||
flags = spin_lock_irqsave(&g_cxd56_clock_lock);
|
||||
g_analog.refs[apdid]++;
|
||||
spin_unlock_irqrestore(NULL, flags);
|
||||
spin_unlock_irqrestore(&g_cxd56_clock_lock, flags);
|
||||
}
|
||||
|
||||
static void disable_apwd(int apdid)
|
||||
|
@ -375,9 +376,9 @@ static void disable_apwd(int apdid)
|
|||
stat = getreg32(CXD56_TOPREG_ANA_PW_STAT);
|
||||
if (stat & domain)
|
||||
{
|
||||
flags = spin_lock_irqsave(NULL);
|
||||
flags = spin_lock_irqsave(&g_cxd56_clock_lock);
|
||||
g_analog.refs[apdid]--;
|
||||
spin_unlock_irqrestore(NULL, flags);
|
||||
spin_unlock_irqrestore(&g_cxd56_clock_lock, flags);
|
||||
if (g_analog.refs[apdid] == 0)
|
||||
{
|
||||
putreg32(domain << 16, CXD56_TOPREG_ANA_PW_CTL);
|
||||
|
|
Loading…
Reference in a new issue