soc/intel/common: Move PMC EPOC related code to Intel common code

Move PMC EPOC related code to intel/common/block because it is
generic for most Intel platforms and ADL, TGL & EHL use it.

Add a kconfig 'PMC_EPOC' to guard this common EPOC code.

The PMC EPOC register indicates which external crystal oscillator is
connected to the PCH.  This frequency is important for determining the
IP clock of internal PCH devices.

Signed-off-by: Lean Sheng Tan <lean.sheng.tan@intel.com>
Change-Id: Ib5fd3c4a648964678ee40ed0f60ca10fe7953f56
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55565
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
diff --git a/src/soc/intel/common/block/pmc/pmclib.c b/src/soc/intel/common/block/pmc/pmclib.c
index a5f2dca..64c25ff 100644
--- a/src/soc/intel/common/block/pmc/pmclib.c
+++ b/src/soc/intel/common/block/pmc/pmclib.c
@@ -2,6 +2,7 @@
 
 #include <acpi/acpi_pm.h>
 #include <arch/io.h>
+#include <assert.h>
 #include <bootmode.h>
 #include <device/mmio.h>
 #include <cbmem.h>
@@ -725,3 +726,13 @@
 		apm_control(APM_CNT_ACPI_DISABLE);
 	}
 }
+
+enum pch_pmc_xtal pmc_get_xtal_freq(void)
+{
+	if (!CONFIG(PMC_EPOC))
+		dead_code();
+
+	const uintptr_t pmcbase = soc_read_pmc_base();
+
+	return PCH_EPOC_XTAL_FREQ(read32((uint32_t *)(pmcbase + PCH_PMC_EPOC)));
+}