From a23020c43e1cc9ba7b6d25e469fb11fc14d66620 Mon Sep 17 00:00:00 2001 From: Ana Carolina Cabral Date: Wed, 4 Dec 2024 12:14:03 -0300 Subject: [PATCH] mb/amd/birman_plus: Update PCIe Slot configurations Rectify board configuration flags based on the schematics Doc. 105-D99700-00C and User Guide #58168 (NDA). Change-Id: Ia310ea616006479b9a052afb99d08df6a11431f4 Signed-off-by: Ana Carolina Cabral Reviewed-on: https://review.coreboot.org/c/coreboot/+/85493 Reviewed-by: Felix Singer Tested-by: build bot (Jenkins) --- src/mainboard/amd/birman_plus/Kconfig | 45 ++++++++++--------- src/mainboard/amd/birman_plus/ec.c | 28 +++--------- .../amd/birman_plus/port_descriptors_glinda.c | 36 ++++++++++++--- .../birman_plus/port_descriptors_phoenix.c | 2 +- 4 files changed, 62 insertions(+), 49 deletions(-) diff --git a/src/mainboard/amd/birman_plus/Kconfig b/src/mainboard/amd/birman_plus/Kconfig index 462fece271..02f3f23c68 100644 --- a/src/mainboard/amd/birman_plus/Kconfig +++ b/src/mainboard/amd/birman_plus/Kconfig @@ -99,39 +99,44 @@ config ENABLE_EVAL_19V help Enable the 19V rail for Eval Card PCIe slot -choice - prompt "DT SLOT/M.2 SSD1 ENABLE" - default ENABLE_DT_SLOT_BIRMANPLUS +config ENABLE_SSD1_BIRMANPLUS + bool "Enable M.2 SSD1 Slot" help - Either DT slot or M.2 SSD1 can be used, as they are sharing PCIe lanes. + Enable M.2 SSD1 Slot. For Glinda SoC this will downgrade + PCIe x8 slot to x4. -config ENABLE_DT_SLOT_BIRMANPLUS - bool "Enable DT slot" +choice + prompt "GBE Enable/WWAN LANE1 Selection" + default ENABLE_GBE_BIRMANPLUS + help + When the M.2 x2 WWAN slot is enabled, the GbE LAN is disabled. -config ENABLE_M2_SSD1_BIRMANPLUS - bool "Enable M.2 SSD1" +config ENABLE_GBE_BIRMANPLUS + bool "Enable GBE (1 Lane WWAN)" -config DISABLE_DT_M2_BIRMANPLUS - bool "Disable both DT and M.2 slot" +config ENABLE_WWAN02_BIRMANPLUS + bool "Enable only WWAN (2 Lanes WWAN)" +config DISABLE_WWAN_GBE_BIRMANPLUS + bool "Disable both WWAN and GBE" endchoice choice - prompt "WLAN/WWAN Selection" - default WLAN0_WWAN0_BIRMANPLUS + prompt "SD Card Enable/WLAN LANE1 Selection" + default ENABLE_SDCARD_BIRMANPLUS help - WLAN and WWAN lane configuration + When the M.2 x2 WLAN slot is enabled, the SD Card Reader is disabled. -config WLAN0_WWAN0_BIRMANPLUS - bool "Both WLAN and WWAN Enabled (1 lane each)" +config ENABLE_SDCARD_BIRMANPLUS + bool "Enable SD Card (1 Lane WLAN)" -config WLAN01_BIRMANPLUS - bool "Only WLAN Enabled (2 lanes WLAN, 0 lanes WWAN)" - -config WWAN01_BIRMANPLUS - bool "Only WWAN Enabled (2 lanes WWAN, 0 lanes WLAN)" +config ENABLE_WLAN02_BIRMANPLUS + bool "Enable only WLAN (2 Lanes WLAN)" +config DISABLE_WLAN_SD_BIRMANPLUS + bool "Disable both WLAN and SD Card" endchoice + if !EM100 # EM100 defaults in soc/amd/common/blocks/spi/Kconfig config EFS_SPI_READ_MODE default 3 # Quad IO (1-1-4) diff --git a/src/mainboard/amd/birman_plus/ec.c b/src/mainboard/amd/birman_plus/ec.c index 2ddc0492fb..168da3e829 100644 --- a/src/mainboard/amd/birman_plus/ec.c +++ b/src/mainboard/amd/birman_plus/ec.c @@ -130,21 +130,12 @@ static void configure_ec_gpio(void) ec_write(EC_GPIO_7_ADDR, tmp); tmp = ec_read(EC_GPIO_8_ADDR); - if (CONFIG(ENABLE_M2_SSD1_BIRMANPLUS)) { - tmp |= EC8_DT_N_SSD1_SW; - } else { - tmp &= ~EC8_DT_N_SSD1_SW; - } + tmp |= EC8_DT_N_SSD1_SW; printk(BIOS_SPEW, "Write reg [0x%02x] = 0x%02x\n", EC_GPIO_8_ADDR, tmp); ec_write(EC_GPIO_8_ADDR, tmp); tmp = ec_read(EC_GPIO_9_ADDR); - tmp |= EC9_CAM0_PWR_EN | EC9_CAM1_PWR_EN | EC9_WWAN_RST | EC9_TPM_PWR_EN; - if (CONFIG(ENABLE_DT_SLOT_BIRMANPLUS)) { - tmp |= EC9_DT_PWREN; - } else { - tmp &= ~EC9_DT_PWREN; - } + tmp |= EC9_CAM0_PWR_EN | EC9_CAM1_PWR_EN | EC9_WWAN_RST | EC9_TPM_PWR_EN | EC9_DT_PWREN; printk(BIOS_SPEW, "Write reg [0x%02x] = 0x%02x\n", EC_GPIO_9_ADDR, tmp); ec_write(EC_GPIO_9_ADDR, tmp); @@ -158,12 +149,7 @@ static void configure_ec_gpio(void) ec_write(EC_GPIO_C_ADDR, tmp); tmp = ec_read(EC_GPIO_D_ADDR); - tmp |= ECD_TPNL_PWR_EN | ECD_TPNL_EN | ECD_TPAD_DISABLE_N; - if (CONFIG(ENABLE_M2_SSD1_BIRMANPLUS)) { - tmp |= ECD_SSD1_PWR_EN; - } else { - tmp &= ~ECD_SSD1_PWR_EN; - } + tmp |= ECD_TPNL_PWR_EN | ECD_TPNL_EN | ECD_TPAD_DISABLE_N | ECD_SSD1_PWR_EN; printk(BIOS_SPEW, "Write reg [0x%02x] = 0x%02x\n", EC_GPIO_D_ADDR, tmp); ec_write(EC_GPIO_D_ADDR, tmp); @@ -171,12 +157,12 @@ static void configure_ec_gpio(void) tmp |= ECE_LOM_PWR_EN | ECE_SSD0_PWR_EN | ECE_SD_PWR_EN; tmp |= ECE_CAM_PWR_EN | ECE_FPR_N_GBE_SEL; tmp &= ~ECE_BT_N_TPNL_SEL; - if (CONFIG(WLAN01_BIRMANPLUS)) { // no WWAN, turn off WWAN power + if (CONFIG(DISABLE_WWAN_GBE_BIRMANPLUS)) { // no WWAN, turn off WWAN power tmp &= ~ECE_WWAN_PWR_EN; } else { tmp |= ECE_WWAN_PWR_EN; } - if (CONFIG(WWAN01_BIRMANPLUS)) { // no WLAN, turn off WLAN power + if (CONFIG(DISABLE_WLAN_SD_BIRMANPLUS)) { // no WLAN, turn off WLAN power tmp &= ~ECE_WLAN_PWR_EN; } else { tmp |= ECE_WLAN_PWR_EN; @@ -185,12 +171,12 @@ static void configure_ec_gpio(void) ec_write(EC_GPIO_E_ADDR, tmp); tmp = ec_read(EC_GPIO_F_ADDR); - if (CONFIG(WLAN01_BIRMANPLUS)) { + if (CONFIG(ENABLE_WLAN02_BIRMANPLUS)) { tmp |= ECF_WWAN0_N_WLAN1_SW; } else { tmp &= ~ECF_WWAN0_N_WLAN1_SW; } - if (CONFIG(WWAN01_BIRMANPLUS)) { + if (CONFIG(ENABLE_WWAN02_BIRMANPLUS)) { tmp |= ECF_WLAN0_N_WWAN1_SW; } else { tmp &= ~ECF_WLAN0_N_WWAN1_SW; diff --git a/src/mainboard/amd/birman_plus/port_descriptors_glinda.c b/src/mainboard/amd/birman_plus/port_descriptors_glinda.c index ae6f668f83..b699ca8e16 100644 --- a/src/mainboard/amd/birman_plus/port_descriptors_glinda.c +++ b/src/mainboard/amd/birman_plus/port_descriptors_glinda.c @@ -11,7 +11,7 @@ .engine_type = PCIE_ENGINE, \ .port_present = CONFIG(ENABLE_EVAL_CARD), \ .start_logical_lane = 0, \ - .end_logical_lane = 7, \ + .end_logical_lane = CONFIG(ENABLE_SSD1_BIRMANPLUS) ? 3 : 7, \ .device_number = 3, \ .function_number = 1, \ .link_speed_capability = GEN_MAX, \ @@ -22,6 +22,21 @@ .port_params = {PP_PSPP_AC, 0x144, PP_PSPP_DC, 0x133}, \ } +#define glinda_ssd1_dxio_descriptor { \ + .engine_type = PCIE_ENGINE, \ + .port_present = true, \ + .start_logical_lane = 4, \ + .end_logical_lane = 7, \ + .device_number = 3, \ + .function_number = 2, \ + .link_speed_capability = GEN_MAX, \ + .turn_off_unused_lanes = true, \ + .link_aspm = ASPM_L1, \ + .link_hotplug = HOTPLUG_DISABLED, \ + .clk_req = CLK_REQ1, \ + .port_params = {PP_PSPP_AC, 0x144, PP_PSPP_DC, 0x133}, \ +} + #define glinda_ssd0_dxio_descriptor { \ .engine_type = PCIE_ENGINE, \ .port_present = true, \ @@ -39,11 +54,11 @@ #define glinda_wlan_dxio_descriptor { \ .engine_type = PCIE_ENGINE, \ - .port_present = true, \ - .start_logical_lane = 15, \ + .port_present = !CONFIG(DISABLE_WLAN_SD_BIRMANPLUS), \ + .start_logical_lane = CONFIG(ENABLE_WLAN02_BIRMANPLUS) ? 14 : 15, \ .end_logical_lane = 15, \ .device_number = 2, \ - .function_number = 2, \ + .function_number = 3, \ .link_speed_capability = GEN_MAX, \ .turn_off_unused_lanes = true, \ .link_aspm = ASPM_L1, \ @@ -53,9 +68,9 @@ #define glinda_wwan_dxio_descriptor { \ .engine_type = PCIE_ENGINE, \ - .port_present = true, \ + .port_present = !CONFIG(DISABLE_WWAN_GBE_BIRMANPLUS), \ .start_logical_lane = 12, \ - .end_logical_lane = 12, \ + .end_logical_lane = CONFIG(ENABLE_WWAN02_BIRMANPLUS) ? 13 : 12, \ .device_number = 2, \ .function_number = 5, \ .link_speed_capability = GEN_MAX, \ @@ -91,7 +106,7 @@ .link_speed_capability = GEN_MAX, \ .turn_off_unused_lanes = true, \ .link_aspm = ASPM_L1, \ - .link_hotplug = HOTPLUG_DISABLED, \ + .link_hotplug = HOTPLUG_BASIC, \ .clk_req = CLK_REQ5, \ .port_params = {PP_PSPP_AC, 0x144, PP_PSPP_DC, 0x133}, \ } @@ -170,11 +185,18 @@ void mainboard_get_dxio_ddi_descriptors( static const fsp_dxio_descriptor birmanplus_glinda_dxio_descriptors[] = { glinda_mxm_dxio_descriptor, +#if CONFIG(ENABLE_SSD1_BIRMANPLUS) + glinda_ssd1_dxio_descriptor, +#endif glinda_ssd0_dxio_descriptor, glinda_wlan_dxio_descriptor, glinda_wwan_dxio_descriptor, +#if CONFIG(ENABLE_GBE_BIRMANPLUS) glinda_gbe_dxio_descriptor, +#endif +#if CONFIG(ENABLE_SDCARD_BIRMANPLUS) glinda_sd_dxio_descriptor, +#endif }; *dxio_descs = birmanplus_glinda_dxio_descriptors; diff --git a/src/mainboard/amd/birman_plus/port_descriptors_phoenix.c b/src/mainboard/amd/birman_plus/port_descriptors_phoenix.c index e36e579b9a..0caf713967 100644 --- a/src/mainboard/amd/birman_plus/port_descriptors_phoenix.c +++ b/src/mainboard/amd/birman_plus/port_descriptors_phoenix.c @@ -52,7 +52,7 @@ #define phx_ssd1_dxio_descriptor { \ .engine_type = PCIE_ENGINE, \ - .port_present = true, \ + .port_present = CONFIG(ENABLE_SSD1_BIRMANPLUS), \ .start_lane = 8, \ .end_lane = 11, \ .device_number = 1, \