From bae84984860853f67d36b775c39171845be74b8b Mon Sep 17 00:00:00 2001 From: Werner Zeh Date: Thu, 5 May 2022 11:04:04 +0200 Subject: soc/intel/cmn/spi: Separate fast SPI device from generic SPI driver The fast SPI controller (usually handling the boot NOR flash) is a different controller type than the generic SPI controllers as it provides access to the boot flash and usually is not used for generic SPI slave connections. Though there is common code for the fast SPI controller it currently do not uses the PCI driver structure. This patch adds the PCI driver envelope to the fast SPI driver and moves Apollo Lake as the first platform to this driver. Change-Id: I31bf39ec1c622db887dec9ca8623a7f282402849 Signed-off-by: Werner Zeh Reviewed-on: https://review.coreboot.org/c/coreboot/+/64075 Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik Reviewed-by: Angel Pons --- src/soc/intel/common/block/fast_spi/fast_spi.c | 19 +++++++++++++++++++ src/soc/intel/common/block/spi/spi.c | 1 - 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'src/soc/intel') diff --git a/src/soc/intel/common/block/fast_spi/fast_spi.c b/src/soc/intel/common/block/fast_spi/fast_spi.c index 63fb68c2f7..9788493e1e 100644 --- a/src/soc/intel/common/block/fast_spi/fast_spi.c +++ b/src/soc/intel/common/block/fast_spi/fast_spi.c @@ -5,7 +5,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -453,3 +455,20 @@ void fast_spi_clear_outstanding_status(void) /* Make sure all W1C status bits get cleared. */ write32(spibar + SPIBAR_HSFSTS_CTL, SPIBAR_HSFSTS_W1C_BITS); } + +static struct device_operations fast_spi_dev_ops = { + .read_resources = pci_dev_read_resources, + .set_resources = pci_dev_set_resources, + .enable_resources = pci_dev_enable_resources, +}; + +static const unsigned short pci_device_ids[] = { + PCI_DID_INTEL_APL_HWSEQ_SPI, + 0 +}; + +static const struct pci_driver fast_spi __pci_driver = { + .ops = &fast_spi_dev_ops, + .vendor = PCI_VID_INTEL, + .devices = pci_device_ids, +}; diff --git a/src/soc/intel/common/block/spi/spi.c b/src/soc/intel/common/block/spi/spi.c index 0716e1ae90..256e01a342 100644 --- a/src/soc/intel/common/block/spi/spi.c +++ b/src/soc/intel/common/block/spi/spi.c @@ -130,7 +130,6 @@ static const unsigned short pci_device_ids[] = { PCI_DID_INTEL_APL_SPI0, PCI_DID_INTEL_APL_SPI1, PCI_DID_INTEL_APL_SPI2, - PCI_DID_INTEL_APL_HWSEQ_SPI, PCI_DID_INTEL_GLK_SPI0, PCI_DID_INTEL_GLK_SPI1, PCI_DID_INTEL_GLK_SPI2, -- cgit v1.2.3