blob: e05bd50f4cf0831b021d818029d1fc0988886276 [file] [log] [blame]
Patrick Georgiac959032020-05-05 22:49:26 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Andrey Petrov70efecd2016-03-04 21:41:13 -08002
3#ifndef _SOC_APOLLOLAKE_CHIP_H_
4#define _SOC_APOLLOLAKE_CHIP_H_
5
Pratik Prajapatiff3162b2017-12-07 10:46:09 -08006#include <commonlib/helpers.h>
Michael Niewöhner97e21d32020-12-28 00:49:33 +01007#include <drivers/intel/gma/gma.h>
Kyösti Mälkki32d47eb2019-09-28 00:00:30 +03008#include <intelblocks/cfg.h>
Ravi Sarawadi3669a062018-02-27 13:23:42 -08009#include <intelblocks/gspi.h>
Dinesh Gehlot58cc96f2023-01-17 04:01:13 +000010#include <gpio.h>
Furquan Shaikh6e37e902016-07-28 13:44:53 -070011#include <soc/gpe.h>
Ravi Sarawadiefa606b2017-08-04 16:26:09 -070012#include <intelblocks/lpc_lib.h>
Sumeet R Pawnikar2adb50d2020-05-09 15:37:09 +053013#include <intelblocks/power_limit.h>
Nico Huber0f2dd1e2017-08-01 14:02:40 +020014#include <device/i2c_simple.h>
Chris Chingb8dc63b2017-12-06 14:26:15 -070015#include <drivers/i2c/designware/dw_i2c.h>
Shaunak Saha5b6c5a52016-06-07 02:06:28 -070016#include <soc/pm.h>
Kane Chen9d490da2017-01-11 12:53:58 +080017#include <soc/usb.h>
Duncan Laurieff8bce02016-06-27 10:57:13 -070018
Furquan Shaikh6d5e10c2018-03-14 19:57:16 -070019#define MAX_PCIE_PORTS 6
Andrey Petrov70efecd2016-03-04 21:41:13 -080020#define CLKREQ_DISABLED 0xf
Duncan Laurieff8bce02016-06-27 10:57:13 -070021
Divya Chellap0b15b702017-11-29 18:53:03 +053022enum pnp_settings {
23 PNP_PERF,
24 PNP_POWER,
25 PNP_PERF_POWER,
26};
27
Mario Scheithauerf165bbdc2023-05-22 14:44:27 +020028enum sata_speed_limit {
29 SATA_DEFAULT = 0,
30 SATA_GEN1,
31 SATA_GEN2,
32 SATA_GEN3
33};
34
Andrey Petrov70efecd2016-03-04 21:41:13 -080035struct soc_intel_apollolake_config {
Subrata Banikc4986eb2018-05-09 14:55:09 +053036 /* Common structure containing soc config data required by common code*/
37 struct soc_intel_common_config common_soc_config;
Ravi Sarawadi3669a062018-02-27 13:23:42 -080038
Sumeet R Pawnikar2adb50d2020-05-09 15:37:09 +053039 /* Common struct containing power limits configuration info */
40 struct soc_power_limits_config power_limits_config;
41
Michael Niewöhner97e21d32020-12-28 00:49:33 +010042 /*
43 * IGD panel configuration
44 *
45 * Second backlight control shares logic with other pins (aka. display utility pin).
46 * Be sure it's used for PWM before setting any secondary backlight value.
47 */
48 struct i915_gpu_panel_config panel_cfg[2];
Nico Huber2a163312020-01-06 17:42:45 +010049
Matt DeVillierd7ef4502020-04-21 01:23:10 -050050 /* i915 struct for GMA backlight control */
51 struct i915_gpu_controller_info gfx;
52
Andrey Petrov70efecd2016-03-04 21:41:13 -080053 /*
54 * Mapping from PCIe root port to CLKREQ input on the SOC. The SOC has
55 * four CLKREQ inputs, but six root ports. Root ports without an
56 * associated CLKREQ signal must be marked with "CLKREQ_DISABLED"
57 */
Furquan Shaikh6d5e10c2018-03-14 19:57:16 -070058 uint8_t pcie_rp_clkreq_pin[MAX_PCIE_PORTS];
Alexandru Gagniuc3aa34a82016-04-04 10:47:49 -070059
Furquan Shaikh2cfc8622018-03-14 21:43:04 -070060 /* Enable/disable hot-plug for root ports (0 = disable, 1 = enable). */
Michael Strosche757e0c12023-08-18 14:24:46 +020061 bool pcie_rp_hotplug_enable[MAX_PCIE_PORTS];
Furquan Shaikh2cfc8622018-03-14 21:43:04 -070062
Shamile Khanc4276a32018-03-14 18:09:19 -070063 /* De-emphasis enable configuration for each PCIe root port */
Michael Strosche757e0c12023-08-18 14:24:46 +020064 bool pcie_rp_deemphasis_enable[MAX_PCIE_PORTS];
Shamile Khanc4276a32018-03-14 18:09:19 -070065
Zhao, Lijian1b8ee0b2016-05-17 19:01:34 -070066 /* [14:8] DDR mode Number of dealy elements.Each = 125pSec.
67 * [6:0] SDR mode Number of dealy elements.Each = 125pSec.
68 */
69 uint32_t emmc_tx_cmd_cntl;
70
71 /* [14:8] HS400 mode Number of dealy elements.Each = 125pSec.
72 * [6:0] SDR104/HS200 mode Number of dealy elements.Each = 125pSec.
73 */
74 uint32_t emmc_tx_data_cntl1;
75
76 /* [30:24] SDR50 mode Number of dealy elements.Each = 125pSec.
77 * [22:16] DDR50 mode Number of dealy elements.Each = 125pSec.
78 * [14:8] SDR25/HS50 mode Number of dealy elements.Each = 125pSec.
Lee Leahy07441b52017-03-09 10:59:25 -080079 * [6:0] SDR12/Compatibility mode Number of dealy elements.
80 * Each = 125pSec.
Zhao, Lijian1b8ee0b2016-05-17 19:01:34 -070081 */
82 uint32_t emmc_tx_data_cntl2;
83
84 /* [30:24] SDR50 mode Number of dealy elements.Each = 125pSec.
85 * [22:16] DDR50 mode Number of dealy elements.Each = 125pSec.
86 * [14:8] SDR25/HS50 mode Number of dealy elements.Each = 125pSec.
Lee Leahy07441b52017-03-09 10:59:25 -080087 * [6:0] SDR12/Compatibility mode Number of dealy elements.
88 * Each = 125pSec.
Zhao, Lijian1b8ee0b2016-05-17 19:01:34 -070089 */
90 uint32_t emmc_rx_cmd_data_cntl1;
91
92 /* [14:8] HS400 mode 1 Number of dealy elements.Each = 125pSec.
93 * [6:0] HS400 mode 2 Number of dealy elements.Each = 125pSec.
94 */
95 uint32_t emmc_rx_strobe_cntl;
96
97 /* [13:8] Auto Tuning mode Number of dealy elements.Each = 125pSec.
98 * [6:0] SDR104/HS200 Number of dealy elements.Each = 125pSec.
99 */
100 uint32_t emmc_rx_cmd_data_cntl2;
101
Mario Scheithauer9116eb62018-08-23 11:39:19 +0200102 /* Select the eMMC max speed allowed. */
103 uint8_t emmc_host_max_speed;
104
Sean Rhodesde198bb2022-05-19 15:34:35 +0100105 /* Sata Ports Hot Plug */
Michael Strosche757e0c12023-08-18 14:24:46 +0200106 bool sata_ports_hot_plug[2];
Sean Rhodesde198bb2022-05-19 15:34:35 +0100107
Sean Rhodes57779952022-05-19 15:35:31 +0100108 /* Sata Ports Enable */
Michael Strosche757e0c12023-08-18 14:24:46 +0200109 bool sata_ports_enable[2];
Sean Rhodes57779952022-05-19 15:35:31 +0100110
Mario Scheithauerc8dc2c12023-05-22 15:27:36 +0200111 /* Sata Ports Solid State Drive */
112 uint8_t sata_ports_ssd[2];
113
Mario Scheithauer841416f2017-09-18 17:08:48 +0200114 /* Specifies on which IRQ the SCI will internally appear. */
115 uint8_t sci_irq;
116
Alexandru Gagniuc3aa34a82016-04-04 10:47:49 -0700117 /* Configure serial IRQ (SERIRQ) line. */
118 enum serirq_mode serirq_mode;
Hannah Williams483004f2016-03-28 14:45:59 -0700119
Shaunak Saha5b6c5a52016-06-07 02:06:28 -0700120 uint8_t gpe0_dw1; /* GPE0_63_32 STS/EN */
121 uint8_t gpe0_dw2; /* GPE0_95_64 STS/EN */
122 uint8_t gpe0_dw3; /* GPE0_127_96 STS/EN */
Saurabh Satijae46dbcc2016-05-03 15:15:31 -0700123
Sean Rhodes2d58d5c2022-01-19 08:13:38 +0000124 /* LPC fixed enables and ranges */
125 uint16_t lpc_iod;
126 uint16_t lpc_ioe;
127
Sean Rhodes7a82a802022-06-02 11:28:43 +0100128 /* Generic IO decode ranges */
129 uint32_t gen1_dec;
130 uint32_t gen2_dec;
131 uint32_t gen3_dec;
132 uint32_t gen4_dec;
133
Saurabh Satijae46dbcc2016-05-03 15:15:31 -0700134 /* Configure LPSS S0ix Enable */
Michael Strosche757e0c12023-08-18 14:24:46 +0200135 bool lpss_s0ix_enable;
Shaunak Sahacd9e1e42016-07-12 01:22:33 -0700136
137 /* Enable DPTF support */
Michael Strosche757e0c12023-08-18 14:24:46 +0200138 bool dptf_enable;
Aaron Durbin41a3fa62016-08-25 15:42:04 -0500139
John Su85376bf2018-11-06 10:51:43 +0800140 /* TCC activation offset value in degrees Celsius */
Angel Pons643c82e2020-09-24 16:43:21 +0200141 uint32_t tcc_offset;
John Su85376bf2018-11-06 10:51:43 +0800142
Venkateswarlu Vinjamuri88df48c2016-09-02 16:04:27 -0700143 /* Configure Audio clk gate and power gate
144 * IOSF-SB port ID 92 offset 0x530 [5] and [3]
145 */
Michael Strosche757e0c12023-08-18 14:24:46 +0200146 bool hdaudio_clk_gate_enable;
147 bool hdaudio_pwr_gate_enable;
148 bool hdaudio_bios_config_lockdown;
Venkateswarlu Vinjamuri88df48c2016-09-02 16:04:27 -0700149
Sean Rhodes9d894b82022-05-26 22:20:41 +0100150 /* Enhanced C-states */
Michael Strosche757e0c12023-08-18 14:24:46 +0200151 bool enhanced_cstates;
Sean Rhodes9d894b82022-05-26 22:20:41 +0100152
Aaron Durbin41a3fa62016-08-25 15:42:04 -0500153 /* SLP S3 minimum assertion width. */
154 int slp_s3_assertion_width_usecs;
Vaibhav Shankaref8deaf2016-08-23 17:56:17 -0700155
156 /* GPIO pin for PERST_0 */
157 uint16_t prt0_gpio;
Kane Chen9d490da2017-01-11 12:53:58 +0800158
159 /* USB2 eye diagram settings per port */
160 struct usb2_eye_per_port usb2eye[APOLLOLAKE_USB2_PORT_MAX];
161
Maxim Polyakov67040492020-02-16 11:51:57 +0300162 /* Override USB port configuration */
Michael Strosche757e0c12023-08-18 14:24:46 +0200163 bool usb_config_override;
Maxim Polyakov67040492020-02-16 11:51:57 +0300164 struct usb_port_config usb2_port[APOLLOLAKE_USB2_PORT_MAX];
165 struct usb_port_config usb3_port[APOLLOLAKE_USB3_PORT_MAX];
166
Venkateswarlu Vinjamuri6dd7b402017-02-24 15:37:30 -0800167 /* GPIO SD card detect pin */
168 unsigned int sdcard_cd_gpio;
Pratik Prajapati4bc6edf2017-08-29 14:11:16 -0700169
Divya Chellap0b15b702017-11-29 18:53:03 +0530170 /* Select PNP Settings.
171 * (0) Performance,
172 * (1) Power
173 * (2) Power & Performance */
174 enum pnp_settings pnp_settings;
John Zhaoe673e5c2018-10-30 15:12:11 -0700175
176 /* PMIC PCH_PWROK delay configuration - IPC Configuration
177 * Upd for changing PCH_PWROK delay configuration : I2C_Slave_Address
178 * (31:24) + Register_Offset (23:16) + OR Value (15:8) + AND Value (7:0)
179 */
Mario Scheithauer1bbdd0a2023-06-15 14:10:34 +0200180 uint32_t pmic_pmc_ipc_ctrl;
John Zhao91600a32019-01-10 12:13:38 -0800181
182 /* Options to disable XHCI Link Compliance Mode. Default is FALSE to not
183 * disable Compliance Mode. Set TRUE to disable Compliance Mode.
184 * 0:FALSE(Default), 1:True.
185 */
Michael Strosche757e0c12023-08-18 14:24:46 +0200186 bool disable_compliance_mode;
John Zhao9a4beb42019-01-28 16:04:35 -0800187
188 /* Options to change USB3 ModPhy setting for the Integrated Filter (IF)
189 * value. Default is 0 to not changing default IF value (0x12). Set
190 * value with the range from 0x01 to 0xff to change IF value.
191 */
Mario Scheithauer16d1eb62023-06-15 14:28:47 +0200192 uint8_t mod_phy_if_value;
John Zhao9a4beb42019-01-28 16:04:35 -0800193
194 /* Options to bump USB3 LDO voltage. Default is FALSE to not increasing
195 * LDO voltage. Set TRUE to increase LDO voltage with 40mV.
196 * 0:FALSE (default), 1:True.
197 */
Michael Strosche757e0c12023-08-18 14:24:46 +0200198 bool mod_phy_voltage_bump;
John Zhao9a4beb42019-01-28 16:04:35 -0800199
200 /* Options to adjust PMIC Vdd2 voltage. Default is 0 to not adjusting
201 * the PMIC Vdd2 default voltage 1.20v. Upd for changing Vdd2 Voltage
202 * configuration: I2C_Slave_Address (31:23) + Register_Offset (23:16)
203 * + OR Value (15:8) + AND Value (7:0) through BUCK5_VID[3:2]:
204 * 00=1.10v, 01=1.15v, 10=1.24v, 11=1.20v (default).
205 */
Mario Scheithauer53ad07a2023-06-15 14:36:09 +0200206 uint32_t pmic_vdd2_voltage;
Werner Zeh279afdc2019-02-01 12:32:51 +0100207
208 /* Option to enable VTD feature. Default is 0 which disables VTD
209 * capability in FSP. Setting this option to 1 in devicetree will enable
210 * the Upd parameter VtdEnable.
211 */
Michael Strosche757e0c12023-08-18 14:24:46 +0200212 bool enable_vtd;
Marx Wangabc17d12020-04-07 16:58:38 +0800213
214 /* Options to disable the LFPS periodic sampling for USB3 Ports.
215 * Default value of PMCTRL_REG bits[7:4] is 9 which means periodic sampling
216 * interval is 9ms.
217 * Set 1 to update XHCI host MMIO BAR + PMCTRL_REG (0x80A4 bits[7:4]) to 0
218 * 0:Enable (default), 1:Disable.
219 */
Michael Strosche757e0c12023-08-18 14:24:46 +0200220 bool disable_xhci_lfps_pm;
Mario Scheithauerb11f3812022-01-26 11:49:10 +0100221
222 /* SATA Aggressive Link Power Management */
Michael Strosche757e0c12023-08-18 14:24:46 +0200223 bool disable_sata_salp_support;
Sean Rhodes48f69da2022-06-08 21:30:26 +0100224
225 /* Sata Power Optimisation */
Michael Strosche757e0c12023-08-18 14:24:46 +0200226 bool sata_pwr_optimize_disable;
Mario Scheithauerf165bbdc2023-05-22 14:44:27 +0200227
228 /* SATA speed limit */
229 enum sata_speed_limit sata_speed;
Andrey Petrov70efecd2016-03-04 21:41:13 -0800230};
231
Venkateswarlu Vinjamuri6dd7b402017-02-24 15:37:30 -0800232typedef struct soc_intel_apollolake_config config_t;
Venkateswarlu Vinjamuri6dd7b402017-02-24 15:37:30 -0800233
Andrey Petrov70efecd2016-03-04 21:41:13 -0800234#endif /* _SOC_APOLLOLAKE_CHIP_H_ */