blob: 715444f295afdf2ae8fec62e4b654a84a2b2a0ea [file] [log] [blame]
Angel Ponsba38f372020-04-05 15:46:45 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Lee Leahy77ff0b12015-05-05 15:07:29 -07002
Lee Leahy77ff0b12015-05-05 15:07:29 -07003#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
Kyösti Mälkkif3f2aa82020-12-21 15:17:01 +02009#include <soc/device_nvs.h>
Lee Leahy77ff0b12015-05-05 15:07:29 -070010#include <soc/iosf.h>
Lee Leahy77ff0b12015-05-05 15:07:29 -070011#include <soc/pci_devs.h>
12#include <soc/ramstage.h>
13#include "chip.h"
14
15static const struct reg_script emmc_ops[] = {
Lee Leahy77ff0b12015-05-05 15:07:29 -070016 REG_SCRIPT_END,
17};
18
Elyes HAOUASb13fac32018-05-24 22:29:44 +020019static void emmc_init(struct device *dev)
Lee Leahy77ff0b12015-05-05 15:07:29 -070020{
Kyösti Mälkki8950cfb2019-07-13 22:16:25 +030021 struct soc_intel_braswell_config *config = config_of(dev);
Lee Leahy77ff0b12015-05-05 15:07:29 -070022
23 printk(BIOS_DEBUG, "eMMC init\n");
24 reg_script_run_on_dev(dev, emmc_ops);
25
Lee Leahy32471722015-04-20 15:20:28 -070026 if (config->emmc_acpi_mode) {
27 printk(BIOS_DEBUG, "Enabling ACPI mode\n");
Lee Leahy77ff0b12015-05-05 15:07:29 -070028 scc_enable_acpi_mode(dev, SCC_MMC_CTL, SCC_NVS_MMC);
Lee Leahy32471722015-04-20 15:20:28 -070029 }
Lee Leahy77ff0b12015-05-05 15:07:29 -070030}
31
Lee Leahy32471722015-04-20 15:20:28 -070032static struct device_operations emmc_device_ops = {
Lee Leahy77ff0b12015-05-05 15:07:29 -070033 .read_resources = pci_dev_read_resources,
34 .set_resources = pci_dev_set_resources,
35 .enable_resources = pci_dev_enable_resources,
36 .init = emmc_init,
Lee Leahy77ff0b12015-05-05 15:07:29 -070037 .ops_pci = &soc_pci_ops,
38};
39
40static const struct pci_driver southcluster __pci_driver = {
Lee Leahy32471722015-04-20 15:20:28 -070041 .ops = &emmc_device_ops,
Felix Singer43b7f412022-03-07 04:34:52 +010042 .vendor = PCI_VID_INTEL,
Lee Leahy77ff0b12015-05-05 15:07:29 -070043 .device = MMC_DEVID,
44};