aboutsummaryrefslogtreecommitdiff
path: root/plat/marvell/armada/a8k/common/mss/mss_bl31_setup.c
blob: 52a892956df23ff1fc223a913ce38cfbdc14eb4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * Copyright (C) 2021 Marvell International Ltd.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 * https://spdx.org/licenses
 */

#include <platform_def.h>

#include <common/bl_common.h>
#include <common/debug.h>
#include <lib/mmio.h>

#include <armada_common.h>

#include "mss_defs.h"

void mss_start_cp_cm3(int cp)
{
	uint32_t magic;
	uintptr_t sram = MVEBU_CP_REGS_BASE(cp) + MSS_CP_SRAM_OFFSET;
	uintptr_t regs = MVEBU_CP_REGS_BASE(cp) + MSS_CP_REGS_OFFSET;

	magic = mmio_read_32(sram);

	/* Make sure the FW was loaded */
	if (magic != MSS_FW_READY_MAGIC) {
		return;
	}

	NOTICE("Starting CP%d MSS CPU\n", cp);
	/* remove the magic */
	mmio_write_32(sram, 0);
	/* Release M3 from reset */
	mmio_write_32(MSS_M3_RSTCR(regs),
		      (MSS_M3_RSTCR_RST_OFF << MSS_M3_RSTCR_RST_OFFSET));
}