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>
9 /* TODO: Update for birman */
11 static const fsp_dxio_descriptor birman_dxio_descriptors
[] = {
13 .engine_type
= PCIE_ENGINE
,
15 .start_logical_lane
= 0,
16 .end_logical_lane
= 0,
19 .link_speed_capability
= GEN3
,
20 .turn_off_unused_lanes
= true,
26 .engine_type
= PCIE_ENGINE
,
28 .start_logical_lane
= 1,
29 .end_logical_lane
= 1,
32 .link_speed_capability
= GEN3
,
33 .turn_off_unused_lanes
= true,
39 .engine_type
= PCIE_ENGINE
,
41 .start_logical_lane
= 2,
42 .end_logical_lane
= 3,
45 .link_speed_capability
= GEN3
,
46 .turn_off_unused_lanes
= true,
49 .gpio_group_id
= GPIO_27
,
54 static fsp_ddi_descriptor birman_ddi_descriptors
[] = {
56 .connector_type
= DDI_EDP
,
57 .aux_index
= DDI_AUX1
,
60 { /* DDI1 - HDMI/DP */
61 .connector_type
= DDI_HDMI
,
62 .aux_index
= DDI_AUX2
,
65 { /* DDI2 - DP (type C) */
66 .connector_type
= DDI_DP
,
67 .aux_index
= DDI_AUX3
,
68 .hdp_index
= DDI_HDP3
,
70 { /* DDI3 - DP (type C) */
71 .connector_type
= DDI_DP
,
72 .aux_index
= DDI_AUX4
,
73 .hdp_index
= DDI_HDP4
,
76 .connector_type
= DDI_UNUSED_TYPE
,
77 .aux_index
= DDI_AUX5
,
78 .hdp_index
= DDI_HDP5
,
82 static uint8_t get_ddi1_type(void)
84 const uint8_t eeprom_i2c_bus
= 2;
85 const uint8_t eeprom_i2c_address
= 0x55;
86 const uint16_t eeprom_connector_type_offset
= 2;
87 uint8_t eeprom_connector_type_data
[2];
88 uint16_t connector_type
;
90 if (i2c_2ba_read_bytes(eeprom_i2c_bus
, eeprom_i2c_address
,
91 eeprom_connector_type_offset
, eeprom_connector_type_data
,
92 sizeof(eeprom_connector_type_data
))) {
94 "Display connector type couldn't be determined. Disabling DDI1.\n");
95 return DDI_UNUSED_TYPE
;
98 connector_type
= eeprom_connector_type_data
[1] | eeprom_connector_type_data
[0] << 8;
100 switch (connector_type
) {
102 printk(BIOS_DEBUG
, "Configuring DDI1 as HDMI.\n");
106 printk(BIOS_DEBUG
, "Configuring DDI1 as DP.\n");
110 printk(BIOS_DEBUG
, "Configuring DDI1 as eDP.\n");
114 printk(BIOS_WARNING
, "Unexpected display connector type %x. Disabling DDI1.\n",
116 return DDI_UNUSED_TYPE
;
120 void mainboard_get_dxio_ddi_descriptors(
121 const fsp_dxio_descriptor
**dxio_descs
, size_t *dxio_num
,
122 const fsp_ddi_descriptor
**ddi_descs
, size_t *ddi_num
)
124 birman_ddi_descriptors
[1].connector_type
= get_ddi1_type();
126 *dxio_descs
= birman_dxio_descriptors
;
127 *dxio_num
= ARRAY_SIZE(birman_dxio_descriptors
);
128 *ddi_descs
= birman_ddi_descriptors
;
129 *ddi_num
= ARRAY_SIZE(birman_ddi_descriptors
);