Debian Codegraph @

src/mainboard/amd/birman/port_descriptors_phoenix.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <console/console.h>
4 #include <gpio.h>
5 #include <soc/platform_descriptors.h>
6 #include <soc/soc_util.h>
7 #include <types.h>
8 #include "display_card_type.h"
9
10 #define phx_mxm_dxio_descriptor { \
11 .engine_type = PCIE_ENGINE, \
12 .port_present = CONFIG(ENABLE_EVAL_CARD), \
13 .start_lane = 0, \
14 .end_lane = 7, \
15 .device_number = 1, \
16 .function_number = 1, \
17 .link_speed_capability = GEN3, \
18 .turn_off_unused_lanes = true, \
19 .link_aspm = ASPM_L1, \
20 .link_hotplug = HOTPLUG_DISABLED, \
21 .clk_req = CLK_REQ0, \
22 }
23
24 /* TODO: verify on hardware */
25 #define phx2_mxm_dxio_descriptor { \
26 .engine_type = PCIE_ENGINE, \
27 .port_present = CONFIG(ENABLE_EVAL_CARD), \
28 .start_lane = 0, \
29 .end_lane = 3, \
30 .device_number = 1, \
31 .function_number = 1, \
32 .link_speed_capability = GEN3, \
33 .turn_off_unused_lanes = true, \
34 .link_aspm = ASPM_L1, \
35 .link_hotplug = HOTPLUG_DISABLED, \
36 .clk_req = CLK_REQ0, \
37 }
38
39 #define phx_ssd1_dxio_descriptor { \
40 .engine_type = PCIE_ENGINE, \
41 .port_present = !CONFIG(DISABLE_DT_M2), \
42 .start_lane = 8, \
43 .end_lane = 11, \
44 .device_number = 1, \
45 .function_number = 2, \
46 .link_speed_capability = GEN3, \
47 .turn_off_unused_lanes = true, \
48 .link_aspm = ASPM_L1, \
49 .link_hotplug = HOTPLUG_DISABLED, \
50 .clk_req = CLK_REQ1, \
51 }
52
53 /* TODO: verify on hardware */
54 #define phx2_ssd1_dxio_descriptor { \
55 .engine_type = PCIE_ENGINE, \
56 .port_present = true, \
57 .start_lane = 8, \
58 .end_lane = 9, \
59 .device_number = 1, \
60 .function_number = 2, \
61 .link_speed_capability = GEN3, \
62 .turn_off_unused_lanes = true, \
63 .link_aspm = ASPM_L1, \
64 .link_hotplug = HOTPLUG_DISABLED, \
65 .clk_req = CLK_REQ1, \
66 }
67
68 #define gbe_dxio_descriptor { \
69 .engine_type = PCIE_ENGINE, \
70 .port_present = true, \
71 .start_lane = 12, \
72 .end_lane = 12, \
73 .device_number = 1, \
74 .function_number = 3, \
75 .link_speed_capability = GEN3, \
76 .turn_off_unused_lanes = true, \
77 .link_aspm = ASPM_DISABLED, \
78 .link_hotplug = HOTPLUG_DISABLED, \
79 .clk_req = CLK_REQ6, \
80 }
81
82 #define sd_dxio_descriptor { \
83 .engine_type = PCIE_ENGINE, \
84 .port_present = true, \
85 .start_lane = 13, \
86 .end_lane = 13, \
87 .device_number = 2, \
88 .function_number = 1, \
89 .link_speed_capability = GEN3, \
90 .turn_off_unused_lanes = true, \
91 .link_aspm = ASPM_DISABLED, \
92 .link_hotplug = HOTPLUG_DISABLED, \
93 .clk_req = CLK_REQ5, \
94 }
95
96 #define wwan_dxio_descriptor { \
97 .engine_type = PCIE_ENGINE, \
98 .port_present = true, \
99 .start_lane = 14, \
100 .end_lane = CONFIG(WWAN01) ? 15 : 14, \
101 .device_number = 2, \
102 .function_number = 2, \
103 .link_speed_capability = GEN3, \
104 .turn_off_unused_lanes = true, \
105 .link_aspm = ASPM_DISABLED, \
106 .link_hotplug = HOTPLUG_DISABLED, \
107 .clk_req = CLK_REQ4, \
108 }
109
110 #define wlan_dxio_descriptor { \
111 .engine_type = PCIE_ENGINE, \
112 .port_present = true, \
113 .start_lane = 15, \
114 .end_lane = CONFIG(WLAN01) ? 14 : 15, \
115 .device_number = 2, \
116 .function_number = 3, \
117 .link_speed_capability = GEN3, \
118 .turn_off_unused_lanes = true, \
119 .link_aspm = ASPM_DISABLED, \
120 .link_hotplug = HOTPLUG_DISABLED, \
121 .clk_req = CLK_REQ3, \
122 }
123
124 #define ssd0_dxio_descriptor { \
125 .engine_type = PCIE_ENGINE, \
126 .port_present = true, \
127 .start_lane = 16, \
128 .end_lane = 19, \
129 .device_number = 2, \
130 .function_number = 4, \
131 .link_speed_capability = GEN3, \
132 .turn_off_unused_lanes = true, \
133 .link_aspm = ASPM_DISABLED, \
134 .link_hotplug = HOTPLUG_DISABLED, \
135 .clk_req = CLK_REQ2, \
136 }
137
138 static fsp_ddi_descriptor birman_ddi_descriptors[] = {
139 { /* DDI0 - eDP */
140 .connector_type = DDI_EDP,
141 .aux_index = DDI_AUX1,
142 .hdp_index = DDI_HDP1
143 },
144 { /* DDI1 - HDMI/DP */
145 .connector_type = DDI_HDMI,
146 .aux_index = DDI_AUX2,
147 .hdp_index = DDI_HDP2
148 },
149 { /* DDI2 - DP (type C) */
150 .connector_type = DDI_DP_W_TYPEC,
151 .aux_index = DDI_AUX3,
152 .hdp_index = DDI_HDP3,
153 },
154 { /* DDI3 - DP (type C) */
155 .connector_type = DDI_DP_W_TYPEC,
156 .aux_index = DDI_AUX4,
157 .hdp_index = DDI_HDP4,
158 },
159 { /* DDI4 - DP (type C) */
160 .connector_type = DDI_DP_W_TYPEC,
161 .aux_index = DDI_AUX5,
162 .hdp_index = DDI_HDP5,
163 }
164 };
165
166 void mainboard_get_dxio_ddi_descriptors(
167 const fsp_dxio_descriptor **dxio_descs, size_t *dxio_num,
168 const fsp_ddi_descriptor **ddi_descs, size_t *ddi_num)
169 {
170 birman_ddi_descriptors[1].connector_type = get_ddi1_type();
171
172 enum soc_type type = get_soc_type();
173
174 if (type == SOC_PHOENIX) {
175 printk(BIOS_DEBUG, "Using PHX DXIO\n");
176 static const fsp_dxio_descriptor birman_phx_dxio_descriptors[] = {
177 phx_mxm_dxio_descriptor,
178 phx_ssd1_dxio_descriptor,
179 gbe_dxio_descriptor,
180 sd_dxio_descriptor,
181 #if CONFIG(WLAN0_WWAN0) || CONFIG(WWAN01)
182 wwan_dxio_descriptor,
183 #endif
184 #if CONFIG(WLAN0_WWAN0) || CONFIG(WLAN01)
185 wlan_dxio_descriptor,
186 #endif
187 ssd0_dxio_descriptor,
188 };
189 *dxio_descs = birman_phx_dxio_descriptors;
190 *dxio_num = ARRAY_SIZE(birman_phx_dxio_descriptors);
191 } else {
192 printk(BIOS_DEBUG, "Using PHX2 DXIO\n");
193 static const fsp_dxio_descriptor birman_phx2_dxio_descriptors[] = {
194 phx2_mxm_dxio_descriptor,
195 phx2_ssd1_dxio_descriptor,
196 gbe_dxio_descriptor,
197 sd_dxio_descriptor,
198 #if CONFIG(WLAN0_WWAN0) || CONFIG(WWAN01)
199 wwan_dxio_descriptor,
200 #endif
201 #if CONFIG(WLAN0_WWAN0) || CONFIG(WLAN01)
202 wlan_dxio_descriptor,
203 #endif
204 ssd0_dxio_descriptor,
205 };
206 *dxio_descs = birman_phx2_dxio_descriptors;
207 *dxio_num = ARRAY_SIZE(birman_phx2_dxio_descriptors);
208 }
209
210 *ddi_descs = birman_ddi_descriptors;
211 *ddi_num = ARRAY_SIZE(birman_ddi_descriptors);
212 }