Subrata Banik has uploaded this change for review. ( https://review.coreboot.org/22363
Change subject: soc/intel/apollolake: Add support for SPI device ......................................................................
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 subrata.banik@intel.com --- M src/soc/intel/apollolake/include/soc/pci_devs.h 1 file changed, 20 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/63/22363/1
diff --git a/src/soc/intel/apollolake/include/soc/pci_devs.h b/src/soc/intel/apollolake/include/soc/pci_devs.h index 6aa2520..3b36292 100644 --- a/src/soc/intel/apollolake/include/soc/pci_devs.h +++ b/src/soc/intel/apollolake/include/soc/pci_devs.h @@ -158,4 +158,24 @@ #define PCH_DEV_LPC _PCH_DEV(LPC, 0) #define PCH_DEV_SMBUS _PCH_DEV(LPC, 1)
+static inline int spi_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; +} + +static inline int spi_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; +} + #endif