Felix Held has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/82106?usp=email )
Change subject: mb/amd/birman: add function to update MPIO config in devicetree ......................................................................
mb/amd/birman: add function to update MPIO config in devicetree
When the Kconfig options WLAN01 or WWAN01 are set, some of the MPIO descriptor information the devicetree needs to be updated and some of the bridges to the PCIe ports need to be disabled. Since the code has paths and names specific to the MPIO stub, include the update_devicetree_phoenix_opensil.c file depending on whether CONFIG_SOC_AMD_OPENSIL_STUB is selected and not depending on whether CONFIG_BOARD_AMD_BIRMAN_PHOENIX_OPENSIL is selected.
Signed-off-by: Felix Held felix-coreboot@felixheld.de Change-Id: I23c14cc03980ea1e39f7e5aec551b975c237e487 --- M src/mainboard/amd/birman/Makefile.mk M src/mainboard/amd/birman/mainboard.c A src/mainboard/amd/birman/update_devicetree.h A src/mainboard/amd/birman/update_devicetree_phoenix_opensil.c 4 files changed, 40 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/06/82106/1
diff --git a/src/mainboard/amd/birman/Makefile.mk b/src/mainboard/amd/birman/Makefile.mk index 6c417ce..2312d24 100644 --- a/src/mainboard/amd/birman/Makefile.mk +++ b/src/mainboard/amd/birman/Makefile.mk @@ -9,6 +9,7 @@
ramstage-y += chromeos.c ramstage-y += gpio.c +ramstage-$(CONFIG_SOC_AMD_OPENSIL_STUB) += update_devicetree_phoenix_opensil.c ramstage-$(CONFIG_BOARD_AMD_BIRMAN_PHOENIX_FSP) += port_descriptors_phoenix.c ramstage-$(CONFIG_BOARD_AMD_BIRMAN_GLINDA) += port_descriptors_glinda.c
diff --git a/src/mainboard/amd/birman/mainboard.c b/src/mainboard/amd/birman/mainboard.c index 0deba67..f2d3ef9 100644 --- a/src/mainboard/amd/birman/mainboard.c +++ b/src/mainboard/amd/birman/mainboard.c @@ -6,6 +6,7 @@ #include <device/device.h> #include <types.h> #include "gpio.h" +#include "update_devicetree.h"
/* TODO: Update for birman */
@@ -58,6 +59,9 @@ static void mainboard_init(void *chip_info) { mainboard_program_gpios(); + + if (CONFIG(BOARD_AMD_BIRMAN_PHOENIX_OPENSIL)) + mainboard_update_devicetree_opensil(); }
struct chip_operations mainboard_ops = { diff --git a/src/mainboard/amd/birman/update_devicetree.h b/src/mainboard/amd/birman/update_devicetree.h new file mode 100644 index 0000000..6f98dbd --- /dev/null +++ b/src/mainboard/amd/birman/update_devicetree.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef MAINBOARD_UPDATE_DEVICETREE_H +#define MAINBOARD_UPDATE_DEVICETREE_H + +void mainboard_update_devicetree_opensil(void); + +#endif /* MAINBOARD_UPDATE_DEVICETREE_H */ diff --git a/src/mainboard/amd/birman/update_devicetree_phoenix_opensil.c b/src/mainboard/amd/birman/update_devicetree_phoenix_opensil.c new file mode 100644 index 0000000..ad39b55 --- /dev/null +++ b/src/mainboard/amd/birman/update_devicetree_phoenix_opensil.c @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <device/device.h> +#include <vendorcode/amd/opensil/stub/mpio/chip.h> +#include "update_devicetree.h" + +static void mainboard_update_mpio(void) +{ + struct device *wwan_bridge = DEV_PTR(gpp_bridge_2_2); + struct device *wlan_bridge = DEV_PTR(gpp_bridge_2_3); + struct vendorcode_amd_opensil_stub_mpio_config *wwan_bridge_cfg = config_of(wwan_bridge); + struct vendorcode_amd_opensil_stub_mpio_config *wlan_bridge_cfg = config_of(wlan_bridge); + + if (CONFIG(WLAN01)) { + wwan_bridge->enabled = false; + wlan_bridge_cfg->end_lane = 14; + } + if (CONFIG(WWAN01)) { + wlan_bridge->enabled = false; + wwan_bridge_cfg->end_lane = 15; + } +} + +void mainboard_update_devicetree_opensil(void) +{ + mainboard_update_mpio(); +}