coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
emmc.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <console/console.h>
4 #include <device/device.h>
5 #include <device/pci.h>
6 #include <device/pci_ids.h>
7 #include <reg_script.h>
8 
9 #include <soc/device_nvs.h>
10 #include <soc/iosf.h>
11 #include <soc/pci_devs.h>
12 #include <soc/ramstage.h>
13 #include "chip.h"
14 
15 static const struct reg_script emmc_ops[] = {
16  /* Enable 2ms card stable feature. */
17  REG_PCI_OR32(0xa8, (1 << 24)),
18  /* Enable HS200 */
19  REG_PCI_WRITE32(0xa0, 0x446cc801),
20  REG_PCI_WRITE32(0xa4, 0x80000807),
21  /* cfio_regs_score_special_bits.sdio1_dummy_loopback_en=1 */
22  REG_IOSF_OR(IOSF_PORT_SCORE, 0x49c0, (1 << 3)),
23  /* CLKGATE_EN_1 . cr_scc_mipihsi_clkgate_en = 1 */
24  REG_IOSF_RMW(IOSF_PORT_CCU, 0x1c, ~(3 << 26), (1 << 26)),
25  /* Set slew for HS200 */
26  REG_IOSF_RMW(IOSF_PORT_SCORE, 0x48c0, ~0x3c, 0x3c),
27  REG_IOSF_RMW(IOSF_PORT_SCORE, 0x48c4, ~0x3c, 0x3c),
28  /* Max timeout */
29  REG_RES_WRITE8(PCI_BASE_ADDRESS_0, 0x002e, 0x0e),
31 };
32 
33 static void emmc_init(struct device *dev)
34 {
36 
37  printk(BIOS_DEBUG, "eMMC init\n");
39 
40  if (config->scc_acpi_mode)
42 }
43 
44 static struct device_operations device_ops = {
46  .set_resources = pci_dev_set_resources,
47  .enable_resources = pci_dev_enable_resources,
48  .init = emmc_init,
49  .ops_pci = &soc_pci_ops,
50 };
51 
52 static const struct pci_driver southcluster __pci_driver = {
53  .ops = &device_ops,
54  .vendor = PCI_VID_INTEL,
55  .device = MMC45_DEVID,
56 };
static struct device_operations device_ops
Definition: emmc.c:44
static const struct pci_driver southcluster __pci_driver
Definition: emmc.c:52
static void emmc_init(struct device *dev)
Definition: emmc.c:33
static const struct reg_script emmc_ops[]
Definition: emmc.c:15
#define SCC_NVS_MMC
Definition: device_nvs.h:23
#define IOSF_PORT_SCORE
Definition: iosf.h:104
#define IOSF_PORT_CCU
Definition: iosf.h:116
#define SCC_MMC_CTL
Definition: iosf.h:286
#define printk(level,...)
Definition: stdlib.h:16
static DEVTREE_CONST void * config_of(const struct device *dev)
Definition: device.h:382
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
Definition: loglevel.h:128
enum board_config config
Definition: memory.c:448
#define PCI_BASE_ADDRESS_0
Definition: pci_def.h:63
void pci_dev_enable_resources(struct device *dev)
Definition: pci_device.c:721
void pci_dev_read_resources(struct device *dev)
Definition: pci_device.c:534
void pci_dev_set_resources(struct device *dev)
Definition: pci_device.c:691
#define PCI_VID_INTEL
Definition: pci_ids.h:2157
#define REG_PCI_OR32(reg_, value_)
Definition: reg_script.h:187
void reg_script_run_on_dev(struct device *dev, const struct reg_script *step)
Definition: reg_script.c:689
#define REG_RES_WRITE8(bar_, reg_, value_)
Definition: reg_script.h:321
#define REG_PCI_WRITE32(reg_, value_)
Definition: reg_script.h:169
#define REG_SCRIPT_END
Definition: reg_script.h:427
struct pci_operations soc_pci_ops
Definition: chip.c:51
#define MMC45_DEVID
Definition: pci_devs.h:119
void scc_enable_acpi_mode(struct device *dev, int iosf_reg, int nvs_index)
Definition: scc.c:71
void(* read_resources)(struct device *dev)
Definition: device.h:39
Definition: device.h:107
struct device * dev
Definition: reg_script.h:78