From 7749088de7494edbc4ff048dd2f2b16cce189f84 Mon Sep 17 00:00:00 2001 From: Mario Scheithauer Date: Tue, 26 Nov 2024 12:30:00 +0100 Subject: mb/siemens/mc_ehl5: Provide static function for disabling SDR modes As the functionality is required for other devices, it makes sense to provide a function for this. Change-Id: If1f070eebd365de93d4bce13d5201045d3306b17 Signed-off-by: Mario Scheithauer Reviewed-on: https://review.coreboot.org/c/coreboot/+/85324 Tested-by: build bot (Jenkins) Reviewed-by: Werner Zeh --- .../siemens/mc_ehl/variants/mc_ehl5/mainboard.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/mainboard') diff --git a/src/mainboard/siemens/mc_ehl/variants/mc_ehl5/mainboard.c b/src/mainboard/siemens/mc_ehl/variants/mc_ehl5/mainboard.c index a1ce64aef3..e6e7e7129e 100644 --- a/src/mainboard/siemens/mc_ehl/variants/mc_ehl5/mainboard.c +++ b/src/mainboard/siemens/mc_ehl/variants/mc_ehl5/mainboard.c @@ -17,6 +17,17 @@ #define MMC_CAP_BYP_SDR104 (1 << 14) #define MMC_CAP_BYP_DDR50 (1 << 15) +/* Disable SDR104 and SDR50 mode while keeping DDR50 mode enabled. */ +static void disable_sdr_modes(struct resource *res) +{ + uint32_t reg; + write32(res2mmio(res, MMC_CAP_BYP, 0), MMC_CAP_BYP_EN); + reg = read32(res2mmio(res, MMC_CAP_BYP_REG1, 0)); + reg &= ~(MMC_CAP_BYP_SDR104 | MMC_CAP_BYP_SDR50); + reg |= MMC_CAP_BYP_DDR50; + write32(res2mmio(res, MMC_CAP_BYP_REG1, 0), reg); +} + void variant_mainboard_final(void) { struct device *dev; @@ -30,21 +41,14 @@ void variant_mainboard_final(void) if (dev) pci_write_config8(dev, 0xd8, 0x3e); - /* Limit SD-Card speed to DDR50 mode to avoid SDR104/SDR50 modes due to - layout limitations. */ dev = pcidev_path_on_root(PCH_DEVFN_SDCARD); if (dev) { - uint32_t reg; uint16_t reg16; struct resource *res = probe_resource(dev, PCI_BASE_ADDRESS_0); if (!res) return; - write32(res2mmio(res, MMC_CAP_BYP, 0), MMC_CAP_BYP_EN); - reg = read32(res2mmio(res, MMC_CAP_BYP_REG1, 0)); - /* Disable SDR104 and SDR50 mode while keeping DDR50 mode enabled. */ - reg &= ~(MMC_CAP_BYP_SDR104 | MMC_CAP_BYP_SDR50); - reg |= MMC_CAP_BYP_DDR50; - write32(res2mmio(res, MMC_CAP_BYP_REG1, 0), reg); + + disable_sdr_modes(res); /* Use preset driver strength from preset value registers. */ reg16 = read16(res2mmio(res, HOSTCTRL2, 0)); -- cgit v1.2.3