summaryrefslogtreecommitdiff
path: root/src/soc/qualcomm/sc7280/cpucp_load_reset.c
blob: d754531ed7450d98966f94ae327cf76b4f509df8 (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
/* SPDX-License-Identifier: GPL-2.0-only */

#include <assert.h>
#include <cbfs.h>
#include <console/console.h>
#include <soc/mmu.h>
#include <soc/cpucp.h>
#include <soc/clock.h>
#include <device/mmio.h>
#include <timer.h>

void cpucp_prepare(void)
{
	/* allow NS access to EPSS memory*/
	setbits32(&epss_top->access_override, 0x1);

	/* Enable subsystem clock. Required for CPUCP PDMEM access*/
	setbits32(&epss_fast->epss_muc_clk_ctrl, 0x1);
	if (!wait_ms(300, ((read32(&epss_fast->epss_muc_clk_ctrl) & 0x1) != 0x1)))
		printk(BIOS_ERR, "%s: cannot get CPUCP PDMEM access.\n", __func__);
}

void cpucp_fw_load_reset(void)
{
	struct prog cpucp_fw_prog =
		PROG_INIT(PROG_PAYLOAD, CONFIG_CBFS_PREFIX "/cpucp");

	cpucp_prepare();

	if (!selfload(&cpucp_fw_prog))
		die("SOC image: CPUCP load failed");

	printk(BIOS_DEBUG, "SOC:CPUCP image loaded successfully.\n");
}