Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cxd56xx: use small lock in arch/arm/src/cxd56xx/cxd56_clock.c #14993

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions arch/arm/src/cxd56xx/cxd56_clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
Expand All @@ -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);
Expand All @@ -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)
Expand All @@ -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);
Expand Down
Loading