xref: /aosp_15_r20/external/coreboot/src/soc/qualcomm/sc7280/shrm_load_reset.c (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <arch/cache.h>
4 #include <arch/mmu.h>
5 #include <console/console.h>
6 #include <program_loading.h>
7 #include <soc/mmu.h>
8 #include <soc/mmu_common.h>
9 #include <soc/shrm.h>
10 #include <soc/clock.h>
11 #include <soc/symbols_common.h>
12 
shrm_fw_load_reset(void)13 void shrm_fw_load_reset(void)
14 {
15 	struct prog shrm_fw_prog =
16 		PROG_INIT(PROG_PAYLOAD, CONFIG_CBFS_PREFIX "/shrm");
17 
18 	/* map to cached region to force address to be 4 byte aligned */
19 	mmu_config_range((void *)_shrm, REGION_SIZE(shrm), CACHED_RAM);
20 
21 	if (!selfload(&shrm_fw_prog))
22 		die("SOC image: SHRM load failed");
23 
24 	/* flush cached region */
25 	dcache_clean_by_mva(_shrm, REGION_SIZE(shrm));
26 	/* remap back to device memory */
27 	mmu_config_range((void *)_shrm, REGION_SIZE(shrm), DEV_MEM);
28 
29 	clock_reset_shrm();
30 
31 	printk(BIOS_DEBUG, "SOC:SHRM brought out of reset.\n");
32 }
33