blob: af06e7f3ed032f1ddc61c87ae4b7c8769c9b460f [file] [log] [blame]
Matt Papageorgeea0f2252021-03-30 11:41:22 -05001/* SPDX-License-Identifier: GPL-2.0-only */
2
Karthikeyan Ramasubramanianf8b237b2021-06-16 17:37:38 -06003#include <baseboard/variants.h>
Karthikeyan Ramasubramanian0bf9afe2021-10-15 16:36:07 -06004#include <device/device.h>
Karthikeyan Ramasubramanianf8b237b2021-06-16 17:37:38 -06005#include <device/pci_def.h>
Matt Papageorgeea0f2252021-03-30 11:41:22 -05006#include <soc/platform_descriptors.h>
Martin Rothd76b4f62021-04-05 17:24:51 -06007#include <soc/gpio.h>
Matt Papageorgeea0f2252021-03-30 11:41:22 -05008#include <types.h>
9
Martin Roth76643f02021-08-31 17:46:27 -060010/* All PCIe Resets are handled in coreboot */
Karthikeyan Ramasubramanian0bf9afe2021-10-15 16:36:07 -060011static fsp_dxio_descriptor guybrush_czn_dxio_descriptors[] = {
Martin Roth76643f02021-08-31 17:46:27 -060012 { /* WLAN */
13 .engine_type = PCIE_ENGINE,
14 .port_present = true,
15 .start_logical_lane = 0,
16 .end_logical_lane = 0,
Matt Papageorge7d6b4e32021-11-01 16:39:47 -050017 .link_speed_capability = 3,
Martin Roth76643f02021-08-31 17:46:27 -060018 .device_number = PCI_SLOT(WLAN_DEVFN),
19 .function_number = PCI_FUNC(WLAN_DEVFN),
20 .link_aspm = ASPM_L1,
21 .link_aspm_L1_1 = true,
22 .link_aspm_L1_2 = true,
23 .turn_off_unused_lanes = true,
24 .clk_req = CLK_REQ0,
25 .port_params = {PP_PSPP_AC, 0x133, PP_PSPP_DC, 0x122}
26 },
27 { /* SD */
28 .engine_type = PCIE_ENGINE,
29 .port_present = true,
30 .start_logical_lane = 1,
31 .end_logical_lane = 1,
Matt Papageorge7d6b4e32021-11-01 16:39:47 -050032 .link_speed_capability = 3,
Martin Roth76643f02021-08-31 17:46:27 -060033 .device_number = PCI_SLOT(SD_DEVFN),
34 .function_number = PCI_FUNC(SD_DEVFN),
35 .link_aspm = ASPM_L1,
36 .link_aspm_L1_1 = true,
37 .link_aspm_L1_2 = true,
38 .turn_off_unused_lanes = true,
39 .clk_req = CLK_REQ1,
Matt Papageorgecc2fa982021-10-08 13:30:23 -050040 .gpio_group_id = GPIO_69,
Martin Roth76643f02021-08-31 17:46:27 -060041 .port_params = {PP_PSPP_AC, 0x133, PP_PSPP_DC, 0x122}
42 },
43 { /* WWAN */
44 .engine_type = UNUSED_ENGINE,
45 .port_present = true,
46 .start_logical_lane = 2,
47 .end_logical_lane = 2,
Matt Papageorge7d6b4e32021-11-01 16:39:47 -050048 .link_speed_capability = 3,
Martin Roth76643f02021-08-31 17:46:27 -060049 .device_number = PCI_SLOT(WWAN_DEVFN),
50 .function_number = PCI_FUNC(WWAN_DEVFN),
51 .link_aspm = ASPM_L1,
52 .link_aspm_L1_1 = true,
53 .link_aspm_L1_2 = true,
54 .turn_off_unused_lanes = true,
55 .clk_req = CLK_REQ2,
56 .port_params = {PP_PSPP_AC, 0x133, PP_PSPP_DC, 0x122}
57 },
58 { /* NVME */
59 .engine_type = PCIE_ENGINE,
60 .port_present = true,
61 .start_logical_lane = 4,
62 .end_logical_lane = 7,
Matt Papageorge7d6b4e32021-11-01 16:39:47 -050063 .link_speed_capability = 3,
Martin Roth76643f02021-08-31 17:46:27 -060064 .device_number = PCI_SLOT(NVME_DEVFN),
65 .function_number = PCI_FUNC(NVME_DEVFN),
66 .link_aspm = ASPM_L1,
67 .link_aspm_L1_1 = true,
68 .link_aspm_L1_2 = true,
69 .turn_off_unused_lanes = true,
70 .clk_req = CLK_REQ3,
71 .port_params = {PP_PSPP_AC, 0x133, PP_PSPP_DC, 0x122}
72 },
73 { /* TODO: remove this temporary workaround */
74 .engine_type = PCIE_ENGINE,
75 .port_present = true,
76 .start_logical_lane = 8,
77 .end_logical_lane = 11,
78 .device_number = PCIE_GPP_BRIDGE_2_DEV,
79 .function_number = PCIE_GPP_2_4_FUNC,
80 .turn_off_unused_lanes = true,
81 .clk_req = CLK_REQ5,
82 .port_params = {PP_PSPP_AC, 0x133, PP_PSPP_DC, 0x122}
83 },
84 { /* TODO: remove this temporary workaround */
Felix Heldc81fb7c2021-04-06 22:17:12 +020085 .engine_type = PCIE_ENGINE,
86 .port_present = true,
87 .start_logical_lane = 16,
88 .end_logical_lane = 23,
Karthikeyan Ramasubramanianf8b237b2021-06-16 17:37:38 -060089 .device_number = PCIE_GPP_BRIDGE_1_DEV,
90 .function_number = PCIE_GPP_1_0_FUNC,
Felix Heldc81fb7c2021-04-06 22:17:12 +020091 .turn_off_unused_lanes = true,
92 .clk_req = CLK_REQ6,
93 .port_params = {PP_PSPP_AC, 0x133, PP_PSPP_DC, 0x122}
Felix Held6478cf92021-03-30 23:20:08 +020094 }
Matt Papageorgeea0f2252021-03-30 11:41:22 -050095};
96
Felix Held6478cf92021-03-30 23:20:08 +020097/* TODO: verify the DDI table, since this is mostly an educated guess right now */
Matt Papageorgeea0f2252021-03-30 11:41:22 -050098static const fsp_ddi_descriptor guybrush_czn_ddi_descriptors[] = {
Felix Held6478cf92021-03-30 23:20:08 +020099 { /* DDI0 - eDP */
100 .connector_type = DDI_EDP,
101 .aux_index = DDI_AUX1,
102 .hdp_index = DDI_HDP1
103 },
104 { /* DDI1 - HDMI */
105 .connector_type = DDI_HDMI,
106 .aux_index = DDI_AUX2,
107 .hdp_index = DDI_HDP2
108 },
109 { /* DDI2 */
110 .connector_type = DDI_UNUSED_TYPE,
111 .aux_index = DDI_AUX3,
112 .hdp_index = DDI_HDP3,
113 },
114 { /* DDI3 - DP (type C) */
115 .connector_type = DDI_DP,
116 .aux_index = DDI_AUX3,
117 .hdp_index = DDI_HDP3,
118 },
119 { /* DDI4 - DP (type C) */
120 .connector_type = DDI_DP,
121 .aux_index = DDI_AUX4,
122 .hdp_index = DDI_HDP4,
123 }
Matt Papageorgeea0f2252021-03-30 11:41:22 -0500124};
125
Kevin Chiu1a950d62021-10-18 19:45:37 +0800126void __weak variant_update_dxio_descriptors(fsp_dxio_descriptor *dxio_descriptors)
127{
128}
129
Matt Papageorgeea0f2252021-03-30 11:41:22 -0500130void mainboard_get_dxio_ddi_descriptors(
131 const fsp_dxio_descriptor **dxio_descs, size_t *dxio_num,
132 const fsp_ddi_descriptor **ddi_descs, size_t *ddi_num)
133{
Karthikeyan Ramasubramanian750abb12021-10-25 22:50:33 -0600134 /* Get Variant specific SD AUX Reset GPIO */
135 guybrush_czn_dxio_descriptors[SD].gpio_group_id = variant_sd_aux_reset_gpio();
136
Karthikeyan Ramasubramanian0bf9afe2021-10-15 16:36:07 -0600137 /* gpp_bridge_2 is used either for WWAN or NVME bridge. Mark it as PCIE_ENGINE when it
138 is enabled. */
139 if (is_dev_enabled(DEV_PTR(gpp_bridge_2)))
140 guybrush_czn_dxio_descriptors[WWAN_NVME].engine_type = PCIE_ENGINE;
141
Karthikeyan Ramasubramanian72cc0462021-10-19 15:38:36 -0600142 if (variant_has_pcie_wwan())
143 guybrush_czn_dxio_descriptors[WWAN_NVME].gpio_group_id = GPIO_18;
144
Kevin Chiu1a950d62021-10-18 19:45:37 +0800145 variant_update_dxio_descriptors(guybrush_czn_dxio_descriptors);
146
Karthikeyan Ramasubramanian0bf9afe2021-10-15 16:36:07 -0600147 *dxio_descs = guybrush_czn_dxio_descriptors;
148 *dxio_num = ARRAY_SIZE(guybrush_czn_dxio_descriptors);
Martin Roth76643f02021-08-31 17:46:27 -0600149
Matt Papageorgeea0f2252021-03-30 11:41:22 -0500150 *ddi_descs = guybrush_czn_ddi_descriptors;
151 *ddi_num = ARRAY_SIZE(guybrush_czn_ddi_descriptors);
152}