Patrick Georgi | ac95903 | 2020-05-05 22:49:26 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 2 | |
| 3 | #ifndef _SOC_APOLLOLAKE_CHIP_H_ |
| 4 | #define _SOC_APOLLOLAKE_CHIP_H_ |
| 5 | |
Pratik Prajapati | ff3162b | 2017-12-07 10:46:09 -0800 | [diff] [blame] | 6 | #include <commonlib/helpers.h> |
Michael Niewöhner | 97e21d3 | 2020-12-28 00:49:33 +0100 | [diff] [blame] | 7 | #include <drivers/intel/gma/gma.h> |
Kyösti Mälkki | 32d47eb | 2019-09-28 00:00:30 +0300 | [diff] [blame] | 8 | #include <intelblocks/cfg.h> |
Ravi Sarawadi | 3669a06 | 2018-02-27 13:23:42 -0800 | [diff] [blame] | 9 | #include <intelblocks/gspi.h> |
Dinesh Gehlot | 58cc96f | 2023-01-17 04:01:13 +0000 | [diff] [blame] | 10 | #include <gpio.h> |
Furquan Shaikh | 6e37e90 | 2016-07-28 13:44:53 -0700 | [diff] [blame] | 11 | #include <soc/gpe.h> |
Ravi Sarawadi | efa606b | 2017-08-04 16:26:09 -0700 | [diff] [blame] | 12 | #include <intelblocks/lpc_lib.h> |
Sumeet R Pawnikar | 2adb50d | 2020-05-09 15:37:09 +0530 | [diff] [blame] | 13 | #include <intelblocks/power_limit.h> |
Nico Huber | 0f2dd1e | 2017-08-01 14:02:40 +0200 | [diff] [blame] | 14 | #include <device/i2c_simple.h> |
Chris Ching | b8dc63b | 2017-12-06 14:26:15 -0700 | [diff] [blame] | 15 | #include <drivers/i2c/designware/dw_i2c.h> |
Shaunak Saha | 5b6c5a5 | 2016-06-07 02:06:28 -0700 | [diff] [blame] | 16 | #include <soc/pm.h> |
Kane Chen | 9d490da | 2017-01-11 12:53:58 +0800 | [diff] [blame] | 17 | #include <soc/usb.h> |
Duncan Laurie | ff8bce0 | 2016-06-27 10:57:13 -0700 | [diff] [blame] | 18 | |
Furquan Shaikh | 6d5e10c | 2018-03-14 19:57:16 -0700 | [diff] [blame] | 19 | #define MAX_PCIE_PORTS 6 |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 20 | #define CLKREQ_DISABLED 0xf |
Duncan Laurie | ff8bce0 | 2016-06-27 10:57:13 -0700 | [diff] [blame] | 21 | |
Divya Chellap | 0b15b70 | 2017-11-29 18:53:03 +0530 | [diff] [blame] | 22 | enum pnp_settings { |
| 23 | PNP_PERF, |
| 24 | PNP_POWER, |
| 25 | PNP_PERF_POWER, |
| 26 | }; |
| 27 | |
Mario Scheithauer | f165bbdc | 2023-05-22 14:44:27 +0200 | [diff] [blame] | 28 | enum sata_speed_limit { |
| 29 | SATA_DEFAULT = 0, |
| 30 | SATA_GEN1, |
| 31 | SATA_GEN2, |
| 32 | SATA_GEN3 |
| 33 | }; |
| 34 | |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 35 | struct soc_intel_apollolake_config { |
Subrata Banik | c4986eb | 2018-05-09 14:55:09 +0530 | [diff] [blame] | 36 | |
| 37 | /* Common structure containing soc config data required by common code*/ |
| 38 | struct soc_intel_common_config common_soc_config; |
Ravi Sarawadi | 3669a06 | 2018-02-27 13:23:42 -0800 | [diff] [blame] | 39 | |
Sumeet R Pawnikar | 2adb50d | 2020-05-09 15:37:09 +0530 | [diff] [blame] | 40 | /* Common struct containing power limits configuration info */ |
| 41 | struct soc_power_limits_config power_limits_config; |
| 42 | |
Michael Niewöhner | 97e21d3 | 2020-12-28 00:49:33 +0100 | [diff] [blame] | 43 | /* |
| 44 | * IGD panel configuration |
| 45 | * |
| 46 | * Second backlight control shares logic with other pins (aka. display utility pin). |
| 47 | * Be sure it's used for PWM before setting any secondary backlight value. |
| 48 | */ |
| 49 | struct i915_gpu_panel_config panel_cfg[2]; |
Nico Huber | 2a16331 | 2020-01-06 17:42:45 +0100 | [diff] [blame] | 50 | |
Matt DeVillier | d7ef450 | 2020-04-21 01:23:10 -0500 | [diff] [blame] | 51 | /* i915 struct for GMA backlight control */ |
| 52 | struct i915_gpu_controller_info gfx; |
| 53 | |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 54 | /* |
| 55 | * Mapping from PCIe root port to CLKREQ input on the SOC. The SOC has |
| 56 | * four CLKREQ inputs, but six root ports. Root ports without an |
| 57 | * associated CLKREQ signal must be marked with "CLKREQ_DISABLED" |
| 58 | */ |
Furquan Shaikh | 6d5e10c | 2018-03-14 19:57:16 -0700 | [diff] [blame] | 59 | uint8_t pcie_rp_clkreq_pin[MAX_PCIE_PORTS]; |
Alexandru Gagniuc | 3aa34a8 | 2016-04-04 10:47:49 -0700 | [diff] [blame] | 60 | |
Furquan Shaikh | 2cfc862 | 2018-03-14 21:43:04 -0700 | [diff] [blame] | 61 | /* Enable/disable hot-plug for root ports (0 = disable, 1 = enable). */ |
| 62 | uint8_t pcie_rp_hotplug_enable[MAX_PCIE_PORTS]; |
| 63 | |
Shamile Khan | c4276a3 | 2018-03-14 18:09:19 -0700 | [diff] [blame] | 64 | /* De-emphasis enable configuration for each PCIe root port */ |
| 65 | uint8_t pcie_rp_deemphasis_enable[MAX_PCIE_PORTS]; |
| 66 | |
Zhao, Lijian | 1b8ee0b | 2016-05-17 19:01:34 -0700 | [diff] [blame] | 67 | /* [14:8] DDR mode Number of dealy elements.Each = 125pSec. |
| 68 | * [6:0] SDR mode Number of dealy elements.Each = 125pSec. |
| 69 | */ |
| 70 | uint32_t emmc_tx_cmd_cntl; |
| 71 | |
| 72 | /* [14:8] HS400 mode Number of dealy elements.Each = 125pSec. |
| 73 | * [6:0] SDR104/HS200 mode Number of dealy elements.Each = 125pSec. |
| 74 | */ |
| 75 | uint32_t emmc_tx_data_cntl1; |
| 76 | |
| 77 | /* [30:24] SDR50 mode Number of dealy elements.Each = 125pSec. |
| 78 | * [22:16] DDR50 mode Number of dealy elements.Each = 125pSec. |
| 79 | * [14:8] SDR25/HS50 mode Number of dealy elements.Each = 125pSec. |
Lee Leahy | 07441b5 | 2017-03-09 10:59:25 -0800 | [diff] [blame] | 80 | * [6:0] SDR12/Compatibility mode Number of dealy elements. |
| 81 | * Each = 125pSec. |
Zhao, Lijian | 1b8ee0b | 2016-05-17 19:01:34 -0700 | [diff] [blame] | 82 | */ |
| 83 | uint32_t emmc_tx_data_cntl2; |
| 84 | |
| 85 | /* [30:24] SDR50 mode Number of dealy elements.Each = 125pSec. |
| 86 | * [22:16] DDR50 mode Number of dealy elements.Each = 125pSec. |
| 87 | * [14:8] SDR25/HS50 mode Number of dealy elements.Each = 125pSec. |
Lee Leahy | 07441b5 | 2017-03-09 10:59:25 -0800 | [diff] [blame] | 88 | * [6:0] SDR12/Compatibility mode Number of dealy elements. |
| 89 | * Each = 125pSec. |
Zhao, Lijian | 1b8ee0b | 2016-05-17 19:01:34 -0700 | [diff] [blame] | 90 | */ |
| 91 | uint32_t emmc_rx_cmd_data_cntl1; |
| 92 | |
| 93 | /* [14:8] HS400 mode 1 Number of dealy elements.Each = 125pSec. |
| 94 | * [6:0] HS400 mode 2 Number of dealy elements.Each = 125pSec. |
| 95 | */ |
| 96 | uint32_t emmc_rx_strobe_cntl; |
| 97 | |
| 98 | /* [13:8] Auto Tuning mode Number of dealy elements.Each = 125pSec. |
| 99 | * [6:0] SDR104/HS200 Number of dealy elements.Each = 125pSec. |
| 100 | */ |
| 101 | uint32_t emmc_rx_cmd_data_cntl2; |
| 102 | |
Mario Scheithauer | 9116eb6 | 2018-08-23 11:39:19 +0200 | [diff] [blame] | 103 | /* Select the eMMC max speed allowed. */ |
| 104 | uint8_t emmc_host_max_speed; |
| 105 | |
Sean Rhodes | de198bb | 2022-05-19 15:34:35 +0100 | [diff] [blame] | 106 | /* Sata Ports Hot Plug */ |
| 107 | uint8_t SataPortsHotPlug[2]; |
| 108 | |
Sean Rhodes | 5777995 | 2022-05-19 15:35:31 +0100 | [diff] [blame] | 109 | /* Sata Ports Enable */ |
Mario Scheithauer | 7e5b28f | 2023-05-31 14:36:22 +0200 | [diff] [blame^] | 110 | uint8_t sata_ports_enable[2]; |
Sean Rhodes | 5777995 | 2022-05-19 15:35:31 +0100 | [diff] [blame] | 111 | |
Mario Scheithauer | c8dc2c1 | 2023-05-22 15:27:36 +0200 | [diff] [blame] | 112 | /* Sata Ports Solid State Drive */ |
| 113 | uint8_t sata_ports_ssd[2]; |
| 114 | |
Mario Scheithauer | 841416f | 2017-09-18 17:08:48 +0200 | [diff] [blame] | 115 | /* Specifies on which IRQ the SCI will internally appear. */ |
| 116 | uint8_t sci_irq; |
| 117 | |
Alexandru Gagniuc | 3aa34a8 | 2016-04-04 10:47:49 -0700 | [diff] [blame] | 118 | /* Configure serial IRQ (SERIRQ) line. */ |
| 119 | enum serirq_mode serirq_mode; |
Hannah Williams | 483004f | 2016-03-28 14:45:59 -0700 | [diff] [blame] | 120 | |
Shaunak Saha | 5b6c5a5 | 2016-06-07 02:06:28 -0700 | [diff] [blame] | 121 | uint8_t gpe0_dw1; /* GPE0_63_32 STS/EN */ |
| 122 | uint8_t gpe0_dw2; /* GPE0_95_64 STS/EN */ |
| 123 | uint8_t gpe0_dw3; /* GPE0_127_96 STS/EN */ |
Saurabh Satija | e46dbcc | 2016-05-03 15:15:31 -0700 | [diff] [blame] | 124 | |
Sean Rhodes | 2d58d5c | 2022-01-19 08:13:38 +0000 | [diff] [blame] | 125 | /* LPC fixed enables and ranges */ |
| 126 | uint16_t lpc_iod; |
| 127 | uint16_t lpc_ioe; |
| 128 | |
Sean Rhodes | 7a82a80 | 2022-06-02 11:28:43 +0100 | [diff] [blame] | 129 | /* Generic IO decode ranges */ |
| 130 | uint32_t gen1_dec; |
| 131 | uint32_t gen2_dec; |
| 132 | uint32_t gen3_dec; |
| 133 | uint32_t gen4_dec; |
| 134 | |
Saurabh Satija | e46dbcc | 2016-05-03 15:15:31 -0700 | [diff] [blame] | 135 | /* Configure LPSS S0ix Enable */ |
| 136 | uint8_t lpss_s0ix_enable; |
Shaunak Saha | cd9e1e4 | 2016-07-12 01:22:33 -0700 | [diff] [blame] | 137 | |
| 138 | /* Enable DPTF support */ |
| 139 | int dptf_enable; |
Aaron Durbin | 41a3fa6 | 2016-08-25 15:42:04 -0500 | [diff] [blame] | 140 | |
John Su | 85376bf | 2018-11-06 10:51:43 +0800 | [diff] [blame] | 141 | /* TCC activation offset value in degrees Celsius */ |
Angel Pons | 643c82e | 2020-09-24 16:43:21 +0200 | [diff] [blame] | 142 | uint32_t tcc_offset; |
John Su | 85376bf | 2018-11-06 10:51:43 +0800 | [diff] [blame] | 143 | |
Venkateswarlu Vinjamuri | 88df48c | 2016-09-02 16:04:27 -0700 | [diff] [blame] | 144 | /* Configure Audio clk gate and power gate |
| 145 | * IOSF-SB port ID 92 offset 0x530 [5] and [3] |
| 146 | */ |
| 147 | uint8_t hdaudio_clk_gate_enable; |
| 148 | uint8_t hdaudio_pwr_gate_enable; |
| 149 | uint8_t hdaudio_bios_config_lockdown; |
| 150 | |
Sean Rhodes | 9d894b8 | 2022-05-26 22:20:41 +0100 | [diff] [blame] | 151 | /* Enhanced C-states */ |
| 152 | int enhanced_cstates; |
| 153 | |
Aaron Durbin | 41a3fa6 | 2016-08-25 15:42:04 -0500 | [diff] [blame] | 154 | /* SLP S3 minimum assertion width. */ |
| 155 | int slp_s3_assertion_width_usecs; |
Vaibhav Shankar | ef8deaf | 2016-08-23 17:56:17 -0700 | [diff] [blame] | 156 | |
| 157 | /* GPIO pin for PERST_0 */ |
| 158 | uint16_t prt0_gpio; |
Kane Chen | 9d490da | 2017-01-11 12:53:58 +0800 | [diff] [blame] | 159 | |
| 160 | /* USB2 eye diagram settings per port */ |
| 161 | struct usb2_eye_per_port usb2eye[APOLLOLAKE_USB2_PORT_MAX]; |
| 162 | |
Maxim Polyakov | 6704049 | 2020-02-16 11:51:57 +0300 | [diff] [blame] | 163 | /* Override USB port configuration */ |
| 164 | uint8_t usb_config_override; |
| 165 | struct usb_port_config usb2_port[APOLLOLAKE_USB2_PORT_MAX]; |
| 166 | struct usb_port_config usb3_port[APOLLOLAKE_USB3_PORT_MAX]; |
| 167 | |
Venkateswarlu Vinjamuri | 6dd7b40 | 2017-02-24 15:37:30 -0800 | [diff] [blame] | 168 | /* GPIO SD card detect pin */ |
| 169 | unsigned int sdcard_cd_gpio; |
Pratik Prajapati | 4bc6edf | 2017-08-29 14:11:16 -0700 | [diff] [blame] | 170 | |
Divya Chellap | 0b15b70 | 2017-11-29 18:53:03 +0530 | [diff] [blame] | 171 | /* Select PNP Settings. |
| 172 | * (0) Performance, |
| 173 | * (1) Power |
| 174 | * (2) Power & Performance */ |
| 175 | enum pnp_settings pnp_settings; |
John Zhao | e673e5c | 2018-10-30 15:12:11 -0700 | [diff] [blame] | 176 | |
| 177 | /* PMIC PCH_PWROK delay configuration - IPC Configuration |
| 178 | * Upd for changing PCH_PWROK delay configuration : I2C_Slave_Address |
| 179 | * (31:24) + Register_Offset (23:16) + OR Value (15:8) + AND Value (7:0) |
| 180 | */ |
| 181 | uint32_t PmicPmcIpcCtrl; |
John Zhao | 91600a3 | 2019-01-10 12:13:38 -0800 | [diff] [blame] | 182 | |
| 183 | /* Options to disable XHCI Link Compliance Mode. Default is FALSE to not |
| 184 | * disable Compliance Mode. Set TRUE to disable Compliance Mode. |
| 185 | * 0:FALSE(Default), 1:True. |
| 186 | */ |
| 187 | uint8_t DisableComplianceMode; |
John Zhao | 9a4beb4 | 2019-01-28 16:04:35 -0800 | [diff] [blame] | 188 | |
| 189 | /* Options to change USB3 ModPhy setting for the Integrated Filter (IF) |
| 190 | * value. Default is 0 to not changing default IF value (0x12). Set |
| 191 | * value with the range from 0x01 to 0xff to change IF value. |
| 192 | */ |
| 193 | uint8_t ModPhyIfValue; |
| 194 | |
| 195 | /* Options to bump USB3 LDO voltage. Default is FALSE to not increasing |
| 196 | * LDO voltage. Set TRUE to increase LDO voltage with 40mV. |
| 197 | * 0:FALSE (default), 1:True. |
| 198 | */ |
| 199 | uint8_t ModPhyVoltageBump; |
| 200 | |
| 201 | /* Options to adjust PMIC Vdd2 voltage. Default is 0 to not adjusting |
| 202 | * the PMIC Vdd2 default voltage 1.20v. Upd for changing Vdd2 Voltage |
| 203 | * configuration: I2C_Slave_Address (31:23) + Register_Offset (23:16) |
| 204 | * + OR Value (15:8) + AND Value (7:0) through BUCK5_VID[3:2]: |
| 205 | * 00=1.10v, 01=1.15v, 10=1.24v, 11=1.20v (default). |
| 206 | */ |
| 207 | uint32_t PmicVdd2Voltage; |
Werner Zeh | 279afdc | 2019-02-01 12:32:51 +0100 | [diff] [blame] | 208 | |
| 209 | /* Option to enable VTD feature. Default is 0 which disables VTD |
| 210 | * capability in FSP. Setting this option to 1 in devicetree will enable |
| 211 | * the Upd parameter VtdEnable. |
| 212 | */ |
| 213 | uint8_t enable_vtd; |
Marx Wang | abc17d1 | 2020-04-07 16:58:38 +0800 | [diff] [blame] | 214 | |
| 215 | /* Options to disable the LFPS periodic sampling for USB3 Ports. |
| 216 | * Default value of PMCTRL_REG bits[7:4] is 9 which means periodic sampling |
| 217 | * interval is 9ms. |
| 218 | * Set 1 to update XHCI host MMIO BAR + PMCTRL_REG (0x80A4 bits[7:4]) to 0 |
| 219 | * 0:Enable (default), 1:Disable. |
| 220 | */ |
| 221 | uint8_t disable_xhci_lfps_pm; |
Mario Scheithauer | b11f381 | 2022-01-26 11:49:10 +0100 | [diff] [blame] | 222 | |
| 223 | /* SATA Aggressive Link Power Management */ |
| 224 | uint8_t DisableSataSalpSupport; |
Sean Rhodes | 48f69da | 2022-06-08 21:30:26 +0100 | [diff] [blame] | 225 | |
| 226 | /* Sata Power Optimisation */ |
| 227 | uint8_t SataPwrOptimizeDisable; |
Mario Scheithauer | f165bbdc | 2023-05-22 14:44:27 +0200 | [diff] [blame] | 228 | |
| 229 | /* SATA speed limit */ |
| 230 | enum sata_speed_limit sata_speed; |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 231 | }; |
| 232 | |
Venkateswarlu Vinjamuri | 6dd7b40 | 2017-02-24 15:37:30 -0800 | [diff] [blame] | 233 | typedef struct soc_intel_apollolake_config config_t; |
Venkateswarlu Vinjamuri | 6dd7b40 | 2017-02-24 15:37:30 -0800 | [diff] [blame] | 234 | |
Andrey Petrov | 70efecd | 2016-03-04 21:41:13 -0800 | [diff] [blame] | 235 | #endif /* _SOC_APOLLOLAKE_CHIP_H_ */ |