Angel Pons | ba38f37 | 2020-04-05 15:46:45 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 2 | |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 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 | |
Kyösti Mälkki | f3f2aa8 | 2020-12-21 15:17:01 +0200 | [diff] [blame] | 9 | #include <soc/device_nvs.h> |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 10 | #include <soc/iosf.h> |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 11 | #include <soc/pci_devs.h> |
| 12 | #include <soc/ramstage.h> |
| 13 | #include "chip.h" |
| 14 | |
| 15 | static const struct reg_script emmc_ops[] = { |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 16 | REG_SCRIPT_END, |
| 17 | }; |
| 18 | |
Elyes HAOUAS | b13fac3 | 2018-05-24 22:29:44 +0200 | [diff] [blame] | 19 | static void emmc_init(struct device *dev) |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 20 | { |
Kyösti Mälkki | 8950cfb | 2019-07-13 22:16:25 +0300 | [diff] [blame] | 21 | struct soc_intel_braswell_config *config = config_of(dev); |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 22 | |
| 23 | printk(BIOS_DEBUG, "eMMC init\n"); |
| 24 | reg_script_run_on_dev(dev, emmc_ops); |
| 25 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 26 | if (config->emmc_acpi_mode) { |
| 27 | printk(BIOS_DEBUG, "Enabling ACPI mode\n"); |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 28 | scc_enable_acpi_mode(dev, SCC_MMC_CTL, SCC_NVS_MMC); |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 29 | } |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 30 | } |
| 31 | |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 32 | static struct device_operations emmc_device_ops = { |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 33 | .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 Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 37 | .ops_pci = &soc_pci_ops, |
| 38 | }; |
| 39 | |
| 40 | static const struct pci_driver southcluster __pci_driver = { |
Lee Leahy | 3247172 | 2015-04-20 15:20:28 -0700 | [diff] [blame] | 41 | .ops = &emmc_device_ops, |
Lee Leahy | 77ff0b1 | 2015-05-05 15:07:29 -0700 | [diff] [blame] | 42 | .vendor = PCI_VENDOR_ID_INTEL, |
| 43 | .device = MMC_DEVID, |
| 44 | }; |