u-boot/arch/arm/mach-versal/mp.c
Algapally Santosh Sagar 89240bc0c4 arm64: versal: Add missing prototypes
Add missing prototypes to fix the below sparse warnings
1. warning: no previous prototype for 'set_r5_halt_mode'
[-Wmissing-prototypes]
2. warning: no previous prototype for 'set_r5_tcm_mode'
[-Wmissing-prototypes]
3. warning: no previous prototype for 'release_r5_reset'
[-Wmissing-prototypes]
4.warning: no previous prototype for 'enable_clock_r5'
[-Wmissing-prototypes]

Signed-off-by: Algapally Santosh Sagar <santoshsagar.algapally@amd.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Link: https://lore.kernel.org/r/20230609090531.31794-3-ashok.reddy.soma@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
2023-06-12 13:25:02 +02:00

109 lines
2.5 KiB
C

// SPDX-License-Identifier: GPL-2.0
/*
* (C) Copyright 2019 Xilinx, Inc.
* Siva Durga Prasad <siva.durga.paladugu@xilinx.com>
*/
#include <common.h>
#include <asm/io.h>
#include <asm/arch/hardware.h>
#include <asm/arch/sys_proto.h>
#define HALT 0
#define RELEASE 1
#define VERSAL_RPU_CFG_CPU_HALT_MASK 0x01
#define VERSAL_RPU_GLBL_CTRL_SPLIT_LOCK_MASK 0x08
#define VERSAL_RPU_GLBL_CTRL_TCM_COMB_MASK 0x40
#define VERSAL_RPU_GLBL_CTRL_SLCLAMP_MASK 0x10
#define VERSAL_CRLAPB_RST_LPD_AMBA_RST_MASK 0x04
#define VERSAL_CRLAPB_RST_LPD_R50_RST_MASK 0x01
#define VERSAL_CRLAPB_RST_LPD_R51_RST_MASK 0x02
#define VERSAL_CRL_RST_CPU_R5_RESET_PGE_MASK 0x10
#define VERSAL_CRLAPB_CPU_R5_CTRL_CLKACT_MASK 0x1000000
static void set_r5_halt_mode(u8 halt, u8 mode)
{
u32 tmp;
tmp = readl(&rpu_base->rpu0_cfg);
if (halt == HALT)
tmp &= ~VERSAL_RPU_CFG_CPU_HALT_MASK;
else
tmp |= VERSAL_RPU_CFG_CPU_HALT_MASK;
writel(tmp, &rpu_base->rpu0_cfg);
if (mode == TCM_LOCK) {
tmp = readl(&rpu_base->rpu1_cfg);
if (halt == HALT)
tmp &= ~VERSAL_RPU_CFG_CPU_HALT_MASK;
else
tmp |= VERSAL_RPU_CFG_CPU_HALT_MASK;
writel(tmp, &rpu_base->rpu1_cfg);
}
}
static void set_r5_tcm_mode(u8 mode)
{
u32 tmp;
tmp = readl(&rpu_base->rpu_glbl_ctrl);
if (mode == TCM_LOCK) {
tmp &= ~VERSAL_RPU_GLBL_CTRL_SPLIT_LOCK_MASK;
tmp |= VERSAL_RPU_GLBL_CTRL_TCM_COMB_MASK |
VERSAL_RPU_GLBL_CTRL_SLCLAMP_MASK;
} else {
tmp |= VERSAL_RPU_GLBL_CTRL_SPLIT_LOCK_MASK;
tmp &= ~(VERSAL_RPU_GLBL_CTRL_TCM_COMB_MASK |
VERSAL_RPU_GLBL_CTRL_SLCLAMP_MASK);
}
writel(tmp, &rpu_base->rpu_glbl_ctrl);
}
static void release_r5_reset(u8 mode)
{
u32 tmp;
tmp = readl(&crlapb_base->rst_cpu_r5);
tmp &= ~(VERSAL_CRLAPB_RST_LPD_AMBA_RST_MASK |
VERSAL_CRLAPB_RST_LPD_R50_RST_MASK |
VERSAL_CRL_RST_CPU_R5_RESET_PGE_MASK);
if (mode == TCM_LOCK)
tmp &= ~VERSAL_CRLAPB_RST_LPD_R51_RST_MASK;
writel(tmp, &crlapb_base->rst_cpu_r5);
}
static void enable_clock_r5(void)
{
u32 tmp;
tmp = readl(&crlapb_base->cpu_r5_ctrl);
tmp |= VERSAL_CRLAPB_CPU_R5_CTRL_CLKACT_MASK;
writel(tmp, &crlapb_base->cpu_r5_ctrl);
}
void initialize_tcm(bool mode)
{
if (!mode) {
set_r5_tcm_mode(TCM_LOCK);
set_r5_halt_mode(HALT, TCM_LOCK);
enable_clock_r5();
release_r5_reset(TCM_LOCK);
} else {
set_r5_tcm_mode(TCM_SPLIT);
set_r5_halt_mode(HALT, TCM_SPLIT);
enable_clock_r5();
release_r5_reset(TCM_SPLIT);
}
}
void tcm_init(u8 mode)
{
puts("WARNING: Initializing TCM overwrites TCM content\n");
initialize_tcm(mode);
memset((void *)VERSAL_TCM_BASE_ADDR, 0, VERSAL_TCM_SIZE);
}