refactor(st-clock): move stm32mp1_clk_rcc_regs_*lock
Those functions are only used on MP1, they should not be in STM32 clock
core. Move them to MP13 driver (they are already in MP15 driver).
Redefine new clk_stm32_rcc_regs_*lock() functions in clock core. This
change avoid sparse warning:
drivers/st/clk/clk-stm32-core.c:46:6: warning: symbol
'stm32mp1_clk_rcc_regs_lock' was not declared. Should it be static?
drivers/st/clk/clk-stm32-core.c:51:6: warning: symbol
'stm32mp1_clk_rcc_regs_unlock' was not declared. Should it be static?
Change-Id: I9f255acaa843e41fc14267c1a8091f93bd029796
Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
diff --git a/drivers/st/clk/clk-stm32-core.c b/drivers/st/clk/clk-stm32-core.c
index e8bd85f..6787d50 100644
--- a/drivers/st/clk/clk-stm32-core.c
+++ b/drivers/st/clk/clk-stm32-core.c
@@ -28,7 +28,7 @@
return stm32_clock_data;
}
-static void stm32mp1_clk_lock(struct spinlock *lock)
+static void _clk_lock(struct spinlock *lock)
{
if (stm32mp_lock_available()) {
/* Assume interrupts are masked */
@@ -36,21 +36,21 @@
}
}
-static void stm32mp1_clk_unlock(struct spinlock *lock)
+static void _clk_unlock(struct spinlock *lock)
{
if (stm32mp_lock_available()) {
spin_unlock(lock);
}
}
-void stm32mp1_clk_rcc_regs_lock(void)
+void clk_stm32_rcc_regs_lock(void)
{
- stm32mp1_clk_lock(®_lock);
+ _clk_lock(®_lock);
}
-void stm32mp1_clk_rcc_regs_unlock(void)
+void clk_stm32_rcc_regs_unlock(void)
{
- stm32mp1_clk_unlock(®_lock);
+ _clk_unlock(®_lock);
}
#define TIMEOUT_US_1S U(1000000)
@@ -571,9 +571,9 @@
{
int ret;
- stm32mp1_clk_lock(&refcount_lock);
+ _clk_lock(&refcount_lock);
ret = _clk_stm32_enable_core(priv, id);
- stm32mp1_clk_unlock(&refcount_lock);
+ _clk_unlock(&refcount_lock);
return ret;
}
@@ -619,11 +619,11 @@
void _clk_stm32_disable(struct stm32_clk_priv *priv, int id)
{
- stm32mp1_clk_lock(&refcount_lock);
+ _clk_lock(&refcount_lock);
_clk_stm32_disable_core(priv, id);
- stm32mp1_clk_unlock(&refcount_lock);
+ _clk_unlock(&refcount_lock);
}
bool _clk_stm32_is_enabled(struct stm32_clk_priv *priv, int id)
diff --git a/drivers/st/clk/clk-stm32-core.h b/drivers/st/clk/clk-stm32-core.h
index e66f3a4..3815d7c 100644
--- a/drivers/st/clk/clk-stm32-core.h
+++ b/drivers/st/clk/clk-stm32-core.h
@@ -146,6 +146,9 @@
#define MASK_WIDTH_SHIFT(_width, _shift) \
GENMASK(((_width) + (_shift) - 1U), (_shift))
+void clk_stm32_rcc_regs_lock(void);
+void clk_stm32_rcc_regs_unlock(void);
+
int clk_stm32_init(struct stm32_clk_priv *priv, uintptr_t base);
void clk_stm32_enable_critical_clocks(void);
diff --git a/drivers/st/clk/clk-stm32mp13.c b/drivers/st/clk/clk-stm32mp13.c
index 6a6ee5d..1cacad0 100644
--- a/drivers/st/clk/clk-stm32mp13.c
+++ b/drivers/st/clk/clk-stm32mp13.c
@@ -2332,6 +2332,16 @@
return 0;
}
+void stm32mp1_clk_rcc_regs_lock(void)
+{
+ clk_stm32_rcc_regs_lock();
+}
+
+void stm32mp1_clk_rcc_regs_unlock(void)
+{
+ clk_stm32_rcc_regs_unlock();
+}
+
int stm32mp1_clk_init(void)
{
int ret;