blob: 4da5a55dd643ecf5b902883aa6ba94e622732aef [file] [log] [blame]
Ravi Kumar Bokka5afeba32021-01-04 14:28:14 +05301/* SPDX-License-Identifier: GPL-2.0-only */
2
Shelley Chen9573c0e2021-10-07 23:09:36 -07003#include <arch/cache.h>
4#include <arch/mmu.h>
Ravi Kumar Bokka5afeba32021-01-04 14:28:14 +05305#include <console/console.h>
Elyes HAOUAS32727822022-01-12 13:56:47 +01006#include <program_loading.h>
Ravi Kumar Bokka5afeba32021-01-04 14:28:14 +05307#include <soc/mmu.h>
Shelley Chen9573c0e2021-10-07 23:09:36 -07008#include <soc/mmu_common.h>
Ravi Kumar Bokka5afeba32021-01-04 14:28:14 +05309#include <soc/shrm.h>
10#include <soc/clock.h>
Shelley Chen9573c0e2021-10-07 23:09:36 -070011#include <soc/symbols_common.h>
Ravi Kumar Bokka5afeba32021-01-04 14:28:14 +053012
13void shrm_fw_load_reset(void)
14{
Ravi Kumar Bokka5afeba32021-01-04 14:28:14 +053015 struct prog shrm_fw_prog =
16 PROG_INIT(PROG_PAYLOAD, CONFIG_CBFS_PREFIX "/shrm");
17
Shelley Chen9573c0e2021-10-07 23:09:36 -070018 /* 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))
Ravi Kumar Bokka5afeba32021-01-04 14:28:14 +053022 die("SOC image: SHRM load failed");
23
Shelley Chen9573c0e2021-10-07 23:09:36 -070024 /* 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
Ravi Kumar Bokka5afeba32021-01-04 14:28:14 +053029 clock_reset_shrm();
30
Shelley Chen9573c0e2021-10-07 23:09:36 -070031 printk(BIOS_DEBUG, "SOC:SHRM brought out of reset.\n");
Ravi Kumar Bokka5afeba32021-01-04 14:28:14 +053032}