From 8ecff12528a33eb2388fd39bc84b4bdc6d9894e5 Mon Sep 17 00:00:00 2001 From: Jeremy Compostella Date: Wed, 25 Feb 2026 11:00:08 -0800 Subject: [PATCH] soc/intel/alderlake: 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=4 - Adds CONFIG_SOC_INTEL_SPI_PSF_DESTINATION_ID=0x23a8 - Removes src/soc/intel/alderlake/spi.c - Updates Makefile.mk to remove spi.c compilation The common code uses SOC_GSPI_DEVFN(n) macro directly. Change-Id: I346e6c6cbe95c8608009e5f9fc53dbcff5edba4e Signed-off-by: Jeremy Compostella Reviewed-on: https://review.coreboot.org/c/coreboot/+/91326 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) --- src/soc/intel/alderlake/Kconfig | 10 +++++++++ src/soc/intel/alderlake/Makefile.mk | 1 - src/soc/intel/alderlake/spi.c | 33 ----------------------------- 3 files changed, 10 insertions(+), 34 deletions(-) delete mode 100644 src/soc/intel/alderlake/spi.c diff --git a/src/soc/intel/alderlake/Kconfig b/src/soc/intel/alderlake/Kconfig index 4ab0b1c820..52c3d84dca 100644 --- a/src/soc/intel/alderlake/Kconfig +++ b/src/soc/intel/alderlake/Kconfig @@ -86,6 +86,8 @@ config SOC_INTEL_ALDERLAKE 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 @@ -574,4 +576,12 @@ config SOC_INTEL_COMMON_BLOCK_ACPI_SLP_S0_FREQ_HZ help slp_s0_residency granularity in 122us ticks (i.e. ~8.2KHz). +config SOC_INTEL_SPI_DEV_MAX + int + default 4 + +config SOC_INTEL_SPI_PSF_DESTINATION_ID + hex + default 0x23a8 + endif diff --git a/src/soc/intel/alderlake/Makefile.mk b/src/soc/intel/alderlake/Makefile.mk index 35f84a5cb4..f287e91322 100644 --- a/src/soc/intel/alderlake/Makefile.mk +++ b/src/soc/intel/alderlake/Makefile.mk @@ -6,7 +6,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/alderlake/spi.c b/src/soc/intel/alderlake/spi.c deleted file mode 100644 index 1149425101..0000000000 --- a/src/soc/intel/alderlake/spi.c +++ /dev/null @@ -1,33 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ - -/* - * This file is created based on Intel Alder Lake Processor PCH Datasheet - * Document number: 621483 - * Chapter number: 7 - */ - -#include -#include -#include - -#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; - case PCH_DEVFN_GSPI3: - return 4; - } - return -1; -} - -uint32_t soc_get_spi_psf_destination_id(void) -{ - return PSF_SPI_DESTINATION_ID; -}