From 68bacc210945ef7d65dd542765c3be997caf7b4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Niew=C3=B6hner?= Date: Fri, 24 Sep 2021 23:57:37 +0200 Subject: [PATCH] soc/intel/{skl,cnl,dnv}: disable PM ACPI timer if chosen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Disable the PM ACPI timer during PMC init, when `USE_PM_ACPI_TIMER` is disabled. This is done to bring SKL, CNL, DNV in line with the other platforms, in order to transition handling of the PM timer from FSP to coreboot in the follow-up changes. For SKL and CNL, this temporarly redundantly disables the PM Timer, since FSP does that, too. This redundancy is resolved in the follow-up. Change-Id: I47280cd670a96c8fa5af107986496234f04e1f77 Signed-off-by: Michael Niewöhner Reviewed-on: https://review.coreboot.org/c/coreboot/+/57932 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber --- src/soc/intel/cannonlake/pmc.c | 9 +++++++++ src/soc/intel/denverton_ns/Kconfig | 1 + src/soc/intel/denverton_ns/include/soc/pmc.h | 2 ++ src/soc/intel/denverton_ns/pmc.c | 11 +++++++++++ src/soc/intel/skylake/pmc.c | 9 +++++++++ 5 files changed, 32 insertions(+) diff --git a/src/soc/intel/cannonlake/pmc.c b/src/soc/intel/cannonlake/pmc.c index d502e0675a..4c88685d04 100644 --- a/src/soc/intel/cannonlake/pmc.c +++ b/src/soc/intel/cannonlake/pmc.c @@ -118,6 +118,15 @@ static void soc_pmc_init(struct device *dev) * found. */ pmc_set_acpi_mode(); + + /* + * Disable ACPI PM timer based on Kconfig + * + * Disabling ACPI PM timer is necessary for XTAL OSC shutdown. + * Disabling ACPI PM timer also switches off TCO. + */ + if (!CONFIG(USE_PM_ACPI_TIMER)) + setbits8(pmc_mmio_regs() + PCH_PWRM_ACPI_TMR_CTL, ACPI_TIM_DIS); } static void pmc_fill_ssdt(const struct device *dev) diff --git a/src/soc/intel/denverton_ns/Kconfig b/src/soc/intel/denverton_ns/Kconfig index a578a71fd0..a8ed92be28 100644 --- a/src/soc/intel/denverton_ns/Kconfig +++ b/src/soc/intel/denverton_ns/Kconfig @@ -25,6 +25,7 @@ config CPU_SPECIFIC_OPTIONS select HAVE_SMI_HANDLER select CACHE_MRC_SETTINGS select PCR_COMMON_IOSF_1_0 + select PM_ACPI_TIMER_OPTIONAL select SUPPORT_CPU_UCODE_IN_CBFS select INTEL_DESCRIPTOR_MODE_CAPABLE select SOC_INTEL_COMMON_BLOCK diff --git a/src/soc/intel/denverton_ns/include/soc/pmc.h b/src/soc/intel/denverton_ns/include/soc/pmc.h index fdb1028f1f..0ba24fcb2f 100644 --- a/src/soc/intel/denverton_ns/include/soc/pmc.h +++ b/src/soc/intel/denverton_ns/include/soc/pmc.h @@ -240,6 +240,8 @@ #define GPIO_GPE_CFG 0x120 #define GPE0_DWX_MASK 0x7 #define GPE0_DW_SHIFT(x) (4 + 4*(x)) +#define PCH_PWRM_ACPI_TMR_CTL 0xfc +#define ACPI_TIM_DIS (1 << 1) /* I/O ports */ #define RST_CNT 0xcf9 diff --git a/src/soc/intel/denverton_ns/pmc.c b/src/soc/intel/denverton_ns/pmc.c index d75f7f05a6..2c208d2aa5 100644 --- a/src/soc/intel/denverton_ns/pmc.c +++ b/src/soc/intel/denverton_ns/pmc.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -46,6 +47,16 @@ static void pmc_init(struct device *dev) /* Configure ACPI mode. */ pch_set_acpi_mode(); + + /* + * Disable ACPI PM timer based on Kconfig + * + * Disabling ACPI PM timer is necessary for XTAL OSC shutdown. + * Disabling ACPI PM timer also switches off TCO. + */ + if (!CONFIG(USE_PM_ACPI_TIMER)) + setbits8((volatile void *)(uintptr_t)(pwrm_base + PCH_PWRM_ACPI_TMR_CTL), + ACPI_TIM_DIS); } static void pci_pmc_read_resources(struct device *dev) diff --git a/src/soc/intel/skylake/pmc.c b/src/soc/intel/skylake/pmc.c index c2e724f353..b9b85c2e8f 100644 --- a/src/soc/intel/skylake/pmc.c +++ b/src/soc/intel/skylake/pmc.c @@ -101,6 +101,15 @@ void pmc_soc_init(struct device *dev) pci_or_config32(dev, GEN_PMCON_B, 0); setbits32(pwrmbase + GBLRST_CAUSE0, 0); setbits32(pwrmbase + GBLRST_CAUSE1, 0); + + /* + * Disable ACPI PM timer based on Kconfig + * + * Disabling ACPI PM timer is necessary for XTAL OSC shutdown. + * Disabling ACPI PM timer also switches off TCO. + */ + if (!CONFIG(USE_PM_ACPI_TIMER)) + setbits8(pmc_mmio_regs() + PCH_PWRM_ACPI_TMR_CTL, ACPI_TIM_DIS); } static void pm1_enable_pwrbtn_smi(void *unused)