coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
port_descriptors.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <baseboard/variants.h>
4 #include <device/device.h>
5 #include <device/pci_def.h>
6 #include <soc/platform_descriptors.h>
7 #include <soc/gpio.h>
8 #include <types.h>
9 
10 /* All PCIe Resets are handled in coreboot */
11 static fsp_dxio_descriptor guybrush_czn_dxio_descriptors[] = {
12  { /* WLAN */
13  .engine_type = PCIE_ENGINE,
14  .port_present = true,
15  .start_logical_lane = 0,
16  .end_logical_lane = 0,
17  .link_speed_capability = GEN3,
18  .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,
32  .link_speed_capability = GEN3,
33  .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,
40  .gpio_group_id = GPIO_69,
41  .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,
48  .link_speed_capability = GEN3,
49  .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,
63  .link_speed_capability = GEN3,
64  .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 */
85  .engine_type = PCIE_ENGINE,
86  .port_present = true,
87  .start_logical_lane = 16,
88  .end_logical_lane = 23,
89  .device_number = PCIE_GPP_BRIDGE_1_DEV,
90  .function_number = PCIE_GPP_1_0_FUNC,
91  .turn_off_unused_lanes = true,
92  .clk_req = CLK_REQ6,
93  .port_params = {PP_PSPP_AC, 0x133, PP_PSPP_DC, 0x122}
94  }
95 };
96 
97 /* TODO: verify the DDI table, since this is mostly an educated guess right now */
98 static fsp_ddi_descriptor guybrush_czn_ddi_descriptors[] = {
99  { /* 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  }
124 };
125 
127 {
128 }
129 
130 void __weak variant_update_ddi_descriptors(fsp_ddi_descriptor *ddi_descriptors)
131 {
132 }
133 
135  const fsp_dxio_descriptor **dxio_descs, size_t *dxio_num,
136  const fsp_ddi_descriptor **ddi_descs, size_t *ddi_num)
137 {
138  /* Get Variant specific SD AUX Reset GPIO */
140 
141  /* gpp_bridge_2 is used either for WWAN or NVME bridge. Mark it as PCIE_ENGINE when it
142  is enabled. */
143  if (is_dev_enabled(DEV_PTR(gpp_bridge_2)))
144  guybrush_czn_dxio_descriptors[WWAN_NVME].engine_type = PCIE_ENGINE;
145 
146  if (variant_has_pcie_wwan())
148 
151 
152  *dxio_descs = guybrush_czn_dxio_descriptors;
154 
155  *ddi_descs = guybrush_czn_ddi_descriptors;
157 }
void mainboard_get_dxio_ddi_descriptors(const fsp_dxio_descriptor **dxio_descs, size_t *dxio_num, const fsp_ddi_descriptor **ddi_descs, size_t *ddi_num)
#define GPIO_18
Definition: gpio_ftns.h:17
#define ARRAY_SIZE(a)
Definition: helpers.h:12
bool is_dev_enabled(const struct device *dev)
Definition: device_const.c:369
static const fsp_dxio_descriptor dxio_descriptors[]
void __weak variant_update_ddi_descriptors(fsp_ddi_descriptor *ddi_descriptors)
void __weak variant_update_dxio_descriptors(fsp_dxio_descriptor *dxio_descriptors)
static fsp_dxio_descriptor guybrush_czn_dxio_descriptors[]
static fsp_ddi_descriptor guybrush_czn_ddi_descriptors[]
#define WLAN_DEVFN
Definition: variants.h:10
#define SD_DEVFN
Definition: variants.h:11
#define WWAN_DEVFN
Definition: variants.h:12
#define NVME_DEVFN
Definition: variants.h:13
@ WWAN_NVME
Definition: variants.h:57
@ SD
Definition: variants.h:56
bool __weak variant_has_pcie_wwan(void)
Definition: helpers.c:7
uint8_t __weak variant_sd_aux_reset_gpio(void)
Definition: helpers.c:12
#define DEV_PTR(_alias)
Definition: device.h:403
#define PCI_FUNC(devfn)
Definition: pci_def.h:550
#define PCI_SLOT(devfn)
Definition: pci_def.h:549
@ ASPM_L1
Definition: pcie_rp.h:50
const struct smm_save_state_ops *legacy_ops __weak
Definition: save_state.c:8
#define GPIO_69
Definition: gpio.h:55
#define PCIE_GPP_2_4_FUNC
Definition: pci_devs.h:55
#define PCIE_GPP_BRIDGE_1_DEV
Definition: pci_devs.h:22
#define PCIE_GPP_1_0_FUNC
Definition: pci_devs.h:24
#define PCIE_GPP_BRIDGE_2_DEV
Definition: pci_devs.h:37