Debian Codegraph @

src/mainboard/siemens/mc_ehl/variants/mc_ehl4/mainboard.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <baseboard/variants.h>
4 #include <device/pci_ids.h>
5 #include <gpio.h>
6 #include <intelblocks/pcr.h>
7 #include <soc/pci_devs.h>
8 #include <soc/pcr_ids.h>
9
10 #define HOSTCTRL2 0x3E
11 #define HOSTCTRL2_PRESET (1 << 15)
12 #define MMC_CAP_BYP 0x810
13 #define MMC_CAP_BYP_EN 0x5A
14 #define MMC_CAP_BYP_REG1 0x814
15 #define MMC_CAP_BYP_SDR50 (1 << 13)
16 #define MMC_CAP_BYP_SDR104 (1 << 14)
17 #define MMC_CAP_BYP_DDR50 (1 << 15)
18
19 /* Disable SDR104 and SDR50 mode while keeping DDR50 mode enabled. */
20 static void disable_sdr_modes(struct resource *res)
21 {
22 write32(res2mmio(res, MMC_CAP_BYP, 0), MMC_CAP_BYP_EN);
23 clrsetbits32(res2mmio(res, MMC_CAP_BYP_REG1, 0),
24 MMC_CAP_BYP_SDR104 | MMC_CAP_BYP_SDR50,
25 MMC_CAP_BYP_DDR50);
26 }
27
28 void variant_mainboard_final(void)
29 {
30 struct device *dev;
31
32 dev = pcidev_path_on_root(PCH_DEVFN_SDCARD);
33 if (dev) {
34 struct resource *res = probe_resource(dev, PCI_BASE_ADDRESS_0);
35 if (res) {
36 disable_sdr_modes(res);
37
38 /* Use preset driver strength from preset value
39 registers. */
40 clrsetbits16(res2mmio(res, HOSTCTRL2, 0), 0,
41 HOSTCTRL2_PRESET);
42 }
43 }
44 }