1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
4 #include <device/i2c_simple.h>
6 #include <soc/platform_descriptors.h>
11 static const fsp_dxio_descriptor mayan_dxio_descriptors
[] = {
14 .engine_type
= PCIE_ENGINE
,
20 .link_speed_capability
= GEN_MAX
,
21 .turn_off_unused_lanes
= true,
23 .link_aspm_L1_1
= true,
24 .link_aspm_L1_2
= true,
25 .link_hotplug
= HOTPLUG_DISABLED
,
27 .clk_pm_support
= true,
30 .port_params
= {PP_PSPP_AC
, 0x144, PP_PSPP_DC
, 0x133}
34 .engine_type
= PCIE_ENGINE
,
40 .link_speed_capability
= GEN_MAX
,
41 .turn_off_unused_lanes
= true,
43 .link_aspm_L1_1
= true,
44 .link_aspm_L1_2
= true,
45 .link_hotplug
= HOTPLUG_DISABLED
,
47 .clk_pm_support
= true,
50 .port_params
= {PP_PSPP_AC
, 0x144, PP_PSPP_DC
, 0x133}
54 .engine_type
= PCIE_ENGINE
,
60 .link_speed_capability
= GEN_MAX
,
61 .turn_off_unused_lanes
= true,
63 .link_aspm_L1_1
= true,
64 .link_aspm_L1_2
= true,
65 .link_hotplug
= HOTPLUG_DISABLED
,
66 .clk_pm_support
= true,
69 .port_params
= {PP_PSPP_AC
, 0x144, PP_PSPP_DC
, 0x133}
73 .engine_type
= PCIE_ENGINE
,
74 .port_present
= !CONFIG(DISABLE_DT_M2_MAYAN
),
79 .link_speed_capability
= GEN_MAX
,
80 .turn_off_unused_lanes
= true,
82 .link_aspm_L1_1
= true,
83 .link_aspm_L1_2
= true,
84 .link_hotplug
= HOTPLUG_DISABLED
,
85 .clk_pm_support
= true,
88 .port_params
= {PP_PSPP_AC
, 0x144, PP_PSPP_DC
, 0x133}
92 static fsp_ddi_descriptor mayan_ddi_descriptors
[] = {
94 .connector_type
= DDI_EDP
,
95 .aux_index
= DDI_AUX1
,
98 { /* DDI1 - HDMI/DP */
99 .connector_type
= DDI_HDMI
,
100 .aux_index
= DDI_AUX2
,
101 .hdp_index
= DDI_HDP2
103 { /* DDI2 - DP (type C) */
104 .connector_type
= DDI_DP
,
105 .aux_index
= DDI_AUX3
,
106 .hdp_index
= DDI_HDP3
,
108 { /* DDI3 - DP (type C) */
109 .connector_type
= DDI_DP
,
110 .aux_index
= DDI_AUX4
,
111 .hdp_index
= DDI_HDP4
,
113 { /* DDI4 - unused */
114 .connector_type
= DDI_UNUSED_TYPE
,
115 .aux_index
= DDI_AUX5
,
116 .hdp_index
= DDI_HDP5
,
120 static uint8_t get_ddi1_type(void)
122 const uint8_t eeprom_i2c_bus
= 2;
123 const uint8_t eeprom_i2c_address
= 0x55;
124 const uint16_t eeprom_connector_type_offset
= 2;
125 uint8_t eeprom_connector_type_data
[2];
126 uint16_t connector_type
;
128 if (i2c_2ba_read_bytes(eeprom_i2c_bus
, eeprom_i2c_address
,
129 eeprom_connector_type_offset
, eeprom_connector_type_data
,
130 sizeof(eeprom_connector_type_data
))) {
132 "Display connector type couldn't be determined. Disabling DDI1.\n");
133 return DDI_UNUSED_TYPE
;
136 connector_type
= eeprom_connector_type_data
[1] | eeprom_connector_type_data
[0] << 8;
138 switch (connector_type
) {
140 printk(BIOS_DEBUG
, "Configuring DDI1 as HDMI.\n");
143 printk(BIOS_DEBUG
, "Configuring DDI1 as DP.\n");
146 printk(BIOS_DEBUG
, "Configuring DDI1 as eDP.\n");
149 printk(BIOS_WARNING
, "Unexpected display connector type %x. Disabling DDI1.\n",
151 return DDI_UNUSED_TYPE
;
155 void mainboard_get_dxio_ddi_descriptors(
156 const fsp_dxio_descriptor
**dxio_descs
, size_t *dxio_num
,
157 const fsp_ddi_descriptor
**ddi_descs
, size_t *ddi_num
)
159 mayan_ddi_descriptors
[1].connector_type
= get_ddi1_type();
160 *dxio_descs
= mayan_dxio_descriptors
;
161 *dxio_num
= ARRAY_SIZE(mayan_dxio_descriptors
);
162 *ddi_descs
= mayan_ddi_descriptors
;
163 *ddi_num
= ARRAY_SIZE(mayan_ddi_descriptors
);