coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
variant.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #include <baseboard/variants.h>
4 #include <soc/pci_devs.h>
5 #include <fw_config.h>
6 #include <sar.h>
7 #include <soc/amd/picasso/chip.h>
8 
9 static const fsp_ddi_descriptor hdmi_ddi_descriptors[] = {
10  { // DDI0, DP0, eDP
11  .connector_type = EDP,
12  .aux_index = AUX1,
13  .hdp_index = HDP1
14  },
15  { // DDI1, DP1, DB OPT2 USB-C1 / DB OPT3 MST hub
16  .connector_type = HDMI,
17  .aux_index = AUX2,
18  .hdp_index = HDP2
19  },
20  { // DDI2, DP3, USB-C0
21  .connector_type = DP,
22  .aux_index = AUX4,
23  .hdp_index = HDP4,
24  }
25 };
26 
27 void variant_get_dxio_ddi_descriptors(const fsp_dxio_descriptor **dxio_descs,
28  size_t *dxio_num,
29  const fsp_ddi_descriptor **ddi_descs,
30  size_t *ddi_num)
31 {
32  *dxio_descs = baseboard_get_dxio_descriptors(dxio_num);
33 
34  *ddi_descs = &hdmi_ddi_descriptors[0];
35  *ddi_num = ARRAY_SIZE(hdmi_ddi_descriptors);
36 }
37 
39 {
40  struct soc_amd_picasso_config *soc_cfg;
41  soc_cfg = config_of_soc();
42 
43  if (board_id() <= 2 || board_id() == BOARD_ID_UNKNOWN)
44  return;
45 
46  /* b:/174121847 Use external OSC to mitigate noise for WWAN sku. */
47  if (variant_has_wwan()) {
48  soc_cfg->acp_i2s_use_external_48mhz_osc = 1;
49 
50  /* eDP phy tuning settings */
52  /* bit vector of phy, bit0=1: DP0, bit1=1: DP1, bit2=1: DP2 bit3=1: DP3 */
53  soc_cfg->edp_physel = 0x1;
54  /* override for 0.6v 0db swing 1, pre-emphasis 0 */
55  soc_cfg->edp_tuningset.dp_vs_pemph_level = 0x01;
56  soc_cfg->edp_tuningset.margin_deemph = 0x004b;
57  soc_cfg->edp_tuningset.deemph_6db4 = 0x00;
58  soc_cfg->edp_tuningset.boostadj = 0x80;
59  }
60 }
61 
62 /*
63 +----------+------+--------+--------+------+--+---------+--+---------+
64 | |Vilboz|Vilboz14|Vilboz14|Vilboz|NA|Vilboz360|NA|Vilboz360|
65 | |WiFi |WiFi |LTE |LTE | |WiFi | |LTE |
66 +----------+------+--------+--------+------+--+---------+--+---------+
67 |SAR[25] |0 |0 |0 |0 |1 |1 |1 |1 |
68 |SAR[24] |0 |0 |1 |1 |0 |0 |1 |1 |
69 |SAR[23] |0 |1 |0 |1 |0 |1 |0 |1 |
70 +----------+------+--------+--------+------+--+---------+--+---------+
71 |SAR_config|0 |1 |2 |3 |4 |5 |6 |7 |
72 +----------+------+--------+--------+------+--+---------+--+---------+
73 */
74 
75 const char *get_wifi_sar_cbfs_filename(void)
76 {
77  int sar_config;
78 
79  sar_config = variant_gets_sar_config();
80 
81  switch (sar_config) {
82  case 1:
83  return "wifi_sar-vilboz-0.hex";
84  case 3:
85  return "wifi_sar-vilboz-2.hex";
86  case 5:
87  return "wifi_sar-vilboz-1.hex";
88  case 7:
89  return "wifi_sar-vilboz-3.hex";
90  default:
92  }
93 }
#define BOARD_ID_UNKNOWN
Definition: boardid.h:10
#define ARRAY_SIZE(a)
Definition: helpers.h:12
uint32_t board_id(void)
board_id() - Get the board version
Definition: ec_boardid.c:6
const fsp_dxio_descriptor * baseboard_get_dxio_descriptors(size_t *num)
const char * get_wifi_sar_cbfs_filename(void)
Definition: variant.c:5
void variant_devtree_update(void)
Definition: variant.c:53
void variant_get_dxio_ddi_descriptors(const fsp_dxio_descriptor **dxio_descs, size_t *dxio_num, const fsp_ddi_descriptor **ddi_descs, size_t *ddi_num)
Definition: variant.c:110
static const fsp_ddi_descriptor hdmi_ddi_descriptors[]
Definition: variant.c:9
#define config_of_soc()
Definition: device.h:394
#define WIFI_SAR_CBFS_DEFAULT_FILENAME
Definition: sar.h:87
@ ENABLE_EDP_TUNINGSET
Definition: chip.h:94
uint8_t edp_physel
Definition: chip.h:281
uint16_t edp_phy_override
Definition: chip.h:279
struct soc_amd_picasso_config::@421 edp_tuningset
bool acp_i2s_use_external_48mhz_osc
Definition: chip.h:276
uint16_t margin_deemph
Definition: chip.h:287
uint8_t deemph_6db4
Definition: chip.h:285
uint8_t boostadj
Definition: chip.h:286
uint8_t dp_vs_pemph_level
Definition: chip.h:284
int variant_has_wwan(void)
Definition: helpers.c:113
int variant_gets_sar_config(void)
Definition: helpers.c:93