summaryrefslogtreecommitdiffstats
path: root/src/soc/intel/common/block/pcie
diff options
context:
space:
mode:
authorKane Chen <kane.chen@intel.corp-partner.google.com>2023-07-06 16:05:42 +0800
committerSubrata Banik <subratabanik@google.com>2023-07-18 05:31:15 +0000
commitfa77ac93c5b63ab56135436cc34d97ab60b57470 (patch)
tree85ecdb7aa1328012963e5b14b02bad006d7e886b /src/soc/intel/common/block/pcie
parentfadda4ae6b1614523e14326fbe98280ff0c19c64 (diff)
downloadcoreboot-fa77ac93c5b63ab56135436cc34d97ab60b57470.tar.gz
coreboot-fa77ac93c5b63ab56135436cc34d97ab60b57470.tar.bz2
coreboot-fa77ac93c5b63ab56135436cc34d97ab60b57470.zip
soc/intel/common/acpi: Support on/off PCIe CLK by P2SB
In the older platform such as Raptor Lake (RPL), Tiger Lake (TGL), it needs PMC IPC cmd to turn on/off the corresponding clock. Now on Meteor Lake (MTL), it control pcie clock registers on P2SB on IOE or SoC die. BUG=b:288976547, b:289461604 TEST=Test on google/screebo and found the pcie clock is on/off properly and sdcard pcie port doesn't block S0ix with RTD3 cold enabled. Change-Id: Ia729444b561daafc2dca0ed86c797eb98ce1f165 Signed-off-by: Kane Chen <kane.chen@intel.corp-partner.google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/76347 Reviewed-by: Kapil Porwal <kapilporwal@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/intel/common/block/pcie')
-rw-r--r--src/soc/intel/common/block/pcie/Kconfig16
-rw-r--r--src/soc/intel/common/block/pcie/rtd3/rtd3.c31
2 files changed, 42 insertions, 5 deletions
diff --git a/src/soc/intel/common/block/pcie/Kconfig b/src/soc/intel/common/block/pcie/Kconfig
index f65d8c16f359..dccedb0df41a 100644
--- a/src/soc/intel/common/block/pcie/Kconfig
+++ b/src/soc/intel/common/block/pcie/Kconfig
@@ -37,3 +37,19 @@ config PCIE_DEBUG_INFO
Enable debug logs in PCIe module. Allows debug information on memory
base and limit, prefetchable memory base and limit, prefetchable memory
base upper 32 bits and prefetchable memory limit upper 32 bits.
+
+config PCIE_CLOCK_CONTROL_THROUGH_P2SB
+ bool
+ default n
+ depends on SOC_INTEL_COMMON_BLOCK_PCIE_RTD3
+ help
+ Enables PCIe CLK control (on/off) through P2SB. The mechanism is supported
+ starting from MTL platform. In older platforms like ADL & TGL, PCIe CLK is
+ controlled by sending IPC CMD to PMC.
+
+config IOE_DIE_CLOCK_START
+ int
+ depends on SOC_INTEL_COMMON_BLOCK_IOE_P2SB
+ default 0
+ help
+ The beginning of IOE DIE pcie src clk number. IOE DIE is started from MTL.
diff --git a/src/soc/intel/common/block/pcie/rtd3/rtd3.c b/src/soc/intel/common/block/pcie/rtd3/rtd3.c
index 82336d94a921..abd7e466714e 100644
--- a/src/soc/intel/common/block/pcie/rtd3/rtd3.c
+++ b/src/soc/intel/common/block/pcie/rtd3/rtd3.c
@@ -28,6 +28,9 @@
/* ACPI path to the mutex that protects accesses to PMC ModPhy power gating registers */
#define RTD3_MUTEX_PATH "\\_SB.PCI0.R3MX"
+/* ACPI path to control PCIE CLK by P2SB */
+#define RTD3_PCIE_CLK_ENABLE_PATH "\\_SB.PCI0.SPCO"
+
enum modphy_pg_state {
PG_DISABLE = 0,
PG_ENABLE = 1,
@@ -121,6 +124,16 @@ static void pcie_rtd3_acpi_method_srck(unsigned int pcie_rp,
acpigen_pop_len(); /* Method */
}
+/* Method to enable/disable pcie clock by p2sb*/
+static void p2sb_acpi_set_pci_clock(u8 srcclk_pin, bool enable)
+{
+ acpigen_write_if_cond_ref_of(RTD3_PCIE_CLK_ENABLE_PATH);
+ acpigen_emit_namestring(RTD3_PCIE_CLK_ENABLE_PATH);
+ acpigen_write_integer(srcclk_pin);
+ acpigen_write_integer(enable);
+ acpigen_write_if_end();
+}
+
static void
pcie_rtd3_acpi_method_on(unsigned int pcie_rp,
const struct soc_intel_common_block_pcie_rtd3_config *config,
@@ -169,9 +182,13 @@ pcie_rtd3_acpi_method_on(unsigned int pcie_rp,
acpigen_write_sleep(config->enable_delay_ms);
}
- /* Enable SRCCLK for root port if pin is defined. */
- if (config->srcclk_pin >= 0)
- pmc_ipc_acpi_set_pci_clock(pcie_rp, config->srcclk_pin, true);
+ /* Enable SRCCLK for this root port if pin is defined. */
+ if (config->srcclk_pin >= 0) {
+ if (CONFIG(PCIE_CLOCK_CONTROL_THROUGH_P2SB))
+ p2sb_acpi_set_pci_clock(config->srcclk_pin, true);
+ else
+ pmc_ipc_acpi_set_pci_clock(pcie_rp, config->srcclk_pin, true);
+ }
/* De-assert reset GPIO to bring device out of reset. */
if (config->reset_gpio.pin_count) {
@@ -239,8 +256,12 @@ pcie_rtd3_acpi_method_off(int pcie_rp,
pcie_rtd3_enable_modphy_pg(pcie_rp, PG_ENABLE);
/* Disable SRCCLK for this root port if pin is defined. */
- if (config->srcclk_pin >= 0)
- pmc_ipc_acpi_set_pci_clock(pcie_rp, config->srcclk_pin, false);
+ if (config->srcclk_pin >= 0) {
+ if (CONFIG(PCIE_CLOCK_CONTROL_THROUGH_P2SB))
+ p2sb_acpi_set_pci_clock(config->srcclk_pin, false);
+ else
+ pmc_ipc_acpi_set_pci_clock(pcie_rp, config->srcclk_pin, false);
+ }
/* De-assert enable GPIO to turn off device power. */
if (config->enable_gpio.pin_count) {