blob: ae36731c7b5ff14bc336c99e84cbb1e260834235 [file] [log] [blame]
Raul E Rangelb3c41322020-05-20 14:07:41 -06001/* SPDX-License-Identifier: GPL-2.0-or-later */
2
3#include <baseboard/gpio.h>
4#include <baseboard/variants.h>
Felix Held65931922021-04-15 00:14:12 +02005#include <platform_descriptors.h>
Raul E Rangelb3c41322020-05-20 14:07:41 -06006#include <soc/soc_util.h>
7
Felix Held86db2c72020-07-21 17:09:31 +02008void __weak variant_get_dxio_ddi_descriptors(const fsp_dxio_descriptor **dxio_descs,
9 size_t *dxio_num,
Felix Heldca428c32020-06-10 19:05:45 +020010 const fsp_ddi_descriptor **ddi_descs,
Raul E Rangelb3c41322020-05-20 14:07:41 -060011 size_t *ddi_num)
12{
Felix Held86db2c72020-07-21 17:09:31 +020013 *dxio_descs = baseboard_get_dxio_descriptors(dxio_num);
Raul E Rangelb3c41322020-05-20 14:07:41 -060014 *ddi_descs = baseboard_get_ddi_descriptors(ddi_num);
15}
16
17/* FP5 package can support Type 1 (Picasso) and Type 2 (Dali), however some
18 * Type 1 parts, while reporting as Picasso through cpuid, are fused like a Dali.
19 * Those parts need to be configured as Type 2. */
20
Felix Held86db2c72020-07-21 17:09:31 +020021static const fsp_dxio_descriptor pco_dxio_descriptors[] = {
Raul E Rangelb3c41322020-05-20 14:07:41 -060022 {
23 // NVME SSD
24 .port_present = true,
25 .engine_type = PCIE_ENGINE,
Felix Helda19d9862020-07-20 15:46:56 +020026 .start_logical_lane = 0,
27 .end_logical_lane = 3,
Raul E Rangelb3c41322020-05-20 14:07:41 -060028 .device_number = 1,
29 .function_number = 7,
30 .link_aspm = ASPM_L1,
31 .link_aspm_L1_1 = true,
32 .link_aspm_L1_2 = true,
33 .turn_off_unused_lanes = true,
Aaron Durbin80e2dd82020-07-29 13:54:22 -060034 .clk_req = CLK_REQ4,
Raul E Rangelb3c41322020-05-20 14:07:41 -060035 },
36 {
37 // WLAN
38 .port_present = true,
39 .engine_type = PCIE_ENGINE,
Felix Helda19d9862020-07-20 15:46:56 +020040 .start_logical_lane = 4,
41 .end_logical_lane = 4,
Raul E Rangelb3c41322020-05-20 14:07:41 -060042 .device_number = 1,
43 .function_number = 2,
44 .link_aspm = ASPM_L1,
45 .link_aspm_L1_1 = true,
46 .link_aspm_L1_2 = true,
47 .turn_off_unused_lanes = true,
Aaron Durbin80e2dd82020-07-29 13:54:22 -060048 .clk_req = CLK_REQ0,
Raul E Rangelb3c41322020-05-20 14:07:41 -060049 },
50 {
51 // SD Reader
52 .port_present = true,
53 .engine_type = PCIE_ENGINE,
Felix Helda19d9862020-07-20 15:46:56 +020054 .start_logical_lane = 5,
55 .end_logical_lane = 5,
Raul E Rangelb3c41322020-05-20 14:07:41 -060056 .device_number = 1,
57 .function_number = 3,
58 .link_aspm = ASPM_L1,
59 .link_aspm_L1_1 = true,
60 .link_aspm_L1_2 = true,
61 .turn_off_unused_lanes = true,
Aaron Durbin80e2dd82020-07-29 13:54:22 -060062 .clk_req = CLK_REQ1,
Raul E Rangelb3c41322020-05-20 14:07:41 -060063 }
64};
65
Felix Held86db2c72020-07-21 17:09:31 +020066static const fsp_dxio_descriptor dali_dxio_descriptors[] = {
Raul E Rangelb3c41322020-05-20 14:07:41 -060067 {
68 // NVME SSD
69 .port_present = true,
70 .engine_type = PCIE_ENGINE,
Aaron Durbin80e2dd82020-07-29 13:54:22 -060071 .start_logical_lane = 0,
72 .end_logical_lane = 1,
Raul E Rangelb3c41322020-05-20 14:07:41 -060073 .device_number = 1,
74 .function_number = 7,
75 .link_aspm = ASPM_L1,
76 .link_aspm_L1_1 = true,
77 .link_aspm_L1_2 = true,
78 .turn_off_unused_lanes = true,
Aaron Durbin80e2dd82020-07-29 13:54:22 -060079 .clk_req = CLK_REQ4,
Raul E Rangelb3c41322020-05-20 14:07:41 -060080 },
81 {
82 // WLAN
83 .port_present = true,
84 .engine_type = PCIE_ENGINE,
Aaron Durbin80e2dd82020-07-29 13:54:22 -060085 .start_logical_lane = 4,
86 .end_logical_lane = 4,
Raul E Rangelb3c41322020-05-20 14:07:41 -060087 .device_number = 1,
88 .function_number = 2,
89 .link_aspm = ASPM_L1,
90 .link_aspm_L1_1 = true,
91 .link_aspm_L1_2 = true,
92 .turn_off_unused_lanes = true,
Aaron Durbin80e2dd82020-07-29 13:54:22 -060093 .clk_req = CLK_REQ0,
Raul E Rangelb3c41322020-05-20 14:07:41 -060094 },
95 {
96 // SD Reader
97 .port_present = true,
98 .engine_type = PCIE_ENGINE,
Aaron Durbin80e2dd82020-07-29 13:54:22 -060099 .start_logical_lane = 5,
100 .end_logical_lane = 5,
Raul E Rangelb3c41322020-05-20 14:07:41 -0600101 .device_number = 1,
102 .function_number = 3,
103 .link_aspm = ASPM_L1,
104 .link_aspm_L1_1 = true,
105 .link_aspm_L1_2 = true,
106 .turn_off_unused_lanes = true,
Aaron Durbin80e2dd82020-07-29 13:54:22 -0600107 .clk_req = CLK_REQ1,
Raul E Rangelb3c41322020-05-20 14:07:41 -0600108 }
109};
110
Felix Held86db2c72020-07-21 17:09:31 +0200111const fsp_dxio_descriptor *baseboard_get_dxio_descriptors(size_t *num)
Raul E Rangelb3c41322020-05-20 14:07:41 -0600112{
113 /* Type 2 or Type 1 fused like Type 2. */
Felix Held42b0e8f2020-06-26 18:03:53 +0200114 if (soc_is_reduced_io_sku()) {
Felix Held86db2c72020-07-21 17:09:31 +0200115 *num = ARRAY_SIZE(dali_dxio_descriptors);
116 return dali_dxio_descriptors;
Raul E Rangelb3c41322020-05-20 14:07:41 -0600117 } else {
118 /* Type 1 */
Felix Held86db2c72020-07-21 17:09:31 +0200119 *num = ARRAY_SIZE(pco_dxio_descriptors);
120 return pco_dxio_descriptors;
Raul E Rangelb3c41322020-05-20 14:07:41 -0600121 }
122
123}
124
Felix Heldca428c32020-06-10 19:05:45 +0200125static const fsp_ddi_descriptor pco_ddi_descriptors[] = {
Raul E Rangelb3c41322020-05-20 14:07:41 -0600126 {
127 // DDI0, DP0, eDP
128 .connector_type = EDP,
129 .aux_index = AUX1,
130 .hdp_index = HDP1
131 },
132 {
133 // DDI1, DP1, DB OPT1 HDMI
134 .connector_type = HDMI,
135 .aux_index = AUX2,
136 .hdp_index = HDP2
137 },
138 {
139 // DDI2, DP2, DB OPT1 USB-C1
140 .connector_type = DP,
141 .aux_index = AUX3,
142 .hdp_index = HDP3,
143 },
144 {
145 // DDI3, DP3, USB-C0
146 .connector_type = DP,
147 .aux_index = AUX4,
148 .hdp_index = HDP4,
149 }
150};
151
Felix Heldca428c32020-06-10 19:05:45 +0200152static const fsp_ddi_descriptor dali_ddi_descriptors[] = {
Raul E Rangelb3c41322020-05-20 14:07:41 -0600153 {
154 // DDI0, DP0, eDP
155 .connector_type = EDP,
156 .aux_index = AUX1,
157 .hdp_index = HDP1
158 },
159 {
160 // DDI1, DP1, DB OPT2 USB-C1 / DB OPT3 MST hub
161 .connector_type = DP,
162 .aux_index = AUX2,
163 .hdp_index = HDP2
164 },
165 {
166 // DDI2, DP3, USB-C0
167 .connector_type = DP,
168 .aux_index = AUX4,
169 .hdp_index = HDP4,
170 }
171};
172
Felix Heldca428c32020-06-10 19:05:45 +0200173const fsp_ddi_descriptor *baseboard_get_ddi_descriptors(size_t *num)
Raul E Rangelb3c41322020-05-20 14:07:41 -0600174{
175 /* Type 2 or Type 1 fused like Type 2. */
Felix Held42b0e8f2020-06-26 18:03:53 +0200176 if (soc_is_reduced_io_sku()) {
Raul E Rangelb3c41322020-05-20 14:07:41 -0600177 *num = ARRAY_SIZE(dali_ddi_descriptors);
178 return dali_ddi_descriptors;
179 } else {
180 /* Type 1 */
181 *num = ARRAY_SIZE(pco_ddi_descriptors);
182 return pco_ddi_descriptors;
183 }
184}