Patrick Georgi | ac95903 | 2020-05-05 22:49:26 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Subrata Banik | 91e89c5 | 2019-11-01 18:30:01 +0530 | [diff] [blame] | 2 | |
| 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 Kaushik | 237afda | 2020-11-25 01:54:35 -0800 | [diff] [blame] | 10 | #include <intelblocks/fast_spi.h> |
Subrata Banik | 91e89c5 | 2019-11-01 18:30:01 +0530 | [diff] [blame] | 11 | #include <soc/pci_devs.h> |
Wonkyu Kim | aaec809 | 2021-09-15 15:52:51 -0700 | [diff] [blame] | 12 | |
| 13 | #define PSF_SPI_DESTINATION_ID_H 0x23b0 |
| 14 | #define PSF_SPI_DESTINATION_ID 0x23a8 |
Subrata Banik | 91e89c5 | 2019-11-01 18:30:01 +0530 | [diff] [blame] | 15 | |
| 16 | int 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 Kaushik | 237afda | 2020-11-25 01:54:35 -0800 | [diff] [blame] | 30 | |
Wonkyu Kim | aaec809 | 2021-09-15 15:52:51 -0700 | [diff] [blame] | 31 | uint32_t soc_get_spi_psf_destination_id(void) |
Srinidhi N Kaushik | 237afda | 2020-11-25 01:54:35 -0800 | [diff] [blame] | 32 | { |
Wonkyu Kim | aaec809 | 2021-09-15 15:52:51 -0700 | [diff] [blame] | 33 | if (CONFIG(SOC_INTEL_TIGERLAKE_PCH_H)) |
| 34 | return PSF_SPI_DESTINATION_ID_H; |
| 35 | return PSF_SPI_DESTINATION_ID; |
Srinidhi N Kaushik | 237afda | 2020-11-25 01:54:35 -0800 | [diff] [blame] | 36 | } |