Attention is currently required from: Felix Held, Fred Reitberger, Jason Glenesk.
Ana Carolina Cabral has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/84777?usp=email )
Change subject: mb/amd/birman: Factor out get_dd1_type ......................................................................
mb/amd/birman: Factor out get_dd1_type
Use the now common get_ddi1_type function to update the connector type of the DDI1 port to match the display output extension card plugged into the reference board.
Change-Id: I5b5a07a19d7dd2ab0adce7d597215ebe1bf51b9f Signed-off-by: Ana Carolina Cabral ana.cpmelo95@gmail.com --- M src/mainboard/amd/birman/Kconfig M src/mainboard/amd/birman/Makefile.mk D src/mainboard/amd/birman/display_card_type.c D src/mainboard/amd/birman/display_card_type.h M src/mainboard/amd/birman/port_descriptors_glinda.c M src/mainboard/amd/birman/port_descriptors_phoenix.c M src/mainboard/amd/birman/update_devicetree_phoenix_opensil.c 7 files changed, 12 insertions(+), 67 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/77/84777/1
diff --git a/src/mainboard/amd/birman/Kconfig b/src/mainboard/amd/birman/Kconfig index 9fafae1..fc79766 100644 --- a/src/mainboard/amd/birman/Kconfig +++ b/src/mainboard/amd/birman/Kconfig @@ -2,6 +2,7 @@
config BOARD_AMD_BIRMAN_COMMON def_bool n + select MAINBOARD_AMD_COMMON select BOARD_ROMSIZE_KB_16384 # Birman actually has a 32MiB ROM select EC_ACPI select SOC_AMD_COMMON_BLOCK_USE_ESPI if !SOC_AMD_COMMON_BLOCK_SIMNOW_BUILD diff --git a/src/mainboard/amd/birman/Makefile.mk b/src/mainboard/amd/birman/Makefile.mk index a784d1a..2df1f59 100644 --- a/src/mainboard/amd/birman/Makefile.mk +++ b/src/mainboard/amd/birman/Makefile.mk @@ -4,12 +4,10 @@ bootblock-y += early_gpio.c bootblock-y += ec.c
-romstage-y += display_card_type.c romstage-$(CONFIG_BOARD_AMD_BIRMAN_PHOENIX_FSP) += port_descriptors_phoenix.c romstage-$(CONFIG_BOARD_AMD_BIRMAN_GLINDA) += port_descriptors_glinda.c
ramstage-y += chromeos.c -ramstage-y += display_card_type.c ramstage-y += gpio.c ramstage-$(CONFIG_BOARD_AMD_BIRMAN_PHOENIX_OPENSIL) += update_devicetree_phoenix_opensil.c ramstage-$(CONFIG_BOARD_AMD_BIRMAN_PHOENIX_FSP) += port_descriptors_phoenix.c diff --git a/src/mainboard/amd/birman/display_card_type.c b/src/mainboard/amd/birman/display_card_type.c deleted file mode 100644 index 21f536f..0000000 --- a/src/mainboard/amd/birman/display_card_type.c +++ /dev/null @@ -1,49 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -#include <console/console.h> -#include <device/i2c_simple.h> -#if CONFIG(PLATFORM_USES_FSP2_0) -#include <soc/platform_descriptors.h> -#else -#include <soc/amd/phoenix/chip_opensil.h> -#endif -#include <types.h> -#include "display_card_type.h" - -uint8_t get_ddi1_type(void) -{ - const uint8_t eeprom_i2c_bus = 2; - const uint8_t eeprom_i2c_address = 0x55; - const uint16_t eeprom_connector_type_offset = 2; - uint8_t eeprom_connector_type_data[2]; - uint16_t connector_type; - - if (i2c_2ba_read_bytes(eeprom_i2c_bus, eeprom_i2c_address, - eeprom_connector_type_offset, eeprom_connector_type_data, - sizeof(eeprom_connector_type_data))) { - printk(BIOS_NOTICE, - "Display connector type couldn't be determined. Disabling DDI1.\n"); - return DDI_UNUSED_TYPE; - } - - connector_type = eeprom_connector_type_data[1] | eeprom_connector_type_data[0] << 8; - - switch (connector_type) { - case 0x0c: - printk(BIOS_DEBUG, "Configuring DDI1 as HDMI.\n"); - return DDI_HDMI; - case 0x13: - printk(BIOS_DEBUG, "Configuring DDI1 as DP.\n"); - return DDI_DP; - case 0x14: - printk(BIOS_DEBUG, "Configuring DDI1 as eDP.\n"); - return DDI_EDP; - case 0x17: - printk(BIOS_DEBUG, "Configuring DDI1 as USB-C.\n"); - return DDI_DP_W_TYPEC; - default: - printk(BIOS_WARNING, "Unexpected display connector type %x. Disabling DDI1.\n", - connector_type); - return DDI_UNUSED_TYPE; - } -} diff --git a/src/mainboard/amd/birman/display_card_type.h b/src/mainboard/amd/birman/display_card_type.h deleted file mode 100644 index 1ffb278..0000000 --- a/src/mainboard/amd/birman/display_card_type.h +++ /dev/null @@ -1,10 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -#ifndef MAINBOARD_DISPLAY_CARD_TYPE_H -#define MAINBOARD_DISPLAY_CARD_TYPE_H - -#include <types.h> - -uint8_t get_ddi1_type(void); - -#endif /* MAINBOARD_DISPLAY_CARD_TYPE_H */ diff --git a/src/mainboard/amd/birman/port_descriptors_glinda.c b/src/mainboard/amd/birman/port_descriptors_glinda.c index 2af7d26..31af855 100644 --- a/src/mainboard/amd/birman/port_descriptors_glinda.c +++ b/src/mainboard/amd/birman/port_descriptors_glinda.c @@ -3,7 +3,7 @@ #include <gpio.h> #include <soc/platform_descriptors.h> #include <types.h> -#include "display_card_type.h" +#include <nova_card.h>
/* TODO: Update for birman */
@@ -82,7 +82,8 @@ const fsp_dxio_descriptor **dxio_descs, size_t *dxio_num, const fsp_ddi_descriptor **ddi_descs, size_t *ddi_num) { - birman_ddi_descriptors[1].connector_type = get_ddi1_type(); + struct nova_eeprom_params eeprom_params = {.i2c_bus = 2, .i2c_address = 0x55, .connector_type_offset = 2}; + birman_ddi_descriptors[1].connector_type = get_ddi1_type(&eeprom_params);
*dxio_descs = birman_dxio_descriptors; *dxio_num = ARRAY_SIZE(birman_dxio_descriptors); diff --git a/src/mainboard/amd/birman/port_descriptors_phoenix.c b/src/mainboard/amd/birman/port_descriptors_phoenix.c index da07e31..b805ac7 100644 --- a/src/mainboard/amd/birman/port_descriptors_phoenix.c +++ b/src/mainboard/amd/birman/port_descriptors_phoenix.c @@ -5,7 +5,7 @@ #include <soc/platform_descriptors.h> #include <soc/soc_util.h> #include <types.h> -#include "display_card_type.h" +#include <nova_card.h>
#define phx_mxm_dxio_descriptor { \ .engine_type = PCIE_ENGINE, \ @@ -167,7 +167,9 @@ const fsp_dxio_descriptor **dxio_descs, size_t *dxio_num, const fsp_ddi_descriptor **ddi_descs, size_t *ddi_num) { - birman_ddi_descriptors[1].connector_type = get_ddi1_type(); + + struct nova_eeprom_params eeprom_params = {.i2c_bus = 2, .i2c_address = 0x55, .connector_type_offset = 2}; + birman_ddi_descriptors[1].connector_type = get_ddi1_type(&eeprom_params);
enum soc_type type = get_soc_type();
diff --git a/src/mainboard/amd/birman/update_devicetree_phoenix_opensil.c b/src/mainboard/amd/birman/update_devicetree_phoenix_opensil.c index 2640e74..0ab01ca 100644 --- a/src/mainboard/amd/birman/update_devicetree_phoenix_opensil.c +++ b/src/mainboard/amd/birman/update_devicetree_phoenix_opensil.c @@ -5,7 +5,7 @@ #include <soc/soc_util.h> #include <static.h> #include <vendorcode/amd/opensil/chip/mpio/chip.h> -#include "display_card_type.h" +#include <nova_card.h> #include "update_devicetree.h"
static void mainboard_update_mpio(void) @@ -45,7 +45,9 @@ static void mainboard_update_ddi(void) { struct soc_amd_phoenix_config *cfg = config_of_soc(); - cfg->ddi[1].connector_type = get_ddi1_type(); + + struct nova_eeprom_params eeprom_params = {.i2c_bus = 2, .i2c_address = 0x55, .connector_type_offset = 2}; + cfg->ddi[1].connector_type = get_ddi1_type(&eeprom_params); }
void mainboard_update_devicetree_opensil(void)