summaryrefslogtreecommitdiff
path: root/src/soc/intel/common
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@chromium.org>2017-05-02 19:43:20 -0700
committerMartin Roth <martinroth@google.com>2017-05-05 23:40:51 +0200
commitf1db5fdb4d03b4766cf23e4b04a05b0fc05586a0 (patch)
treecd4d04900e1b5d3e27d4d13cdfa39297e661e2aa /src/soc/intel/common
parent35418f9814a64073550eb63a3bcb2e79021347cb (diff)
soc/intel/common: Provide common block fast_spi_flash_ctrlr
Now that we have a common block driver for fast spi flash controller, provide spi_ctrlr structure that can be used by different platforms for defining the bus-ctrlr mapping. Only cs 0 is considered valid. Change-Id: I7228ae885018d1e23e6e80dd8ce227b0d99d84a6 Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://review.coreboot.org/19575 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/intel/common')
-rw-r--r--src/soc/intel/common/block/fast_spi/fast_spi_flash.c15
-rw-r--r--src/soc/intel/common/block/include/intelblocks/fast_spi.h6
2 files changed, 21 insertions, 0 deletions
diff --git a/src/soc/intel/common/block/fast_spi/fast_spi_flash.c b/src/soc/intel/common/block/fast_spi/fast_spi_flash.c
index 3babf914b7..27a4bb7886 100644
--- a/src/soc/intel/common/block/fast_spi/fast_spi_flash.c
+++ b/src/soc/intel/common/block/fast_spi/fast_spi_flash.c
@@ -350,3 +350,18 @@ int fast_spi_flash_read_wpsr(u8 *sr)
return 0;
}
+
+static int fast_spi_flash_ctrlr_setup(const struct spi_slave *dev)
+{
+ if (dev->cs != 0) {
+ printk(BIOS_ERR, "%s: Invalid CS for fast SPI bus=0x%x,cs=0x%x!\n",
+ __func__, dev->bus, dev->cs);
+ return -1;
+ }
+
+ return 0;
+}
+
+const struct spi_ctrlr fast_spi_flash_ctrlr = {
+ .setup = fast_spi_flash_ctrlr_setup,
+};
diff --git a/src/soc/intel/common/block/include/intelblocks/fast_spi.h b/src/soc/intel/common/block/include/intelblocks/fast_spi.h
index 2b80c49837..e4bddc4e45 100644
--- a/src/soc/intel/common/block/include/intelblocks/fast_spi.h
+++ b/src/soc/intel/common/block/include/intelblocks/fast_spi.h
@@ -64,4 +64,10 @@ size_t fast_spi_get_bios_region(size_t *bios_size);
*/
void fast_spi_early_init(uintptr_t spi_base_address);
+/*
+ * Fast SPI flash controller structure to allow SoCs to define bus-controller
+ * mapping.
+ */
+extern const struct spi_ctrlr fast_spi_flash_ctrlr;
+
#endif /* SOC_INTEL_COMMON_BLOCK_FAST_SPI_H */