blob: 47b3b33ce2d43f8c73b0c915dc705bbc004dd339 [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
Srinidhi N Kaushik237afda2020-11-25 01:54:35 -08009#include <intelblocks/fast_spi.h>
Elyes Haouascbbbb6c2022-10-22 22:15:27 +020010#include <intelblocks/spi.h>
Subrata Banik91e89c52019-11-01 18:30:01 +053011#include <soc/pci_devs.h>
Elyes Haouascbbbb6c2022-10-22 22:15:27 +020012#include <stdint.h>
Wonkyu Kimaaec8092021-09-15 15:52:51 -070013
14#define PSF_SPI_DESTINATION_ID_H 0x23b0
15#define PSF_SPI_DESTINATION_ID 0x23a8
Subrata Banik91e89c52019-11-01 18:30:01 +053016
17int spi_soc_devfn_to_bus(unsigned int devfn)
18{
19 switch (devfn) {
Subrata Banik91e89c52019-11-01 18:30:01 +053020 case PCH_DEVFN_GSPI0:
21 return 1;
22 case PCH_DEVFN_GSPI1:
23 return 2;
24 case PCH_DEVFN_GSPI2:
25 return 3;
26 }
27 return -1;
28}
Srinidhi N Kaushik237afda2020-11-25 01:54:35 -080029
Wonkyu Kimaaec8092021-09-15 15:52:51 -070030uint32_t soc_get_spi_psf_destination_id(void)
Srinidhi N Kaushik237afda2020-11-25 01:54:35 -080031{
Wonkyu Kimaaec8092021-09-15 15:52:51 -070032 if (CONFIG(SOC_INTEL_TIGERLAKE_PCH_H))
33 return PSF_SPI_DESTINATION_ID_H;
34 return PSF_SPI_DESTINATION_ID;
Srinidhi N Kaushik237afda2020-11-25 01:54:35 -080035}