From 64f7eaafa7ca8e5908e6e1dd1be6f6df6cae06d9 Mon Sep 17 00:00:00 2001 From: Ravi Kumar Bokka Date: Fri, 15 Oct 2021 23:02:41 +0530 Subject: soc/qualcomm: Commonize AOP firmware support Move AOP firmware support from qualcomm/sc7180 into qualcomm/common BUG=b:182963902 TEST=Validated on qualcomm sc7180 development board Change-Id: I90b0f48e15df390970e027bff2065b7a89b14cec Signed-off-by: Ravi Kumar Bokka Reviewed-on: https://review.coreboot.org/c/coreboot/+/49767 Tested-by: build bot (Jenkins) Reviewed-by: Shelley Chen --- src/soc/qualcomm/common/aop_load_reset.c | 20 ++++++++++++++++++++ src/soc/qualcomm/common/include/soc/aop_common.h | 8 ++++++++ src/soc/qualcomm/common/mmu.c | 8 ++++++-- src/soc/qualcomm/sc7180/Makefile.inc | 2 +- src/soc/qualcomm/sc7180/aop_load_reset.c | 23 ----------------------- src/soc/qualcomm/sc7180/include/soc/aop.h | 8 -------- src/soc/qualcomm/sc7180/mmu.c | 6 ------ src/soc/qualcomm/sc7180/soc.c | 2 +- 8 files changed, 36 insertions(+), 41 deletions(-) create mode 100644 src/soc/qualcomm/common/aop_load_reset.c create mode 100644 src/soc/qualcomm/common/include/soc/aop_common.h delete mode 100644 src/soc/qualcomm/sc7180/aop_load_reset.c delete mode 100644 src/soc/qualcomm/sc7180/include/soc/aop.h (limited to 'src') diff --git a/src/soc/qualcomm/common/aop_load_reset.c b/src/soc/qualcomm/common/aop_load_reset.c new file mode 100644 index 0000000000..1b3a1d50ab --- /dev/null +++ b/src/soc/qualcomm/common/aop_load_reset.c @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include +#include +#include + +void aop_fw_load_reset(void) +{ + struct prog aop_fw_prog = + PROG_INIT(PROG_PAYLOAD, CONFIG_CBFS_PREFIX "/aop"); + + if (!selfload(&aop_fw_prog)) + die("SOC image: AOP load failed"); + + clock_reset_aop(); + + printk(BIOS_DEBUG, "SOC:AOP brought out of reset.\n"); +} diff --git a/src/soc/qualcomm/common/include/soc/aop_common.h b/src/soc/qualcomm/common/include/soc/aop_common.h new file mode 100644 index 0000000000..5b0de4eb67 --- /dev/null +++ b/src/soc/qualcomm/common/include/soc/aop_common.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef _SOC_QUALCOMM_COMMON_AOP_H__ +#define _SOC_QUALCOMM_COMMON_AOP_H__ + +void aop_fw_load_reset(void); + +#endif // _SOC_QUALCOMM_COMMON_AOP_H__ diff --git a/src/soc/qualcomm/common/mmu.c b/src/soc/qualcomm/common/mmu.c index ba1173edf9..0f12555a7f 100644 --- a/src/soc/qualcomm/common/mmu.c +++ b/src/soc/qualcomm/common/mmu.c @@ -3,9 +3,9 @@ #include #include #include +#include __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) { @@ -18,5 +18,9 @@ void qc_mmu_dram_config_post_dram_init(void *ddr_base, size_t ddr_size) 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(); + + mmu_config_range((void *)_aop_code_ram, REGION_SIZE(aop_code_ram), + CACHED_RAM); + mmu_config_range((void *)_aop_data_ram, REGION_SIZE(aop_data_ram), + CACHED_RAM); } diff --git a/src/soc/qualcomm/sc7180/Makefile.inc b/src/soc/qualcomm/sc7180/Makefile.inc index 7c393b3fac..df565b4c0e 100644 --- a/src/soc/qualcomm/sc7180/Makefile.inc +++ b/src/soc/qualcomm/sc7180/Makefile.inc @@ -36,7 +36,7 @@ romstage-$(CONFIG_DRIVERS_UART) += ../common/qupv3_uart.c ################################################################################ ramstage-y += soc.c ramstage-y += carve_out.c -ramstage-y += aop_load_reset.c +ramstage-y += ../common/aop_load_reset.c ramstage-y += usb.c ramstage-$(CONFIG_DRIVERS_UART) += ../common/qupv3_uart.c ramstage-$(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT) += display/dsi_phy_pll.c diff --git a/src/soc/qualcomm/sc7180/aop_load_reset.c b/src/soc/qualcomm/sc7180/aop_load_reset.c deleted file mode 100644 index d48a422991..0000000000 --- a/src/soc/qualcomm/sc7180/aop_load_reset.c +++ /dev/null @@ -1,23 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -#include -#include -#include -#include -#include - -void aop_fw_load_reset(void) -{ - bool aop_fw_entry; - - struct prog aop_fw_prog = - PROG_INIT(PROG_PAYLOAD, CONFIG_CBFS_PREFIX "/aop"); - - aop_fw_entry = selfload(&aop_fw_prog); - if (!aop_fw_entry) - die("SOC image: AOP load failed"); - - clock_reset_aop(); - - printk(BIOS_DEBUG, "\nSOC:AOP brought out of reset.\n"); -} diff --git a/src/soc/qualcomm/sc7180/include/soc/aop.h b/src/soc/qualcomm/sc7180/include/soc/aop.h deleted file mode 100644 index bdf3f83cbd..0000000000 --- a/src/soc/qualcomm/sc7180/include/soc/aop.h +++ /dev/null @@ -1,8 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -#ifndef _SOC_QUALCOMM_SC7180_AOP_H__ -#define _SOC_QUALCOMM_SC7180_AOP_H__ - -void aop_fw_load_reset(void); - -#endif // _SOC_QUALCOMM_SC7180_AOP_H__ diff --git a/src/soc/qualcomm/sc7180/mmu.c b/src/soc/qualcomm/sc7180/mmu.c index 03e62e507e..6aff9a99f4 100644 --- a/src/soc/qualcomm/sc7180/mmu.c +++ b/src/soc/qualcomm/sc7180/mmu.c @@ -19,9 +19,3 @@ void sc7180_mmu_init(void) mmu_enable(); } - -void soc_mmu_dram_config_post_dram_init(void) -{ - mmu_config_range((void *)_aop_code_ram, REGION_SIZE(aop_code_ram), CACHED_RAM); - mmu_config_range((void *)_aop_data_ram, REGION_SIZE(aop_data_ram), CACHED_RAM); -} diff --git a/src/soc/qualcomm/sc7180/soc.c b/src/soc/qualcomm/sc7180/soc.c index e7efff45a3..af274d2013 100644 --- a/src/soc/qualcomm/sc7180/soc.c +++ b/src/soc/qualcomm/sc7180/soc.c @@ -5,7 +5,7 @@ #include #include #include -#include +#include static void soc_read_resources(struct device *dev) { -- cgit v1.2.3