| 1 |
|
| 2 |
|
| 3 |
#include <gpio.h> |
| 4 |
#include <soc/platform_descriptors.h> |
| 5 |
#include <soc/cpu.h> |
| 6 |
#include <types.h> |
| 7 |
#include <amdblocks/cpu.h> |
| 8 |
#include <soc/pci_devs.h> |
| 9 |
#include <console/console.h> |
| 10 |
#include <ec/acpi/ec.h> |
| 11 |
#include <stdint.h> |
| 12 |
|
| 13 |
#define ECRAM_MACID_OFFSET 0x54 |
| 14 |
#define MACID_LEN 12 |
| 15 |
|
| 16 |
#define ECRAM_BOARDID_OFFSET 0x93 |
| 17 |
|
| 18 |
#define CRATER_EC_CMD 0x666 |
| 19 |
#define CRATER_EC_DATA 0x662 |
| 20 |
|
| 21 |
#define CRATER_REVB 0x42 |
| 22 |
|
| 23 |
#define mxm_dxio_descriptor { \ |
| 24 |
.engine_type = PCIE_ENGINE, \ |
| 25 |
.port_present = true, \ |
| 26 |
.start_logical_lane = 16, \ |
| 27 |
.end_logical_lane = 23, \ |
| 28 |
.device_number = 1, \ |
| 29 |
.function_number = 1, \ |
| 30 |
.link_aspm = ASPM_L1, \ |
| 31 |
.link_aspm_L1_1 = true, \ |
| 32 |
.link_aspm_L1_2 = true, \ |
| 33 |
.turn_off_unused_lanes = false, \ |
| 34 |
.clk_req = CLK_REQ0, \ |
| 35 |
.gpio_group_id = GPIO_4, \ |
| 36 |
.port_params = {PP_PSPP_AC, 0x133, PP_PSPP_DC, 0x122}, \ |
| 37 |
} |
| 38 |
|
| 39 |
#define ssd_dxio_descriptor { \ |
| 40 |
.engine_type = PCIE_ENGINE, \ |
| 41 |
.port_present = true, \ |
| 42 |
.start_logical_lane = 8, \ |
| 43 |
.end_logical_lane = 11, \ |
| 44 |
.device_number = 2, \ |
| 45 |
.function_number = 4, \ |
| 46 |
.link_aspm = ASPM_DISABLED, \ |
| 47 |
.link_aspm_L1_1 = false, \ |
| 48 |
.link_aspm_L1_2 = false, \ |
| 49 |
.turn_off_unused_lanes = false, \ |
| 50 |
.clk_req = CLK_REQ3, \ |
| 51 |
.gpio_group_id = GPIO_27, \ |
| 52 |
.port_params = {PP_PSPP_AC, 0x133, PP_PSPP_DC, 0x122}, \ |
| 53 |
} |
| 54 |
|
| 55 |
#define dt_dxio_descriptor { \ |
| 56 |
.engine_type = PCIE_ENGINE, \ |
| 57 |
.port_present = true, \ |
| 58 |
.start_logical_lane = 0, \ |
| 59 |
.end_logical_lane = 3, \ |
| 60 |
.device_number = 1, \ |
| 61 |
.function_number = 2, \ |
| 62 |
.link_aspm = ASPM_L1, \ |
| 63 |
.link_aspm_L1_1 = true, \ |
| 64 |
.link_aspm_L1_2 = true, \ |
| 65 |
.turn_off_unused_lanes = false, \ |
| 66 |
.clk_req = CLK_REQ5, \ |
| 67 |
.port_params = {PP_PSPP_AC, 0x133, PP_PSPP_DC, 0x122}, \ |
| 68 |
} |
| 69 |
|
| 70 |
#define wwan_dxio_descriptor { \ |
| 71 |
.engine_type = PCIE_ENGINE, \ |
| 72 |
.port_present = true, \ |
| 73 |
.start_logical_lane = 2, \ |
| 74 |
.end_logical_lane = 2, \ |
| 75 |
.device_number = 1, \ |
| 76 |
.function_number = 3, \ |
| 77 |
.link_aspm = ASPM_L1, \ |
| 78 |
.link_aspm_L1_1 = true, \ |
| 79 |
.link_aspm_L1_2 = true, \ |
| 80 |
.turn_off_unused_lanes = false, \ |
| 81 |
.clk_req = CLK_REQ2, \ |
| 82 |
.port_params = {PP_PSPP_AC, 0x133, PP_PSPP_DC, 0x122}, \ |
| 83 |
} |
| 84 |
|
| 85 |
#define wlan_dxio_descriptor { \ |
| 86 |
.engine_type = PCIE_ENGINE, \ |
| 87 |
.port_present = true, \ |
| 88 |
.start_logical_lane = 3, \ |
| 89 |
.end_logical_lane = 3, \ |
| 90 |
.device_number = 2, \ |
| 91 |
.function_number = 2, \ |
| 92 |
.link_aspm = ASPM_L1, \ |
| 93 |
.link_aspm_L1_1 = true, \ |
| 94 |
.link_aspm_L1_2 = true, \ |
| 95 |
.turn_off_unused_lanes = false, \ |
| 96 |
.clk_req = CLK_REQ6, \ |
| 97 |
.port_params = {PP_PSPP_AC, 0x133, PP_PSPP_DC, 0x122}, \ |
| 98 |
} |
| 99 |
|
| 100 |
#define tb_dxio_descriptor { \ |
| 101 |
.engine_type = PCIE_ENGINE, \ |
| 102 |
.port_present = true, \ |
| 103 |
.start_logical_lane = 4, \ |
| 104 |
.end_logical_lane = 7, \ |
| 105 |
.device_number = 2, \ |
| 106 |
.function_number = 3, \ |
| 107 |
.link_aspm = ASPM_L1, \ |
| 108 |
.link_aspm_L1_1 = true, \ |
| 109 |
.link_aspm_L1_2 = true, \ |
| 110 |
.turn_off_unused_lanes = false, \ |
| 111 |
.clk_req = CLK_REQ4_GFX, \ |
| 112 |
.port_params = {PP_PSPP_AC, 0x133, PP_PSPP_DC, 0x122}, \ |
| 113 |
} |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
#define xgbe_port0_dxio_descriptor { \ |
| 119 |
.port_present = true, \ |
| 120 |
.engine_type = ETHERNET_ENGINE, \ |
| 121 |
.start_logical_lane = 0, \ |
| 122 |
.end_logical_lane = 0, \ |
| 123 |
} |
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
#define xgbe_port1_dxio_descriptor { \ |
| 129 |
.port_present = true, \ |
| 130 |
.engine_type = ETHERNET_ENGINE, \ |
| 131 |
.start_logical_lane = 1, \ |
| 132 |
.end_logical_lane = 1, \ |
| 133 |
} |
| 134 |
|
| 135 |
static fsp_ddi_descriptor crater_ddi_descriptors[] = { |
| 136 |
{ |
| 137 |
.connector_type = DDI_DP, |
| 138 |
.aux_index = DDI_AUX1, |
| 139 |
.hdp_index = DDI_HDP1 |
| 140 |
}, |
| 141 |
{ |
| 142 |
.connector_type = DDI_HDMI, |
| 143 |
.aux_index = DDI_AUX2, |
| 144 |
.hdp_index = DDI_HDP2 |
| 145 |
}, |
| 146 |
{ |
| 147 |
.connector_type = DDI_UNUSED_TYPE, |
| 148 |
.aux_index = DDI_AUX3, |
| 149 |
.hdp_index = DDI_HDP3, |
| 150 |
}, |
| 151 |
{ |
| 152 |
.connector_type = DDI_DP, |
| 153 |
.aux_index = DDI_AUX3, |
| 154 |
.hdp_index = DDI_HDP3, |
| 155 |
}, |
| 156 |
{ |
| 157 |
.connector_type = DDI_DP, |
| 158 |
.aux_index = DDI_AUX4, |
| 159 |
.hdp_index = DDI_HDP4, |
| 160 |
} |
| 161 |
}; |
| 162 |
|
| 163 |
void mainboard_get_dxio_ddi_descriptors( |
| 164 |
const fsp_dxio_descriptor **dxio_descs, size_t *dxio_num, |
| 165 |
const fsp_ddi_descriptor **ddi_descs, size_t *ddi_num) |
| 166 |
{ |
| 167 |
uint8_t BoardRev; |
| 168 |
|
| 169 |
if ((get_cpu_count() == 4 && get_threads_per_core() == 2) || get_cpu_count() == 2) |
| 170 |
crater_ddi_descriptors[1].connector_type = DDI_UNUSED_TYPE; |
| 171 |
|
| 172 |
ec_set_ports(CRATER_EC_CMD, CRATER_EC_DATA); |
| 173 |
BoardRev = ec_read(ECRAM_BOARDID_OFFSET + 0x3); |
| 174 |
|
| 175 |
if (CONFIG(ENABLE_EDP)) { |
| 176 |
crater_ddi_descriptors[1].connector_type = DDI_EDP; |
| 177 |
} else { |
| 178 |
if (BoardRev == CRATER_REVB) |
| 179 |
crater_ddi_descriptors[1].connector_type = DDI_DP; |
| 180 |
else |
| 181 |
crater_ddi_descriptors[1].connector_type = DDI_HDMI; |
| 182 |
} |
| 183 |
|
| 184 |
static const fsp_dxio_descriptor crater_dxio_descriptors[] = { |
| 185 |
mxm_dxio_descriptor, |
| 186 |
ssd_dxio_descriptor, |
| 187 |
tb_dxio_descriptor, |
| 188 |
#if CONFIG(ETH_AIC_SLOT_ONLY) |
| 189 |
dt_dxio_descriptor, |
| 190 |
#endif |
| 191 |
#if CONFIG(XGBE_WWAN_WLAN) |
| 192 |
xgbe_port0_dxio_descriptor, |
| 193 |
xgbe_port1_dxio_descriptor, |
| 194 |
wwan_dxio_descriptor, |
| 195 |
wlan_dxio_descriptor |
| 196 |
#endif |
| 197 |
}; |
| 198 |
|
| 199 |
*dxio_descs = crater_dxio_descriptors; |
| 200 |
*dxio_num = ARRAY_SIZE(crater_dxio_descriptors); |
| 201 |
*ddi_descs = crater_ddi_descriptors; |
| 202 |
*ddi_num = ARRAY_SIZE(crater_ddi_descriptors); |
| 203 |
} |