blob: de3ba9780c1c72bf79e3e17a51d687ddacecbf28 [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>
Furquan Shaikh6e37e902016-07-28 13:44:53 -070010#include <soc/gpe.h>
Duncan Laurieff8bce02016-06-27 10:57:13 -070011#include <soc/gpio.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
Andrey Petrov70efecd2016-03-04 21:41:13 -080028struct soc_intel_apollolake_config {
Subrata Banikc4986eb2018-05-09 14:55:09 +053029
30 /* Common structure containing soc config data required by common code*/
31 struct soc_intel_common_config common_soc_config;
Ravi Sarawadi3669a062018-02-27 13:23:42 -080032
Sumeet R Pawnikar2adb50d2020-05-09 15:37:09 +053033 /* Common struct containing power limits configuration info */
34 struct soc_power_limits_config power_limits_config;
35
Michael Niewöhner97e21d32020-12-28 00:49:33 +010036 /*
37 * IGD panel configuration
38 *
39 * Second backlight control shares logic with other pins (aka. display utility pin).
40 * Be sure it's used for PWM before setting any secondary backlight value.
41 */
42 struct i915_gpu_panel_config panel_cfg[2];
Nico Huber2a163312020-01-06 17:42:45 +010043
Matt DeVillierd7ef4502020-04-21 01:23:10 -050044 /* i915 struct for GMA backlight control */
45 struct i915_gpu_controller_info gfx;
46
Andrey Petrov70efecd2016-03-04 21:41:13 -080047 /*
48 * Mapping from PCIe root port to CLKREQ input on the SOC. The SOC has
49 * four CLKREQ inputs, but six root ports. Root ports without an
50 * associated CLKREQ signal must be marked with "CLKREQ_DISABLED"
51 */
Furquan Shaikh6d5e10c2018-03-14 19:57:16 -070052 uint8_t pcie_rp_clkreq_pin[MAX_PCIE_PORTS];
Alexandru Gagniuc3aa34a82016-04-04 10:47:49 -070053
Furquan Shaikh2cfc8622018-03-14 21:43:04 -070054 /* Enable/disable hot-plug for root ports (0 = disable, 1 = enable). */
55 uint8_t pcie_rp_hotplug_enable[MAX_PCIE_PORTS];
56
Shamile Khanc4276a32018-03-14 18:09:19 -070057 /* De-emphasis enable configuration for each PCIe root port */
58 uint8_t pcie_rp_deemphasis_enable[MAX_PCIE_PORTS];
59
Zhao, Lijian1b8ee0b2016-05-17 19:01:34 -070060 /* [14:8] DDR mode Number of dealy elements.Each = 125pSec.
61 * [6:0] SDR mode Number of dealy elements.Each = 125pSec.
62 */
63 uint32_t emmc_tx_cmd_cntl;
64
65 /* [14:8] HS400 mode Number of dealy elements.Each = 125pSec.
66 * [6:0] SDR104/HS200 mode Number of dealy elements.Each = 125pSec.
67 */
68 uint32_t emmc_tx_data_cntl1;
69
70 /* [30:24] SDR50 mode Number of dealy elements.Each = 125pSec.
71 * [22:16] DDR50 mode Number of dealy elements.Each = 125pSec.
72 * [14:8] SDR25/HS50 mode Number of dealy elements.Each = 125pSec.
Lee Leahy07441b52017-03-09 10:59:25 -080073 * [6:0] SDR12/Compatibility mode Number of dealy elements.
74 * Each = 125pSec.
Zhao, Lijian1b8ee0b2016-05-17 19:01:34 -070075 */
76 uint32_t emmc_tx_data_cntl2;
77
78 /* [30:24] SDR50 mode Number of dealy elements.Each = 125pSec.
79 * [22:16] DDR50 mode Number of dealy elements.Each = 125pSec.
80 * [14:8] SDR25/HS50 mode Number of dealy elements.Each = 125pSec.
Lee Leahy07441b52017-03-09 10:59:25 -080081 * [6:0] SDR12/Compatibility mode Number of dealy elements.
82 * Each = 125pSec.
Zhao, Lijian1b8ee0b2016-05-17 19:01:34 -070083 */
84 uint32_t emmc_rx_cmd_data_cntl1;
85
86 /* [14:8] HS400 mode 1 Number of dealy elements.Each = 125pSec.
87 * [6:0] HS400 mode 2 Number of dealy elements.Each = 125pSec.
88 */
89 uint32_t emmc_rx_strobe_cntl;
90
91 /* [13:8] Auto Tuning mode Number of dealy elements.Each = 125pSec.
92 * [6:0] SDR104/HS200 Number of dealy elements.Each = 125pSec.
93 */
94 uint32_t emmc_rx_cmd_data_cntl2;
95
Mario Scheithauer9116eb62018-08-23 11:39:19 +020096 /* Select the eMMC max speed allowed. */
97 uint8_t emmc_host_max_speed;
98
Sean Rhodesde198bb2022-05-19 15:34:35 +010099 /* Sata Ports Hot Plug */
100 uint8_t SataPortsHotPlug[2];
101
Mario Scheithauer841416f2017-09-18 17:08:48 +0200102 /* Specifies on which IRQ the SCI will internally appear. */
103 uint8_t sci_irq;
104
Alexandru Gagniuc3aa34a82016-04-04 10:47:49 -0700105 /* Configure serial IRQ (SERIRQ) line. */
106 enum serirq_mode serirq_mode;
Hannah Williams483004f2016-03-28 14:45:59 -0700107
Shaunak Saha5b6c5a52016-06-07 02:06:28 -0700108 uint8_t gpe0_dw1; /* GPE0_63_32 STS/EN */
109 uint8_t gpe0_dw2; /* GPE0_95_64 STS/EN */
110 uint8_t gpe0_dw3; /* GPE0_127_96 STS/EN */
Saurabh Satijae46dbcc2016-05-03 15:15:31 -0700111
Sean Rhodes2d58d5c2022-01-19 08:13:38 +0000112 /* LPC fixed enables and ranges */
113 uint16_t lpc_iod;
114 uint16_t lpc_ioe;
115
Sean Rhodes7a82a802022-06-02 11:28:43 +0100116 /* Generic IO decode ranges */
117 uint32_t gen1_dec;
118 uint32_t gen2_dec;
119 uint32_t gen3_dec;
120 uint32_t gen4_dec;
121
Saurabh Satijae46dbcc2016-05-03 15:15:31 -0700122 /* Configure LPSS S0ix Enable */
123 uint8_t lpss_s0ix_enable;
Shaunak Sahacd9e1e42016-07-12 01:22:33 -0700124
125 /* Enable DPTF support */
126 int dptf_enable;
Aaron Durbin41a3fa62016-08-25 15:42:04 -0500127
John Su85376bf2018-11-06 10:51:43 +0800128 /* TCC activation offset value in degrees Celsius */
Angel Pons643c82e2020-09-24 16:43:21 +0200129 uint32_t tcc_offset;
John Su85376bf2018-11-06 10:51:43 +0800130
Venkateswarlu Vinjamuri88df48c2016-09-02 16:04:27 -0700131 /* Configure Audio clk gate and power gate
132 * IOSF-SB port ID 92 offset 0x530 [5] and [3]
133 */
134 uint8_t hdaudio_clk_gate_enable;
135 uint8_t hdaudio_pwr_gate_enable;
136 uint8_t hdaudio_bios_config_lockdown;
137
Sean Rhodes9d894b82022-05-26 22:20:41 +0100138 /* Enhanced C-states */
139 int enhanced_cstates;
140
Aaron Durbin41a3fa62016-08-25 15:42:04 -0500141 /* SLP S3 minimum assertion width. */
142 int slp_s3_assertion_width_usecs;
Vaibhav Shankaref8deaf2016-08-23 17:56:17 -0700143
144 /* GPIO pin for PERST_0 */
145 uint16_t prt0_gpio;
Kane Chen9d490da2017-01-11 12:53:58 +0800146
147 /* USB2 eye diagram settings per port */
148 struct usb2_eye_per_port usb2eye[APOLLOLAKE_USB2_PORT_MAX];
149
Maxim Polyakov67040492020-02-16 11:51:57 +0300150 /* Override USB port configuration */
151 uint8_t usb_config_override;
152 struct usb_port_config usb2_port[APOLLOLAKE_USB2_PORT_MAX];
153 struct usb_port_config usb3_port[APOLLOLAKE_USB3_PORT_MAX];
154
Venkateswarlu Vinjamuri6dd7b402017-02-24 15:37:30 -0800155 /* GPIO SD card detect pin */
156 unsigned int sdcard_cd_gpio;
Pratik Prajapati4bc6edf2017-08-29 14:11:16 -0700157
Divya Chellap0b15b702017-11-29 18:53:03 +0530158 /* Select PNP Settings.
159 * (0) Performance,
160 * (1) Power
161 * (2) Power & Performance */
162 enum pnp_settings pnp_settings;
John Zhaoe673e5c2018-10-30 15:12:11 -0700163
164 /* PMIC PCH_PWROK delay configuration - IPC Configuration
165 * Upd for changing PCH_PWROK delay configuration : I2C_Slave_Address
166 * (31:24) + Register_Offset (23:16) + OR Value (15:8) + AND Value (7:0)
167 */
168 uint32_t PmicPmcIpcCtrl;
John Zhao91600a32019-01-10 12:13:38 -0800169
170 /* Options to disable XHCI Link Compliance Mode. Default is FALSE to not
171 * disable Compliance Mode. Set TRUE to disable Compliance Mode.
172 * 0:FALSE(Default), 1:True.
173 */
174 uint8_t DisableComplianceMode;
John Zhao9a4beb42019-01-28 16:04:35 -0800175
176 /* Options to change USB3 ModPhy setting for the Integrated Filter (IF)
177 * value. Default is 0 to not changing default IF value (0x12). Set
178 * value with the range from 0x01 to 0xff to change IF value.
179 */
180 uint8_t ModPhyIfValue;
181
182 /* Options to bump USB3 LDO voltage. Default is FALSE to not increasing
183 * LDO voltage. Set TRUE to increase LDO voltage with 40mV.
184 * 0:FALSE (default), 1:True.
185 */
186 uint8_t ModPhyVoltageBump;
187
188 /* Options to adjust PMIC Vdd2 voltage. Default is 0 to not adjusting
189 * the PMIC Vdd2 default voltage 1.20v. Upd for changing Vdd2 Voltage
190 * configuration: I2C_Slave_Address (31:23) + Register_Offset (23:16)
191 * + OR Value (15:8) + AND Value (7:0) through BUCK5_VID[3:2]:
192 * 00=1.10v, 01=1.15v, 10=1.24v, 11=1.20v (default).
193 */
194 uint32_t PmicVdd2Voltage;
Werner Zeh279afdc2019-02-01 12:32:51 +0100195
196 /* Option to enable VTD feature. Default is 0 which disables VTD
197 * capability in FSP. Setting this option to 1 in devicetree will enable
198 * the Upd parameter VtdEnable.
199 */
200 uint8_t enable_vtd;
Marx Wangabc17d12020-04-07 16:58:38 +0800201
202 /* Options to disable the LFPS periodic sampling for USB3 Ports.
203 * Default value of PMCTRL_REG bits[7:4] is 9 which means periodic sampling
204 * interval is 9ms.
205 * Set 1 to update XHCI host MMIO BAR + PMCTRL_REG (0x80A4 bits[7:4]) to 0
206 * 0:Enable (default), 1:Disable.
207 */
208 uint8_t disable_xhci_lfps_pm;
Mario Scheithauerb11f3812022-01-26 11:49:10 +0100209
210 /* SATA Aggressive Link Power Management */
211 uint8_t DisableSataSalpSupport;
Andrey Petrov70efecd2016-03-04 21:41:13 -0800212};
213
Venkateswarlu Vinjamuri6dd7b402017-02-24 15:37:30 -0800214typedef struct soc_intel_apollolake_config config_t;
Venkateswarlu Vinjamuri6dd7b402017-02-24 15:37:30 -0800215
Andrey Petrov70efecd2016-03-04 21:41:13 -0800216#endif /* _SOC_APOLLOLAKE_CHIP_H_ */