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 <device/device.h>
7 
8 #define DALBOZ_DB_HDMI 0x1
9 
10 /*
11  * This is to allow support for audio on older board versions (< 2). [b/153458561]. This
12  * should be removed once these boards are phased out.
13  */
14 static void update_audio_configuration(void)
15 {
16  uint32_t board_version;
17  const struct device *i2c_tunnel_dev = DEV_PTR(audio_rt5682);
19 
20  /* If CBI board version cannot be read, assume this is an older revision of hardware. */
21  if (google_chromeec_cbi_get_board_version(&board_version) != 0)
22  board_version = 1;
23 
24  if (board_version >= 2)
25  return;
26 
27  cfg = config_of(i2c_tunnel_dev);
28  cfg->remote_bus = 5;
29 }
30 
32 {
33  uint32_t board_version;
34  struct soc_amd_picasso_config *cfg;
35 
36  cfg = config_of_soc();
37 
38  /*
39  * If CBI board version cannot be read, assume this is an older revision
40  * of hardware.
41  */
42  if (google_chromeec_cbi_get_board_version(&board_version) != 0)
43  board_version = 1;
44 
46  if (board_version <= 2) {
47  /*
48  * rev0 and rev1 boards have issues with HS400
49  *
50  * There is a tuning fix with ES which shows promise
51  * for some boards, and a HW fix with stitching vias.
52  * There were also concerns that these boards did not
53  * have good margins for certain skus.
54  *
55  * But these original boards have none of these fixes.
56  * So we keep the speed low here, with the intent that
57  * other variants implement these corrections.
58  */
60  }
61  } else {
63  }
64 
66 }
67 
68 /* FIXME: Comments seem to suggest these are not entirely correct. */
69 static const fsp_ddi_descriptor non_hdmi_ddi_descriptors[] = {
70  {
71  // DDI0, DP0, eDP
72  .connector_type = EDP,
73  .aux_index = AUX1,
74  .hdp_index = HDP1
75  },
76  {
77  // DDI1, DP1, DB OPT2 USB-C1 / DB OPT3 MST hub
78  .connector_type = DP,
79  .aux_index = AUX2,
80  .hdp_index = HDP2
81  },
82  {
83  // DP2 pins not connected on Dali
84  // DDI2, DP3, USB-C0
85  .connector_type = DP,
86  .aux_index = AUX4,
87  .hdp_index = HDP4,
88  }
89 };
90 
91 static const fsp_ddi_descriptor hdmi_ddi_descriptors[] = {
92  { // DDI0, DP0, eDP
93  .connector_type = EDP,
94  .aux_index = AUX1,
95  .hdp_index = HDP1
96  },
97  { // DDI1, DP1, DB OPT2 USB-C1 / DB OPT3 MST hub
98  .connector_type = HDMI,
99  .aux_index = AUX2,
100  .hdp_index = HDP2
101  },
102  // DP2 pins not connected on Dali
103  { // DDI2, DP3, USB-C0
104  .connector_type = DP,
105  .aux_index = AUX4,
106  .hdp_index = HDP4,
107  }
108 };
109 
110 void variant_get_dxio_ddi_descriptors(const fsp_dxio_descriptor **dxio_descs,
111  size_t *dxio_num,
112  const fsp_ddi_descriptor **ddi_descs,
113  size_t *ddi_num)
114 {
115  uint32_t daughterboard_id = variant_get_daughterboard_id();
116 
117  *dxio_descs = baseboard_get_dxio_descriptors(dxio_num);
118 
119  /*
120  * Get daughterboard id from FW_CONFIG and configure descriptors accordingly.
121  * For unprovisioned boards use DB_HDMI as default.
122  */
123  if ((daughterboard_id == DALBOZ_DB_HDMI) || boot_is_factory_unprovisioned()) {
124  *ddi_descs = &hdmi_ddi_descriptors[0];
125  *ddi_num = ARRAY_SIZE(hdmi_ddi_descriptors);
126  } else {
127  *ddi_descs = &non_hdmi_ddi_descriptors[0];
129  }
130 }
#define ARRAY_SIZE(a)
Definition: helpers.h:12
int google_chromeec_cbi_get_board_version(uint32_t *version)
Definition: ec.c:870
const fsp_dxio_descriptor * baseboard_get_dxio_descriptors(size_t *num)
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 void update_audio_configuration(void)
Definition: variant.c:14
#define DALBOZ_DB_HDMI
Definition: variant.c:8
static const fsp_ddi_descriptor hdmi_ddi_descriptors[]
Definition: variant.c:91
static const fsp_ddi_descriptor non_hdmi_ddi_descriptors[]
Definition: variant.c:69
#define DEV_PTR(_alias)
Definition: device.h:403
static DEVTREE_CONST void * config_of(const struct device *dev)
Definition: device.h:382
#define config_of_soc()
Definition: device.h:394
int boot_is_factory_unprovisioned(void)
Definition: sku_id.c:14
unsigned int uint32_t
Definition: stdint.h:14
Definition: device.h:107
struct soc_amd_picasso_config::@417 emmc_config
enum soc_amd_picasso_config::@417::@422 timing
int variant_get_daughterboard_id(void)
Definition: helpers.c:181
int variant_has_emmc(void)
Definition: helpers.c:103