2022-07-30 06:59:31 +08:00
|
|
|
/* Copyright(c) 2021 Intel Corporation. All rights reserved.
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include <zephyr/devicetree.h>
|
2023-03-28 22:30:26 +08:00
|
|
|
#include <soc_util.h>
|
2023-04-18 21:44:01 +08:00
|
|
|
#include <zephyr/cache.h>
|
2022-07-30 06:59:31 +08:00
|
|
|
#include <adsp_shim.h>
|
|
|
|
#include <adsp_memory.h>
|
|
|
|
#include <cpu_init.h>
|
|
|
|
#include "manifest.h"
|
|
|
|
|
2022-07-30 07:05:10 +08:00
|
|
|
__imr void hp_sram_init(uint32_t memory_size)
|
2022-07-30 06:59:31 +08:00
|
|
|
{
|
|
|
|
ARG_UNUSED(memory_size);
|
|
|
|
|
2022-10-03 02:48:13 +08:00
|
|
|
uint32_t hpsram_ebb_quantity = ace_hpsram_get_bank_count();
|
2022-11-07 18:36:42 +08:00
|
|
|
uint32_t idx;
|
2022-07-30 06:59:31 +08:00
|
|
|
|
|
|
|
for (idx = 0; idx < hpsram_ebb_quantity; ++idx) {
|
2023-10-14 02:40:37 +08:00
|
|
|
HPSRAM_REGS(idx)->HSxPGCTL = 0;
|
2024-09-03 22:06:50 +08:00
|
|
|
HPSRAM_REGS(idx)->HSxRMCTL = IS_ENABLED(CONFIG_SRAM_RETENTION_MODE);
|
2022-07-30 06:59:31 +08:00
|
|
|
}
|
|
|
|
for (idx = 0; idx < hpsram_ebb_quantity; ++idx) {
|
2023-10-14 02:40:37 +08:00
|
|
|
while (HPSRAM_REGS(idx)->HSxPGISTS != 0) {
|
2022-07-30 06:59:31 +08:00
|
|
|
}
|
|
|
|
}
|
2022-10-14 01:43:34 +08:00
|
|
|
|
|
|
|
bbzero((void *)L2_SRAM_BASE, L2_SRAM_SIZE);
|
2022-07-30 06:59:31 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
__imr void lp_sram_init(void)
|
|
|
|
{
|
2022-10-03 02:48:13 +08:00
|
|
|
uint32_t lpsram_ebb_quantity = ace_lpsram_get_bank_count();
|
2022-11-07 18:36:42 +08:00
|
|
|
uint32_t idx;
|
2022-07-30 06:59:31 +08:00
|
|
|
|
2022-11-07 18:36:42 +08:00
|
|
|
for (idx = 0; idx < lpsram_ebb_quantity; ++idx) {
|
2023-10-14 03:43:05 +08:00
|
|
|
LPSRAM_REGS(idx)->USxPGCTL = 0;
|
2024-09-03 22:06:50 +08:00
|
|
|
LPSRAM_REGS(idx)->USxRMCTL = IS_ENABLED(CONFIG_SRAM_RETENTION_MODE);
|
2022-07-30 06:59:31 +08:00
|
|
|
}
|
2022-11-07 18:36:42 +08:00
|
|
|
for (idx = 0; idx < lpsram_ebb_quantity; ++idx) {
|
2023-10-14 03:43:05 +08:00
|
|
|
while (LPSRAM_REGS(idx)->USxPGISTS != 0) {
|
2022-11-07 18:36:42 +08:00
|
|
|
}
|
|
|
|
}
|
2022-10-14 01:43:34 +08:00
|
|
|
|
|
|
|
bbzero((void *)LP_SRAM_BASE, LP_SRAM_SIZE);
|
2022-07-30 06:59:31 +08:00
|
|
|
}
|