summaryrefslogtreecommitdiffstats
path: root/src/soc/intel/common/block/fast_spi/fast_spi.c
diff options
context:
space:
mode:
authorWerner Zeh <werner.zeh@siemens.com>2022-05-05 11:04:04 +0200
committerFelix Held <felix-coreboot@felixheld.de>2022-05-16 13:07:52 +0000
commitbae84984860853f67d36b775c39171845be74b8b (patch)
treefa44ec7e40ee075d9758c804d3b963525ab182ea /src/soc/intel/common/block/fast_spi/fast_spi.c
parent8da3804430c1ac8a3187fb982f0718583b0b3ed4 (diff)
downloadcoreboot-bae84984860853f67d36b775c39171845be74b8b.tar.gz
coreboot-bae84984860853f67d36b775c39171845be74b8b.tar.bz2
coreboot-bae84984860853f67d36b775c39171845be74b8b.zip
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 <werner.zeh@siemens.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/64075 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Subrata Banik <subratabanik@google.com> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Diffstat (limited to 'src/soc/intel/common/block/fast_spi/fast_spi.c')
-rw-r--r--src/soc/intel/common/block/fast_spi/fast_spi.c19
1 files changed, 19 insertions, 0 deletions
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 63fb68c2f73b..9788493e1e2c 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 <arch/romstage.h>
#include <device/mmio.h>
#include <assert.h>
+#include <device/pci.h>
#include <device/pci_def.h>
+#include <device/pci_ids.h>
#include <device/pci_ops.h>
#include <console/console.h>
#include <commonlib/helpers.h>
@@ -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,
+};