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>
Reviewed-on: https://review.coreboot.org/22363
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Subrata Banik 2017-11-07 17:48:35 +05:30 committed by Aaron Durbin
parent 5a283ef65c
commit c0ec28642f
1 changed files with 28 additions and 0 deletions

View File

@ -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 },
};