From 0aea05411dda6441a1a050012c63acea3fa63e21 Mon Sep 17 00:00:00 2001 From: Jeremy Compostella Date: Wed, 25 Feb 2026 11:00:07 -0800 Subject: [PATCH] soc/intel/tigerlake: Use common SPI device function driver Switch to the common SPI device function driver implementation. This eliminates platform-specific SPI code by leveraging the common driver with platform-specific Kconfig and macros. This commit: - Selects SOC_INTEL_COMMON_FEATURE_SPI_DEVFN and SOC_INTEL_COMMON_FEATURE_SPI_DEVFN_PSF in Kconfig - Adds CONFIG_SOC_INTEL_SPI_DEV_MAX=3 - Adds CONFIG_SOC_INTEL_SPI_PSF_DESTINATION_ID (0x23b0 for PCH-H, 0x23a8 default) - Removes src/soc/intel/tigerlake/spi.c - Updates Makefile.mk to remove spi.c compilation The common code uses SOC_GSPI_DEVFN(n) macro directly. Change-Id: Ib195ffcc0d46f7e95eba2d0a2c66fbcdcca615a2 Signed-off-by: Jeremy Compostella Reviewed-on: https://review.coreboot.org/c/coreboot/+/91325 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/soc/intel/tigerlake/Kconfig | 11 +++++++++ src/soc/intel/tigerlake/Makefile.mk | 1 - src/soc/intel/tigerlake/spi.c | 35 ----------------------------- 3 files changed, 11 insertions(+), 36 deletions(-) delete mode 100644 src/soc/intel/tigerlake/spi.c diff --git a/src/soc/intel/tigerlake/Kconfig b/src/soc/intel/tigerlake/Kconfig index 38c1e8125c..5168546661 100644 --- a/src/soc/intel/tigerlake/Kconfig +++ b/src/soc/intel/tigerlake/Kconfig @@ -74,6 +74,8 @@ config SOC_INTEL_TIGERLAKE select SOC_INTEL_COMMON_BLOCK_XHCI_ELOG select SOC_INTEL_COMMON_FEATURE select SOC_INTEL_COMMON_FEATURE_GSPI_DEVFN + select SOC_INTEL_COMMON_FEATURE_SPI_DEVFN + select SOC_INTEL_COMMON_FEATURE_SPI_DEVFN_PSF select SOC_INTEL_COMMON_FEATURE_I2C_DEVFN select SOC_INTEL_COMMON_FEATURE_UART_DEVICES select SOC_INTEL_COMMON_FSP_RESET @@ -304,4 +306,13 @@ config INTEL_GMA_BCLM_OFFSET config INTEL_GMA_BCLM_WIDTH default 32 +config SOC_INTEL_SPI_DEV_MAX + int + default 3 + +config SOC_INTEL_SPI_PSF_DESTINATION_ID + hex + default 0x23b0 if SOC_INTEL_TIGERLAKE_PCH_H + default 0x23a8 + endif diff --git a/src/soc/intel/tigerlake/Makefile.mk b/src/soc/intel/tigerlake/Makefile.mk index 895395d362..074f172d38 100644 --- a/src/soc/intel/tigerlake/Makefile.mk +++ b/src/soc/intel/tigerlake/Makefile.mk @@ -7,7 +7,6 @@ subdirs-y += ../../../cpu/intel/turbo # all (bootblock, verstage, romstage, postcar, ramstage) all-y += pmutil.c -all-y += spi.c bootblock-y += bootblock/bootblock.c bootblock-y += bootblock/pch.c diff --git a/src/soc/intel/tigerlake/spi.c b/src/soc/intel/tigerlake/spi.c deleted file mode 100644 index 47b3b33ce2..0000000000 --- a/src/soc/intel/tigerlake/spi.c +++ /dev/null @@ -1,35 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ - -/* - * This file is created based on Intel Tiger Lake Processor PCH Datasheet - * Document number: 575857 - * Chapter number: 7 - */ - -#include -#include -#include -#include - -#define PSF_SPI_DESTINATION_ID_H 0x23b0 -#define PSF_SPI_DESTINATION_ID 0x23a8 - -int spi_soc_devfn_to_bus(unsigned int devfn) -{ - switch (devfn) { - case PCH_DEVFN_GSPI0: - return 1; - case PCH_DEVFN_GSPI1: - return 2; - case PCH_DEVFN_GSPI2: - return 3; - } - return -1; -} - -uint32_t soc_get_spi_psf_destination_id(void) -{ - if (CONFIG(SOC_INTEL_TIGERLAKE_PCH_H)) - return PSF_SPI_DESTINATION_ID_H; - return PSF_SPI_DESTINATION_ID; -}