mb/amd/crater/ec: Create function to get board revision
Remove duplicate code and make it into a single function to read the board revision from ec. Change-Id: If7f3e7eda2c43417639494880a080fa472474cab Signed-off-by: Ana Carolina Cabral <ana.cpmelo95@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/87441 Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
bd858faee8
commit
14b5c004f5
3 changed files with 18 additions and 8 deletions
|
|
@ -105,7 +105,6 @@
|
|||
#define ECG_WLAN_WWAN_MUX_OFF BIT(4)
|
||||
|
||||
#define ECRAM_BOARDID_OFFSET 0x93
|
||||
#define CRATER_REVB 0x42
|
||||
#define ECRAM_MACID_OFFSET 0x54
|
||||
#define MACID_LEN 12
|
||||
|
||||
|
|
@ -214,6 +213,19 @@ void crater_ec_init(void)
|
|||
configure_ec_gpio();
|
||||
}
|
||||
|
||||
uint8_t crater_ec_get_board_revision(void)
|
||||
{
|
||||
static uint8_t board_rev;
|
||||
|
||||
if (board_rev)
|
||||
return board_rev;
|
||||
|
||||
ec_set_ports(CRATER_EC_CMD, CRATER_EC_DATA);
|
||||
board_rev = ec_read(ECRAM_BOARDID_OFFSET + 0x3);
|
||||
|
||||
return board_rev;
|
||||
}
|
||||
|
||||
void crater_ec_get_mac_addresses(uint64_t *xgbe_port0_mac, uint64_t *xgbe_port1_mac)
|
||||
{
|
||||
uint64_t port0_mac = 0;
|
||||
|
|
|
|||
|
|
@ -3,8 +3,11 @@
|
|||
#ifndef CRATER_EC_H
|
||||
#define CRATER_EC_H
|
||||
|
||||
#define CRATER_REVB 0x42
|
||||
|
||||
void crater_ec_init(void);
|
||||
void crater_boardrevision(void);
|
||||
uint8_t crater_ec_get_board_revision(void);
|
||||
void crater_ec_get_mac_addresses(uint64_t *xgbe_port0_mac, uint64_t *xgbe_port1_mac);
|
||||
|
||||
#endif /* CRATER_EC_H */
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@
|
|||
#define CRATER_EC_CMD 0x666
|
||||
#define CRATER_EC_DATA 0x662
|
||||
|
||||
#define CRATER_REVB 0x42
|
||||
|
||||
#define mxm_dxio_descriptor { \
|
||||
.engine_type = PCIE_ENGINE, \
|
||||
.port_present = true, \
|
||||
|
|
@ -164,18 +162,15 @@ void mainboard_get_dxio_ddi_descriptors(
|
|||
const fsp_dxio_descriptor **dxio_descs, size_t *dxio_num,
|
||||
const fsp_ddi_descriptor **ddi_descs, size_t *ddi_num)
|
||||
{
|
||||
uint8_t BoardRev;
|
||||
uint8_t board_rev = crater_ec_get_board_revision();
|
||||
|
||||
if ((get_cpu_count() == 4 && get_threads_per_core() == 2) || get_cpu_count() == 2)
|
||||
crater_ddi_descriptors[1].connector_type = DDI_UNUSED_TYPE;
|
||||
|
||||
ec_set_ports(CRATER_EC_CMD, CRATER_EC_DATA);
|
||||
BoardRev = ec_read(ECRAM_BOARDID_OFFSET + 0x3);
|
||||
|
||||
if (CONFIG(ENABLE_EDP)) {
|
||||
crater_ddi_descriptors[1].connector_type = DDI_EDP;
|
||||
} else {
|
||||
if (BoardRev == CRATER_REVB)
|
||||
if (board_rev == CRATER_REVB)
|
||||
crater_ddi_descriptors[1].connector_type = DDI_DP;
|
||||
else
|
||||
crater_ddi_descriptors[1].connector_type = DDI_HDMI;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue