sc7180: Add Modem region in memlayout to avoid modem cleanup in Secboot reboot.

two different modem regions wifi and lte to be handled in QC_SEC and modem

Change-Id: Ib4592ca66d3d0db4c4768be4cd27422fe9f786b8
Signed-off-by: Ravi Kumar Bokka <rbokka@codeaurora.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/46661
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
mkurumel 2020-09-14 23:28:53 +05:30 committed by Julius Werner
parent 82689d2ac8
commit a9d225b3e8
7 changed files with 52 additions and 1 deletions

View File

@ -14,5 +14,6 @@ static struct region * const ddr_region = (struct region *)_ddr_information;
void soc_mmu_dram_config_post_dram_init(void);
void qc_mmu_dram_config_post_dram_init(void *ddr_base, size_t ddr_size);
bool soc_modem_carve_out(void **start, void **end);
#endif /* _SOC_QUALCOMM_MMU_COMMON_H_ */

View File

@ -4,10 +4,19 @@
#include <soc/mmu.h>
#include <soc/mmu_common.h>
__weak bool soc_modem_carve_out(void **start, void **end) { return false; }
__weak void soc_mmu_dram_config_post_dram_init(void) { /* no-op */ }
void qc_mmu_dram_config_post_dram_init(void *ddr_base, size_t ddr_size)
{
void *start = NULL;
void *end = NULL;
if (!soc_modem_carve_out(&start, &end)) {
mmu_config_range((void *)ddr_base, ddr_size, CACHED_RAM);
} else {
mmu_config_range(ddr_base, start - ddr_base, CACHED_RAM);
mmu_config_range(end, ddr_base + ddr_size - end, CACHED_RAM);
}
soc_mmu_dram_config_post_dram_init();
}

View File

@ -45,6 +45,7 @@ romstage-y += qupv3_spi.c
romstage-y += gpio.c
romstage-y += qupv3_i2c.c
romstage-y += clock.c
romstage-y += carve_out.c
romstage-$(CONFIG_SC7180_QSPI) += qspi.c
romstage-y += qcom_qup_se.c
romstage-y += qupv3_config.c
@ -52,6 +53,7 @@ romstage-$(CONFIG_DRIVERS_UART) += qupv3_uart.c
################################################################################
ramstage-y += soc.c
ramstage-y += carve_out.c
ramstage-y += timer.c
ramstage-y += spi.c
ramstage-y += qupv3_spi.c

View File

@ -0,0 +1,28 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <arch/stages.h>
#include <soc/mmu_common.h>
#include <soc/symbols.h>
#include <device/mmio.h>
#include <string.h>
#define MODEM_ID_LTE 0x004c5445
#define MODEM_ID_WIFI 0x57494649
bool soc_modem_carve_out(void **start, void **end)
{
uint32_t modem_id = read32(_modem_id);
switch (modem_id) {
case MODEM_ID_LTE:
*start = _dram_modem_wifi_only;
*end = _edram_modem_extra;
return true;
case MODEM_ID_WIFI:
*start = _dram_modem_wifi_only;
*end = _edram_modem_wifi_only;
return true;
default:
return false;
}
}

View File

@ -9,9 +9,12 @@ DECLARE_REGION(ssram)
DECLARE_REGION(bsram)
DECLARE_REGION(dram_aop)
DECLARE_REGION(dram_soc)
DECLARE_REGION(dram_modem_wifi_only)
DECLARE_REGION(dram_modem_extra)
DECLARE_REGION(dcb)
DECLARE_REGION(pmic)
DECLARE_REGION(limits_cfg)
DECLARE_REGION(aop)
DECLARE_REGION(modem_id)
#endif /* _SOC_QUALCOMM_SC7180_SYMBOLS_H_ */

View File

@ -24,6 +24,7 @@ SECTIONS
SSRAM_START(0x14680000)
OVERLAP_DECOMPRESSOR_VERSTAGE_ROMSTAGE(0x14680000, 100K)
REGION(qcsdi, 0x14699000, 52K, 4K)
REGION(modem_id, 0x146ABD00, 4, 4)
SSRAM_END(0x146AE000)
BSRAM_START(0x14800000)
@ -51,6 +52,8 @@ SECTIONS
REGION(dram_aop, 0x80800000, 0x040000, 0x1000)
REGION(dram_soc, 0x80900000, 0x200000, 0x1000)
BL31(0x80B00000, 1M)
REGION(dram_modem_wifi_only, 0x86000000, 32M, 4)
REGION(dram_modem_extra, 0x88000000, 108M, 4)
POSTRAM_CBFS_CACHE(0x9F800000, 16M)
RAMSTAGE(0xA0800000, 16M)
}

View File

@ -9,12 +9,17 @@
static void soc_read_resources(struct device *dev)
{
void *start = NULL;
void *end = NULL;
ram_resource(dev, 0, (uintptr_t)ddr_region->offset / KiB,
ddr_region->size / KiB);
reserved_ram_resource(dev, 1, (uintptr_t)_dram_aop / KiB,
REGION_SIZE(dram_aop) / KiB);
reserved_ram_resource(dev, 2, (uintptr_t)_dram_soc / KiB,
REGION_SIZE(dram_soc) / KiB);
if (soc_modem_carve_out(&start, &end))
reserved_ram_resource(dev, 3, (uintptr_t)start / KiB, (end - start) / KiB);
}
static void soc_init(struct device *dev)