Attention is currently required from: Hung-Te Lin, Jarried Lin, Yu-Ping Wu.
Yidi Lin has posted comments on this change by Jarried Lin. ( https://review.coreboot.org/c/coreboot/+/85888?usp=email )
Change subject: soc/mediatek/mt8196: Initialize MCUPM ......................................................................
Patch Set 2:
(1 comment)
File src/soc/mediatek/mt8196/mcupm.c:
https://review.coreboot.org/c/coreboot/+/85888/comment/19ce404a_595f6060?usp... : PS1, Line 39: /* set CPUEB_STATE_VALID = 1 */ : setbits32p(SPM_MCUPM_SPMC_CON, CPUEB_STATE_VALID); : : /* polling CPUEB_STATE_FINISH_ACK = 1 */ : if (!retry(POLLING_ACK_TIME, : (read32p(SPM_MCUPM_SPMC_CON) & CPUEB_STATE_FINISH_ACK) == : CPUEB_STATE_FINISH_ACK, udelay(1))) { : printk(BIOS_WARNING, : "[EB_SPMC] Polling ACK timeout, %#x\n", : read32p(SPM_MCUPM_SPMC_CON)); : return -1; : } : : /* set CPUEB_STATE_VALID = 0 */ : clrbits32p(SPM_MCUPM_SPMC_CON, CPUEB_STATE_VALID); : : /* polling CPUEB_STATE_FINISH_ACK = 0 */ : if (!retry(POLLING_ACK_TIME, : (read32p(SPM_MCUPM_SPMC_CON) & CPUEB_STATE_FINISH_ACK) != : CPUEB_STATE_FINISH_ACK, udelay(1))) { : printk(BIOS_WARNING, : "[EB_SPMC] Polling ACK timeout, %#x\n", : read32p(SPM_MCUPM_SPMC_CON)); : return -1; : }
Only used here, no need to create an additional API
What I mean is this. Then we use the same logic to set/clear CPUEB_STATE_VALID value. ``` static int xxxxx(uint32_t val) { uint32_t expect = (val) ? CPUEB_STATE_FINISH_ACK : 0; clrsetbits32p(SPM_MCUPM_SPMC_CON, CPUEB_STATE_VALID, val);
if (!retry(POLLING_ACK_TIME, (read32p(SPM_MCUPM_SPMC_CON) & CPUEB_STATE_FINISH_ACK) == expect, udelay(1))) { printk(BIOS_WARNING, "[EB_SPMC] Polling ACK timeout, %#x\n", read32p(SPM_MCUPM_SPMC_CON)); return -1; } }
static int eb_spmc_spm(void) { .... /* Set CPUEB_STATE_VALID = 1 */ if (xxxxx(1)) return -1; /* Set CPUEB_STATE_VALID = 0 */ if (xxxxx(0)) return -1; .... return 0; } ```