diff options
author | Subrata Banik <subrata.banik@intel.com> | 2017-11-09 12:16:36 +0530 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2017-11-11 18:19:31 +0000 |
commit | 09564fce556558dfe9c14dd756513545ffeb1914 (patch) | |
tree | d1efa710c16026bc310115b7a70d2b1d2cdf3be5 | |
parent | 6c4b5916fcd4844410a709320ab7bf5a06a45596 (diff) | |
download | coreboot-09564fce556558dfe9c14dd756513545ffeb1914.tar.xz |
soc/intel/{cannonlake,skylake}: Add _soc_ prefix in spi soc routine
This ensures that function callback into the SoC code.
Change-Id: Idc16d315ba25d17a2ab537fcdf0c2b51c8802a67
Signed-off-by: Subrata Banik <subrata.banik@intel.com>
Reviewed-on: https://review.coreboot.org/22392
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r-- | src/soc/intel/cannonlake/gspi.c | 3 | ||||
-rw-r--r-- | src/soc/intel/cannonlake/include/soc/pci_devs.h | 22 | ||||
-rw-r--r-- | src/soc/intel/cannonlake/spi.c | 33 | ||||
-rw-r--r-- | src/soc/intel/skylake/gspi.c | 3 | ||||
-rw-r--r-- | src/soc/intel/skylake/include/soc/pci_devs.h | 20 | ||||
-rw-r--r-- | src/soc/intel/skylake/spi.c | 29 |
6 files changed, 64 insertions, 46 deletions
diff --git a/src/soc/intel/cannonlake/gspi.c b/src/soc/intel/cannonlake/gspi.c index a1ebfba162..e4f682db42 100644 --- a/src/soc/intel/cannonlake/gspi.c +++ b/src/soc/intel/cannonlake/gspi.c @@ -17,6 +17,7 @@ #include <assert.h> #include <device/device.h> #include <intelblocks/gspi.h> +#include <intelblocks/spi.h> #include <soc/iomap.h> #include <soc/pci_devs.h> #include "chip.h" @@ -67,5 +68,5 @@ int gspi_soc_bus_to_devfn(unsigned int gspi_bus) if (gspi_bus >= CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX) return -1; - return spi_bus_to_devfn(GSPI_TO_SPI_BUS(gspi_bus)); + return spi_soc_bus_to_devfn(GSPI_TO_SPI_BUS(gspi_bus)); } diff --git a/src/soc/intel/cannonlake/include/soc/pci_devs.h b/src/soc/intel/cannonlake/include/soc/pci_devs.h index 285fbd68e5..4d677debe0 100644 --- a/src/soc/intel/cannonlake/include/soc/pci_devs.h +++ b/src/soc/intel/cannonlake/include/soc/pci_devs.h @@ -175,26 +175,4 @@ #define PCH_DEV_GBE _PCH_DEV(LPC, 6) #define PCH_DEV_TRACEHUB _PCH_DEV(LPC, 7) -static inline int spi_devfn_to_bus(unsigned int devfn) -{ - switch (devfn) { - case PCH_DEVFN_SPI: return 0; - case PCH_DEVFN_GSPI0: return 1; - case PCH_DEVFN_GSPI1: return 2; - case PCH_DEVFN_GSPI2: return 3; - } - return -1; -} - -static inline int spi_bus_to_devfn(unsigned int bus) -{ - switch (bus) { - case 0: return PCH_DEVFN_SPI; - case 1: return PCH_DEVFN_GSPI0; - case 2: return PCH_DEVFN_GSPI1; - case 3: return PCH_DEVFN_GSPI2; - } - return -1; -} - #endif diff --git a/src/soc/intel/cannonlake/spi.c b/src/soc/intel/cannonlake/spi.c index 1d65dee31a..a86f760ec8 100644 --- a/src/soc/intel/cannonlake/spi.c +++ b/src/soc/intel/cannonlake/spi.c @@ -22,10 +22,41 @@ #include <device/spi.h> #include <intelblocks/fast_spi.h> #include <intelblocks/gspi.h> +#include <intelblocks/spi.h> #include <soc/ramstage.h> #include <soc/pci_devs.h> #include <spi-generic.h> +int spi_soc_devfn_to_bus(unsigned int devfn) +{ + switch (devfn) { + case PCH_DEVFN_SPI: + return 0; + case PCH_DEVFN_GSPI0: + return 1; + case PCH_DEVFN_GSPI1: + return 2; + case PCH_DEVFN_GSPI2: + return 3; + } + return -1; +} + +int spi_soc_bus_to_devfn(unsigned int bus) +{ + switch (bus) { + case 0: + return PCH_DEVFN_SPI; + case 1: + return PCH_DEVFN_GSPI0; + case 2: + return PCH_DEVFN_GSPI1; + case 3: + return PCH_DEVFN_GSPI2; + } + return -1; +} + const struct spi_ctrlr_buses spi_ctrlr_bus_map[] = { { .ctrlr = &fast_spi_flash_ctrlr, .bus_start = 0, .bus_end = 0 }, #if !ENV_SMM @@ -40,7 +71,7 @@ const size_t spi_ctrlr_bus_map_count = ARRAY_SIZE(spi_ctrlr_bus_map); static int spi_dev_to_bus(struct device *dev) { - return spi_devfn_to_bus(dev->path.pci.devfn); + return spi_soc_devfn_to_bus(dev->path.pci.devfn); } static struct spi_bus_operations spi_bus_ops = { diff --git a/src/soc/intel/skylake/gspi.c b/src/soc/intel/skylake/gspi.c index eef5433826..252be7771c 100644 --- a/src/soc/intel/skylake/gspi.c +++ b/src/soc/intel/skylake/gspi.c @@ -17,6 +17,7 @@ #include <assert.h> #include <device/device.h> #include <intelblocks/gspi.h> +#include <intelblocks/spi.h> #include <soc/iomap.h> #include "chip.h" @@ -66,5 +67,5 @@ int gspi_soc_bus_to_devfn(unsigned int gspi_bus) if (gspi_bus >= CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX) return -1; - return spi_bus_to_devfn(GSPI_TO_SPI_BUS(gspi_bus)); + return spi_soc_bus_to_devfn(GSPI_TO_SPI_BUS(gspi_bus)); } diff --git a/src/soc/intel/skylake/include/soc/pci_devs.h b/src/soc/intel/skylake/include/soc/pci_devs.h index c8a5e47f83..28f2f391af 100644 --- a/src/soc/intel/skylake/include/soc/pci_devs.h +++ b/src/soc/intel/skylake/include/soc/pci_devs.h @@ -160,24 +160,4 @@ #define PCH_DEV_GBE _PCH_DEV(LPC, 6) #define PCH_DEV_TRACEHUB _PCH_DEV(LPC, 7) -static inline int spi_devfn_to_bus(unsigned int devfn) -{ - switch (devfn) { - case PCH_DEVFN_SPI: return 0; - case PCH_DEVFN_GSPI0: return 1; - case PCH_DEVFN_GSPI1: return 2; - } - return -1; -} - -static inline int spi_bus_to_devfn(unsigned int bus) -{ - switch (bus) { - case 0: return PCH_DEVFN_SPI; - case 1: return PCH_DEVFN_GSPI0; - case 2: return PCH_DEVFN_GSPI1; - } - return -1; -} - #endif diff --git a/src/soc/intel/skylake/spi.c b/src/soc/intel/skylake/spi.c index e575e6e265..de0ff1317b 100644 --- a/src/soc/intel/skylake/spi.c +++ b/src/soc/intel/skylake/spi.c @@ -22,9 +22,36 @@ #include <device/spi.h> #include <intelblocks/fast_spi.h> #include <intelblocks/gspi.h> +#include <intelblocks/spi.h> #include <soc/ramstage.h> #include <spi-generic.h> +int spi_soc_devfn_to_bus(unsigned int devfn) +{ + switch (devfn) { + case PCH_DEVFN_SPI: + return 0; + case PCH_DEVFN_GSPI0: + return 1; + case PCH_DEVFN_GSPI1: + return 2; + } + return -1; +} + +int spi_soc_bus_to_devfn(unsigned int bus) +{ + switch (bus) { + case 0: + return PCH_DEVFN_SPI; + case 1: + return PCH_DEVFN_GSPI0; + case 2: + return PCH_DEVFN_GSPI1; + } + return -1; +} + const struct spi_ctrlr_buses spi_ctrlr_bus_map[] = { { .ctrlr = &fast_spi_flash_ctrlr, .bus_start = 0, .bus_end = 0 }, #if !ENV_SMM @@ -39,7 +66,7 @@ const size_t spi_ctrlr_bus_map_count = ARRAY_SIZE(spi_ctrlr_bus_map); static int spi_dev_to_bus(struct device *dev) { - return spi_devfn_to_bus(dev->path.pci.devfn); + return spi_soc_devfn_to_bus(dev->path.pci.devfn); } static struct spi_bus_operations spi_bus_ops = { |