blob: d132a9777b485602b162cf86c6c89c69ee0436b4 [file] [log] [blame]
Angel Ponsba38f372020-04-05 15:46:45 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2/* This file is part of the coreboot project. */
Lee Leahy77ff0b12015-05-05 15:07:29 -07003
4#include <stdint.h>
Lee Leahy77ff0b12015-05-05 15:07:29 -07005#include <console/console.h>
6#include <device/device.h>
7#include <device/pci.h>
8#include <device/pci_ids.h>
9#include <reg_script.h>
10
11#include <soc/iosf.h>
12#include <soc/nvs.h>
13#include <soc/pci_devs.h>
14#include <soc/ramstage.h>
15#include "chip.h"
16
17static const struct reg_script emmc_ops[] = {
Lee Leahy77ff0b12015-05-05 15:07:29 -070018 REG_SCRIPT_END,
19};
20
Elyes HAOUASb13fac32018-05-24 22:29:44 +020021static void emmc_init(struct device *dev)
Lee Leahy77ff0b12015-05-05 15:07:29 -070022{
Kyösti Mälkki8950cfb2019-07-13 22:16:25 +030023 struct soc_intel_braswell_config *config = config_of(dev);
Lee Leahy77ff0b12015-05-05 15:07:29 -070024
Angel Ponsaee7ab22020-03-19 00:31:58 +010025 printk(BIOS_SPEW, "%s/%s (%s)\n", __FILE__, __func__, dev_name(dev));
Lee Leahy77ff0b12015-05-05 15:07:29 -070026 printk(BIOS_DEBUG, "eMMC init\n");
27 reg_script_run_on_dev(dev, emmc_ops);
28
Lee Leahy32471722015-04-20 15:20:28 -070029 if (config->emmc_acpi_mode) {
30 printk(BIOS_DEBUG, "Enabling ACPI mode\n");
Lee Leahy77ff0b12015-05-05 15:07:29 -070031 scc_enable_acpi_mode(dev, SCC_MMC_CTL, SCC_NVS_MMC);
Lee Leahy32471722015-04-20 15:20:28 -070032 }
Lee Leahy77ff0b12015-05-05 15:07:29 -070033}
34
Lee Leahy32471722015-04-20 15:20:28 -070035static struct device_operations emmc_device_ops = {
Lee Leahy77ff0b12015-05-05 15:07:29 -070036 .read_resources = pci_dev_read_resources,
37 .set_resources = pci_dev_set_resources,
38 .enable_resources = pci_dev_enable_resources,
39 .init = emmc_init,
Lee Leahy77ff0b12015-05-05 15:07:29 -070040 .ops_pci = &soc_pci_ops,
41};
42
43static const struct pci_driver southcluster __pci_driver = {
Lee Leahy32471722015-04-20 15:20:28 -070044 .ops = &emmc_device_ops,
Lee Leahy77ff0b12015-05-05 15:07:29 -070045 .vendor = PCI_VENDOR_ID_INTEL,
46 .device = MMC_DEVID,
47};