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

#include <arch/cache.h>
#include <arch/mmu.h>
#include <cbfs.h>
#include <console/console.h>
#include <soc/mmu.h>
#include <soc/mmu_common.h>
#include <soc/shrm.h>
#include <soc/clock.h>
#include <soc/symbols_common.h>

void shrm_fw_load_reset(void)
{
	struct prog shrm_fw_prog =
		PROG_INIT(PROG_PAYLOAD, CONFIG_CBFS_PREFIX "/shrm");

	/* map to cached region to force address to be 4 byte aligned */
	mmu_config_range((void *)_shrm, REGION_SIZE(shrm), CACHED_RAM);

	if (!selfload(&shrm_fw_prog))
		die("SOC image: SHRM load failed");

	/* flush cached region */
	dcache_clean_by_mva(_shrm, REGION_SIZE(shrm));
	/* remap back to device memory */
	mmu_config_range((void *)_shrm, REGION_SIZE(shrm), DEV_MEM);

	clock_reset_shrm();

	printk(BIOS_DEBUG, "SOC:SHRM brought out of reset.\n");
}