From f74aa638e06c1edcb7c8c295c03d2f7b9b6f604d Mon Sep 17 00:00:00 2001 From: Aurora pro automerger Date: Mon, 23 May 2022 12:51:51 +0000 Subject: [Copybara Auto Merge] Merge branch 'gs201-release' into 'android13-gs-pixel-5.10'. release info:233216473 dsp prod 5/23 RC03 gxp: remove unrequired CORE_SCRATCHPAD_BASE offset Bug: 233381187 gxp: Refactor FW boot mode into its own functions Bug: 233381187 gxp: Switch the boot mode storage from CSRs into the scratchpad space Bug: 233381187 gxp: Fix locking in gxp_telemetry_disable() Bug: 232876605 GitOrigin-RevId: da625dba4f2565974652c7b1fdfb6db90870230e Change-Id: Iaab2bef0c866741ce0d1390ad39ddd87e932dd73 --- gxp-firmware.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) (limited to 'gxp-firmware.c') diff --git a/gxp-firmware.c b/gxp-firmware.c index ba3a784..15497cf 100644 --- a/gxp-firmware.c +++ b/gxp-firmware.c @@ -283,8 +283,7 @@ static int gxp_firmware_load(struct gxp_dev *gxp, uint core) memset(gxp->fwbufs[core].vaddr + AURORA_SCRATCHPAD_OFF, 0, AURORA_SCRATCHPAD_LEN); - core_scratchpad_base = gxp->fwbufs[core].vaddr + AURORA_SCRATCHPAD_OFF + - CORE_SCRATCHPAD_BASE(core); + core_scratchpad_base = gxp->fwbufs[core].vaddr + AURORA_SCRATCHPAD_OFF; offset = SCRATCHPAD_MSG_OFFSET(MSG_CORE_ALIVE); writel(0, core_scratchpad_base + offset); offset = SCRATCHPAD_MSG_OFFSET(MSG_TOP_ACCESS_OK); @@ -649,8 +648,7 @@ int gxp_firmware_run(struct gxp_dev *gxp, struct gxp_virtual_device *vd, } /* Mark this as a cold boot */ - gxp_write_32_core(gxp, core, GXP_REG_BOOT_MODE, - GXP_BOOT_MODE_REQUEST_COLD_BOOT); + gxp_firmware_set_boot_mode(gxp, core, GXP_BOOT_MODE_REQUEST_COLD_BOOT); #ifdef CONFIG_GXP_GEM5 /* @@ -743,3 +741,31 @@ void gxp_firmware_stop(struct gxp_dev *gxp, struct gxp_virtual_device *vd, gxp_pm_core_off(gxp, core); gxp_firmware_unload(gxp, core); } + +void gxp_firmware_set_boot_mode(struct gxp_dev *gxp, uint core, u32 mode) +{ + void __iomem *boot_mode_addr; + + /* Callers shouldn't call the function under this condition. */ + if (!gxp->fwbufs[core].vaddr) + return; + + boot_mode_addr = gxp->fwbufs[core].vaddr + AURORA_SCRATCHPAD_OFF + + SCRATCHPAD_MSG_OFFSET(MSG_BOOT_MODE); + + writel(mode, boot_mode_addr); +} + +u32 gxp_firmware_get_boot_mode(struct gxp_dev *gxp, uint core) +{ + void __iomem *boot_mode_addr; + + /* Callers shouldn't call the function under this condition. */ + if (!gxp->fwbufs[core].vaddr) + return 0; + + boot_mode_addr = gxp->fwbufs[core].vaddr + AURORA_SCRATCHPAD_OFF + + SCRATCHPAD_MSG_OFFSET(MSG_BOOT_MODE); + + return readl(boot_mode_addr); +} -- cgit v1.2.3