blob: 742020541072d6a3938d5bd82033e2616b209772 [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.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
Patrick Georgi25509ee2015-03-26 15:17:45 +010018 * Foundation, Inc.
Lee Leahy77ff0b12015-05-05 15:07:29 -070019 */
20
21#include <stdint.h>
22#include <arch/io.h>
23#include <console/console.h>
24#include <device/device.h>
25#include <device/pci.h>
26#include <device/pci_ids.h>
27#include <reg_script.h>
28
29#include <soc/iosf.h>
30#include <soc/nvs.h>
31#include <soc/pci_devs.h>
32#include <soc/ramstage.h>
33#include "chip.h"
34
35static const struct reg_script emmc_ops[] = {
Lee Leahy77ff0b12015-05-05 15:07:29 -070036 REG_SCRIPT_END,
37};
38
39static void emmc_init(device_t dev)
40{
Lee Leahy32471722015-04-20 15:20:28 -070041 struct soc_intel_braswell_config *config = dev->chip_info;
Lee Leahy77ff0b12015-05-05 15:07:29 -070042
Lee Leahy32471722015-04-20 15:20:28 -070043 printk(BIOS_SPEW, "%s/%s ( %s )\n",
44 __FILE__, __func__, dev_name(dev));
Lee Leahy77ff0b12015-05-05 15:07:29 -070045 printk(BIOS_DEBUG, "eMMC init\n");
46 reg_script_run_on_dev(dev, emmc_ops);
47
Lee Leahy32471722015-04-20 15:20:28 -070048 if (config->emmc_acpi_mode) {
49 printk(BIOS_DEBUG, "Enabling ACPI mode\n");
Lee Leahy77ff0b12015-05-05 15:07:29 -070050 scc_enable_acpi_mode(dev, SCC_MMC_CTL, SCC_NVS_MMC);
Lee Leahy32471722015-04-20 15:20:28 -070051 }
Lee Leahy77ff0b12015-05-05 15:07:29 -070052}
53
Lee Leahy32471722015-04-20 15:20:28 -070054static struct device_operations emmc_device_ops = {
Lee Leahy77ff0b12015-05-05 15:07:29 -070055 .read_resources = pci_dev_read_resources,
56 .set_resources = pci_dev_set_resources,
57 .enable_resources = pci_dev_enable_resources,
58 .init = emmc_init,
Lee Leahy77ff0b12015-05-05 15:07:29 -070059 .ops_pci = &soc_pci_ops,
60};
61
62static const struct pci_driver southcluster __pci_driver = {
Lee Leahy32471722015-04-20 15:20:28 -070063 .ops = &emmc_device_ops,
Lee Leahy77ff0b12015-05-05 15:07:29 -070064 .vendor = PCI_VENDOR_ID_INTEL,
65 .device = MMC_DEVID,
66};