diff options
Diffstat (limited to 'src/soc/intel')
-rw-r--r-- | src/soc/intel/tigerlake/include/soc/pmc.h | 24 | ||||
-rw-r--r-- | src/soc/intel/tigerlake/pmc.c | 7 |
2 files changed, 31 insertions, 0 deletions
diff --git a/src/soc/intel/tigerlake/include/soc/pmc.h b/src/soc/intel/tigerlake/include/soc/pmc.h index 0f72833fbe..b7a97cc824 100644 --- a/src/soc/intel/tigerlake/include/soc/pmc.h +++ b/src/soc/intel/tigerlake/include/soc/pmc.h @@ -101,6 +101,30 @@ extern struct device_operations pmc_ops; #define PCH2CPU_TPR_CFG_LOCK (1 << 31) #define PCH2CPU_TT_EN (1 << 26) +#define PCH_PMC_EPOC 0x18EC +#define PCH_EPOC_2LM(__epoc) ((__epoc) & 0x1) +/* XTAL frequency in bits 21, 20, 17 */ +#define PCH_EPOC_XTAL_FREQ(__epoc) ((((__epoc) >> 19) & 0x6) | ((__epoc) >> 17 & 0x1)) + +/** + * enum pch_pmc_xtal - External crystal oscillator frequency. + * @XTAL_24_MHZ: 24 MHz external crystal. + * @XTAL_19_2_MHZ: 19.2 MHz external crystal. + * @XTAL_38_4_MHZ: 38.4 MHz external crystal. + */ +enum pch_pmc_xtal { + XTAL_24_MHZ, + XTAL_19_2_MHZ, + XTAL_38_4_MHZ, +}; + +/** + * pmc_get_xtal_freq() - Return frequency of external oscillator. + * + * Return &enum pch_pmc_xtal corredsponding to frequency returned by PMC. + */ +enum pch_pmc_xtal pmc_get_xtal_freq(void); + #define PCH_PWRM_ACPI_TMR_CTL 0x18FC #define GPIO_GPE_CFG 0x1920 #define GPE0_DWX_MASK 0xf diff --git a/src/soc/intel/tigerlake/pmc.c b/src/soc/intel/tigerlake/pmc.c index 2d30424cd0..62e37114f3 100644 --- a/src/soc/intel/tigerlake/pmc.c +++ b/src/soc/intel/tigerlake/pmc.c @@ -17,6 +17,13 @@ #include <soc/pm.h> #include <soc/soc_chip.h> +enum pch_pmc_xtal pmc_get_xtal_freq(void) +{ + uint8_t *const pmcbase = pmc_mmio_regs(); + + return PCH_EPOC_XTAL_FREQ(read32(pmcbase + PCH_PMC_EPOC)); +} + static void config_deep_sX(uint32_t offset, uint32_t mask, int sx, int enable) { uint32_t reg; |