summaryrefslogtreecommitdiff
path: root/src/soc/intel/apollolake/spi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/intel/apollolake/spi.c')
-rw-r--r--src/soc/intel/apollolake/spi.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/soc/intel/apollolake/spi.c b/src/soc/intel/apollolake/spi.c
index 9a651ee048..fecb0cfd26 100644
--- a/src/soc/intel/apollolake/spi.c
+++ b/src/soc/intel/apollolake/spi.c
@@ -16,8 +16,36 @@
#include <console/console.h>
#include <intelblocks/fast_spi.h>
+#include <intelblocks/spi.h>
+#include <soc/pci_devs.h>
#include <spi-generic.h>
+int spi_soc_devfn_to_bus(unsigned int devfn)
+{
+ switch (devfn) {
+ case PCH_DEVFN_SPI0:
+ return 0;
+ case PCH_DEVFN_SPI1:
+ return 1;
+ case PCH_DEVFN_SPI2:
+ return 2;
+ }
+ return -1;
+}
+
+int spi_soc_bus_to_devfn(unsigned int bus)
+{
+ switch (bus) {
+ case 0:
+ return PCH_DEVFN_SPI0;
+ case 1:
+ return PCH_DEVFN_SPI1;
+ case 2:
+ return PCH_DEVFN_SPI2;
+ }
+ return -1;
+}
+
const struct spi_ctrlr_buses spi_ctrlr_bus_map[] = {
{ .ctrlr = &fast_spi_flash_ctrlr, .bus_start = 0, .bus_end = 0 },
};