Ravi Kumar Bokka | 5afeba3 | 2021-01-04 14:28:14 +0530 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Shelley Chen | 9573c0e | 2021-10-07 23:09:36 -0700 | [diff] [blame] | 3 | #include <arch/cache.h> |
| 4 | #include <arch/mmu.h> |
Ravi Kumar Bokka | 5afeba3 | 2021-01-04 14:28:14 +0530 | [diff] [blame] | 5 | #include <console/console.h> |
Elyes HAOUAS | 3272782 | 2022-01-12 13:56:47 +0100 | [diff] [blame] | 6 | #include <program_loading.h> |
Ravi Kumar Bokka | 5afeba3 | 2021-01-04 14:28:14 +0530 | [diff] [blame] | 7 | #include <soc/mmu.h> |
Shelley Chen | 9573c0e | 2021-10-07 23:09:36 -0700 | [diff] [blame] | 8 | #include <soc/mmu_common.h> |
Ravi Kumar Bokka | 5afeba3 | 2021-01-04 14:28:14 +0530 | [diff] [blame] | 9 | #include <soc/shrm.h> |
| 10 | #include <soc/clock.h> |
Shelley Chen | 9573c0e | 2021-10-07 23:09:36 -0700 | [diff] [blame] | 11 | #include <soc/symbols_common.h> |
Ravi Kumar Bokka | 5afeba3 | 2021-01-04 14:28:14 +0530 | [diff] [blame] | 12 | |
| 13 | void shrm_fw_load_reset(void) |
| 14 | { |
Ravi Kumar Bokka | 5afeba3 | 2021-01-04 14:28:14 +0530 | [diff] [blame] | 15 | struct prog shrm_fw_prog = |
| 16 | PROG_INIT(PROG_PAYLOAD, CONFIG_CBFS_PREFIX "/shrm"); |
| 17 | |
Shelley Chen | 9573c0e | 2021-10-07 23:09:36 -0700 | [diff] [blame] | 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)) |
Ravi Kumar Bokka | 5afeba3 | 2021-01-04 14:28:14 +0530 | [diff] [blame] | 22 | die("SOC image: SHRM load failed"); |
| 23 | |
Shelley Chen | 9573c0e | 2021-10-07 23:09:36 -0700 | [diff] [blame] | 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 | |
Ravi Kumar Bokka | 5afeba3 | 2021-01-04 14:28:14 +0530 | [diff] [blame] | 29 | clock_reset_shrm(); |
| 30 | |
Shelley Chen | 9573c0e | 2021-10-07 23:09:36 -0700 | [diff] [blame] | 31 | printk(BIOS_DEBUG, "SOC:SHRM brought out of reset.\n"); |
Ravi Kumar Bokka | 5afeba3 | 2021-01-04 14:28:14 +0530 | [diff] [blame] | 32 | } |