blob: 697128aaf2a96726032741f3ba2abc6e03564c5a [file] [log] [blame]
Patrick Georgiac959032020-05-05 22:49:26 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Subrata Banik91e89c52019-11-01 18:30:01 +05302
3/*
4 * This file is created based on Intel Tiger Lake Processor PCH Datasheet
5 * Document number: 575857
6 * Chapter number: 7
7 */
8
9#include <intelblocks/spi.h>
Srinidhi N Kaushik237afda2020-11-25 01:54:35 -080010#include <intelblocks/fast_spi.h>
Subrata Banik91e89c52019-11-01 18:30:01 +053011#include <soc/pci_devs.h>
Wonkyu Kimaaec8092021-09-15 15:52:51 -070012
13#define PSF_SPI_DESTINATION_ID_H 0x23b0
14#define PSF_SPI_DESTINATION_ID 0x23a8
Subrata Banik91e89c52019-11-01 18:30:01 +053015
16int spi_soc_devfn_to_bus(unsigned int devfn)
17{
18 switch (devfn) {
19 case PCH_DEVFN_SPI:
20 return 0;
21 case PCH_DEVFN_GSPI0:
22 return 1;
23 case PCH_DEVFN_GSPI1:
24 return 2;
25 case PCH_DEVFN_GSPI2:
26 return 3;
27 }
28 return -1;
29}
Srinidhi N Kaushik237afda2020-11-25 01:54:35 -080030
Wonkyu Kimaaec8092021-09-15 15:52:51 -070031uint32_t soc_get_spi_psf_destination_id(void)
Srinidhi N Kaushik237afda2020-11-25 01:54:35 -080032{
Wonkyu Kimaaec8092021-09-15 15:52:51 -070033 if (CONFIG(SOC_INTEL_TIGERLAKE_PCH_H))
34 return PSF_SPI_DESTINATION_ID_H;
35 return PSF_SPI_DESTINATION_ID;
Srinidhi N Kaushik237afda2020-11-25 01:54:35 -080036}