From c0ec28642fea41b799d0d5e931ff896beebd325b Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Tue, 7 Nov 2017 17:48:35 +0530 Subject: soc/intel/apollolake: Add support for SPI device Provide a translation table to convert SPI device structure into SPI bus number and vice versa. Change-Id: I4c8b23c7d6f289927cd7545f3875ee4352603afa Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/22363 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh Reviewed-by: Aaron Durbin --- src/soc/intel/apollolake/spi.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) 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 #include +#include +#include #include +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 }, }; -- cgit v1.2.3