summaryrefslogtreecommitdiff
path: root/src/mainboard
diff options
context:
space:
mode:
authorWerner Zeh <werner.zeh@siemens.com>2022-08-29 09:46:31 +0200
committerFelix Held <felix-coreboot@felixheld.de>2022-09-07 13:56:02 +0000
commit336fdfb65d5693004c345954bef882c91753074d (patch)
tree30aacb7329042db75382f90d8deed650bd569207 /src/mainboard
parentea225cc40fb4263615e92e7df53a12a090635390 (diff)
mb/siemens/mc_ehl2: Limit SD-Card speed modes to DDR50
Due to layout restrictions on mc_ehl2, the SD-card interface is limited to operate in DDR50 mode. The alternative modes SDR104 and SDR50 are not supported. Limit the capabilities in the SD card controller to DDR50 mode only so that the SD card driver in OS will choose the right mode for operation even if the attached SD card supports higher modes. Change-Id: Idc7f1466ec71f4218f6b957cadeeffadd069eb2d Signed-off-by: Werner Zeh <werner.zeh@siemens.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/67169 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Mario Scheithauer <mario.scheithauer@siemens.com>
Diffstat (limited to 'src/mainboard')
-rw-r--r--src/mainboard/siemens/mc_ehl/variants/mc_ehl2/mainboard.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/mainboard/siemens/mc_ehl/variants/mc_ehl2/mainboard.c b/src/mainboard/siemens/mc_ehl/variants/mc_ehl2/mainboard.c
index 36252a79a3..a798398254 100644
--- a/src/mainboard/siemens/mc_ehl/variants/mc_ehl2/mainboard.c
+++ b/src/mainboard/siemens/mc_ehl/variants/mc_ehl2/mainboard.c
@@ -6,8 +6,16 @@
#include <gpio.h>
#include <intelblocks/pcr.h>
#include <soc/gpio.h>
+#include <soc/pci_devs.h>
#include <soc/pcr_ids.h>
+#define SD_CAP_BYP 0x810
+#define SD_CAP_BYP_EN 0x5A
+#define SD_CAP_BYP_REG1 0x814
+#define SD_CAP_BYP_SDR50 (1 << 13)
+#define SD_CAP_BYP_SDR104 (1 << 14)
+#define SD_CAP_BYP_DDR50 (1 << 15)
+
void variant_mainboard_final(void)
{
struct device *dev;
@@ -20,6 +28,22 @@ void variant_mainboard_final(void)
dev = dev_find_device(PCI_VID_TI, PCI_DID_TI_XIO2001, 0);
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;
+ struct resource *res = probe_resource(dev, PCI_BASE_ADDRESS_0);
+ if (!res)
+ return;
+ write32(res2mmio(res, SD_CAP_BYP, 0), SD_CAP_BYP_EN);
+ reg = read32(res2mmio(res, SD_CAP_BYP_REG1, 0));
+ /* Disable SDR104 and SDR50 mode while keeping DDR50 mode enabled. */
+ reg &= ~(SD_CAP_BYP_SDR104 | SD_CAP_BYP_SDR50);
+ reg |= SD_CAP_BYP_DDR50;
+ write32(res2mmio(res, SD_CAP_BYP_REG1, 0), reg);
+ }
}
static void finalize_boot(void *unused)