soc/intel/apl: Implement power-failure-state API
Needed some Makefile changes to be able to compile for SMM. Change-Id: Ibf218b90088a45349c54f4b881e895bb852e88bb Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/31352 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
		| @@ -39,6 +39,7 @@ romstage-y += reset.c | ||||
| romstage-y += spi.c | ||||
|  | ||||
| smm-y += mmap_boot.c | ||||
| smm-y += pmc.c | ||||
| smm-y += pmutil.c | ||||
| smm-y += smihandler.c | ||||
| smm-y += spi.c | ||||
|   | ||||
| @@ -172,6 +172,7 @@ | ||||
| #define  SRS			(1 << 20) | ||||
| #define  MS4V			(1 << 18) | ||||
| #define  RPS			(1 << 2) | ||||
| #define  SLEEP_AFTER_POWER_FAIL	(1 << 0) | ||||
| #define GEN_PMCON1_CLR1_BITS	(COLD_BOOT_STS | COLD_RESET_STS | \ | ||||
| 				 WARM_RESET_STS | GLOBAL_RESET_STS | \ | ||||
| 				 SRS | MS4V) | ||||
|   | ||||
| @@ -92,6 +92,24 @@ static void set_slp_s3_assertion_width(int width_usecs) | ||||
| 	write32((void *)gen_pmcon3, reg); | ||||
| } | ||||
|  | ||||
| void pmc_soc_set_afterg3_en(const bool on) | ||||
| { | ||||
| 	void *const gen_pmcon1 = (void *)(soc_read_pmc_base() + GEN_PMCON1); | ||||
| 	uint32_t reg32; | ||||
|  | ||||
| 	reg32 = read32(gen_pmcon1); | ||||
| 	if (on) | ||||
| 		reg32 &= ~SLEEP_AFTER_POWER_FAIL; | ||||
| 	else | ||||
| 		reg32 |= SLEEP_AFTER_POWER_FAIL; | ||||
| 	write32(gen_pmcon1, reg32); | ||||
| } | ||||
|  | ||||
| void pmc_soc_restore_power_failure(void) | ||||
| { | ||||
| 	pmc_set_power_failure_state(false); | ||||
| } | ||||
|  | ||||
| void pmc_soc_init(struct device *dev) | ||||
| { | ||||
| 	const struct soc_intel_apollolake_config *cfg = config_of(dev); | ||||
| @@ -108,4 +126,6 @@ void pmc_soc_init(struct device *dev) | ||||
|  | ||||
| 	/* Now that things have been logged clear out the PMC state. */ | ||||
| 	pmc_clear_prsts(); | ||||
|  | ||||
| 	pmc_set_power_failure_state(true); | ||||
| } | ||||
|   | ||||
| @@ -13,8 +13,8 @@ ramstage-$(CONFIG_SOC_INTEL_COMMON_BLOCK_FAST_SPI) += fast_spi_flash.c | ||||
| postcar-$(CONFIG_SOC_INTEL_COMMON_BLOCK_FAST_SPI) += fast_spi.c | ||||
| postcar-$(CONFIG_SOC_INTEL_COMMON_BLOCK_FAST_SPI) += fast_spi_flash.c | ||||
|  | ||||
| ifeq ($(CONFIG_SPI_FLASH_SMM),y) | ||||
| smm-$(CONFIG_SOC_INTEL_COMMON_BLOCK_FAST_SPI) += fast_spi.c | ||||
| ifeq ($(CONFIG_SPI_FLASH_SMM),y) | ||||
| smm-$(CONFIG_SOC_INTEL_COMMON_BLOCK_FAST_SPI) += fast_spi_flash.c | ||||
| endif | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user