diff mbox series

[v4,05/19] arm: mach-k3: Move mmr_unlock to a common location

Message ID 20200808105303.1513-6-lokeshvutla@ti.com
State Accepted
Commit 58ccd6105c6e1fc98e546ea86940e10c52b7840b
Delegated to: Lokesh Vutla
Headers show
Series arm: mach-k3: Initial support for Texas Instrument's J7200 Platform | expand

Commit Message

Lokesh Vutla Aug. 8, 2020, 10:52 a.m. UTC
mmr_unlock api is common for all k3 devices. Move it to a common
location.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Suman Anna <s-anna@ti.com>
---
 arch/arm/mach-k3/am6_init.c   | 10 ----------
 arch/arm/mach-k3/common.c     | 10 ++++++++++
 arch/arm/mach-k3/common.h     |  1 +
 arch/arm/mach-k3/j721e_init.c | 10 ----------
 4 files changed, 11 insertions(+), 20 deletions(-)
diff mbox series

Patch

diff --git a/arch/arm/mach-k3/am6_init.c b/arch/arm/mach-k3/am6_init.c
index 9cb3086014..e66d1c1fe1 100644
--- a/arch/arm/mach-k3/am6_init.c
+++ b/arch/arm/mach-k3/am6_init.c
@@ -46,16 +46,6 @@  struct fwl_data main_cbass_fwls[] = {
 #endif
 #endif
 
-static void mmr_unlock(u32 base, u32 partition)
-{
-	/* Translate the base address */
-	phys_addr_t part_base = base + partition * CTRL_MMR0_PARTITION_SIZE;
-
-	/* Unlock the requested partition if locked using two-step sequence */
-	writel(CTRLMMR_LOCK_KICK0_UNLOCK_VAL, part_base + CTRLMMR_LOCK_KICK0);
-	writel(CTRLMMR_LOCK_KICK1_UNLOCK_VAL, part_base + CTRLMMR_LOCK_KICK1);
-}
-
 static void ctrl_mmr_unlock(void)
 {
 	/* Unlock all WKUP_CTRL_MMR0 module registers */
diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index 4335f2877b..178dc210c3 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -62,6 +62,16 @@  void k3_sysfw_print_ver(void)
 	       ti_sci->version.firmware_revision, fw_desc);
 }
 
+void mmr_unlock(phys_addr_t base, u32 partition)
+{
+	/* Translate the base address */
+	phys_addr_t part_base = base + partition * CTRL_MMR0_PARTITION_SIZE;
+
+	/* Unlock the requested partition if locked using two-step sequence */
+	writel(CTRLMMR_LOCK_KICK0_UNLOCK_VAL, part_base + CTRLMMR_LOCK_KICK0);
+	writel(CTRLMMR_LOCK_KICK1_UNLOCK_VAL, part_base + CTRLMMR_LOCK_KICK1);
+}
+
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_K3_EARLY_CONS
diff --git a/arch/arm/mach-k3/common.h b/arch/arm/mach-k3/common.h
index ba344c5bc9..44cf94a174 100644
--- a/arch/arm/mach-k3/common.h
+++ b/arch/arm/mach-k3/common.h
@@ -22,3 +22,4 @@  void start_non_linux_remote_cores(void);
 int load_firmware(char *name_fw, char *name_loadaddr, u32 *loadaddr);
 void k3_sysfw_print_ver(void);
 void spl_enable_dcache(void);
+void mmr_unlock(phys_addr_t base, u32 partition);
diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
index 5ec62a92f8..2010cab1d1 100644
--- a/arch/arm/mach-k3/j721e_init.c
+++ b/arch/arm/mach-k3/j721e_init.c
@@ -64,16 +64,6 @@  struct fwl_data cbass_hc_cfg0_fwls[] = {
 #endif
 #endif
 
-static void mmr_unlock(u32 base, u32 partition)
-{
-	/* Translate the base address */
-	phys_addr_t part_base = base + partition * CTRL_MMR0_PARTITION_SIZE;
-
-	/* Unlock the requested partition if locked using two-step sequence */
-	writel(CTRLMMR_LOCK_KICK0_UNLOCK_VAL, part_base + CTRLMMR_LOCK_KICK0);
-	writel(CTRLMMR_LOCK_KICK1_UNLOCK_VAL, part_base + CTRLMMR_LOCK_KICK1);
-}
-
 static void ctrl_mmr_unlock(void)
 {
 	/* Unlock all WKUP_CTRL_MMR0 module registers */