blob: aae496a276cf24189693d216e52b06e2c4889a90 [file] [log] [blame]
Lee Leahy77ff0b12015-05-05 15:07:29 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2013 Google Inc.
Lee Leahy32471722015-04-20 15:20:28 -07005 * Copyright (C) 2015 Intel Corp.
Lee Leahy77ff0b12015-05-05 15:07:29 -07006 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Lee Leahy77ff0b12015-05-05 15:07:29 -070015 */
16
17#include <stdint.h>
Lee Leahy77ff0b12015-05-05 15:07:29 -070018#include <console/console.h>
19#include <device/device.h>
20#include <device/pci.h>
21#include <device/pci_ids.h>
22#include <reg_script.h>
23
24#include <soc/iosf.h>
25#include <soc/nvs.h>
26#include <soc/pci_devs.h>
27#include <soc/ramstage.h>
28#include "chip.h"
29
30static const struct reg_script emmc_ops[] = {
Lee Leahy77ff0b12015-05-05 15:07:29 -070031 REG_SCRIPT_END,
32};
33
Elyes HAOUASb13fac32018-05-24 22:29:44 +020034static void emmc_init(struct device *dev)
Lee Leahy77ff0b12015-05-05 15:07:29 -070035{
Kyösti Mälkki8950cfb2019-07-13 22:16:25 +030036 struct soc_intel_braswell_config *config = config_of(dev);
Lee Leahy77ff0b12015-05-05 15:07:29 -070037
Elyes HAOUASa342f392018-10-17 10:56:26 +020038 printk(BIOS_SPEW, "%s/%s (%s)\n",
Lee Leahy32471722015-04-20 15:20:28 -070039 __FILE__, __func__, dev_name(dev));
Lee Leahy77ff0b12015-05-05 15:07:29 -070040 printk(BIOS_DEBUG, "eMMC init\n");
41 reg_script_run_on_dev(dev, emmc_ops);
42
Lee Leahy32471722015-04-20 15:20:28 -070043 if (config->emmc_acpi_mode) {
44 printk(BIOS_DEBUG, "Enabling ACPI mode\n");
Lee Leahy77ff0b12015-05-05 15:07:29 -070045 scc_enable_acpi_mode(dev, SCC_MMC_CTL, SCC_NVS_MMC);
Lee Leahy32471722015-04-20 15:20:28 -070046 }
Lee Leahy77ff0b12015-05-05 15:07:29 -070047}
48
Lee Leahy32471722015-04-20 15:20:28 -070049static struct device_operations emmc_device_ops = {
Lee Leahy77ff0b12015-05-05 15:07:29 -070050 .read_resources = pci_dev_read_resources,
51 .set_resources = pci_dev_set_resources,
52 .enable_resources = pci_dev_enable_resources,
53 .init = emmc_init,
Lee Leahy77ff0b12015-05-05 15:07:29 -070054 .ops_pci = &soc_pci_ops,
55};
56
57static const struct pci_driver southcluster __pci_driver = {
Lee Leahy32471722015-04-20 15:20:28 -070058 .ops = &emmc_device_ops,
Lee Leahy77ff0b12015-05-05 15:07:29 -070059 .vendor = PCI_VENDOR_ID_INTEL,
60 .device = MMC_DEVID,
61};