diff options
author | Mario Scheithauer <mario.scheithauer@siemens.com> | 2024-11-26 12:30:00 +0100 |
---|---|---|
committer | Werner Zeh <werner.zeh@siemens.com> | 2024-11-29 08:51:49 +0000 |
commit | 7749088de7494edbc4ff048dd2f2b16cce189f84 (patch) | |
tree | 8104ffee40c39f671e3f8bee60086e0e37d97ebb | |
parent | 2d9a82cf8a572962eb5390eb04dfeb3f568b5124 (diff) |
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 <mario.scheithauer@siemens.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/85324
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
-rw-r--r-- | src/mainboard/siemens/mc_ehl/variants/mc_ehl5/mainboard.c | 22 |
1 files changed, 13 insertions, 9 deletions
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)); |