| 1 |
|
| 2 |
|
| 3 |
#include <device/pci_ops.h> |
| 4 |
#include <console/console.h> |
| 5 |
#include <device/device.h> |
| 6 |
#include <device/pci.h> |
| 7 |
#include <device/pci_ids.h> |
| 8 |
|
| 9 |
#include <soc/device_nvs.h> |
| 10 |
#include <soc/iosf.h> |
| 11 |
#include <soc/pci_devs.h> |
| 12 |
#include <soc/ramstage.h> |
| 13 |
#include "chip.h" |
| 14 |
|
| 15 |
#define CAP_OVERRIDE_LOW 0xa0 |
| 16 |
#define CAP_OVERRIDE_HIGH 0xa4 |
| 17 |
#define USE_CAP_OVERRIDES (1 << 31) |
| 18 |
|
| 19 |
static void sd_init(struct device *dev) |
| 20 |
{ |
| 21 |
struct soc_intel_baytrail_config *config = config_of(dev); |
| 22 |
|
| 23 |
if (config->sdcard_cap_low != 0 || config->sdcard_cap_high != 0) { |
| 24 |
printk(BIOS_DEBUG, "Overriding SD Card controller caps.\n"); |
| 25 |
pci_write_config32(dev, CAP_OVERRIDE_LOW, config->sdcard_cap_low); |
| 26 |
pci_write_config32(dev, CAP_OVERRIDE_HIGH, config->sdcard_cap_high | |
| 27 |
USE_CAP_OVERRIDES); |
| 28 |
} |
| 29 |
|
| 30 |
if (config->scc_acpi_mode) |
| 31 |
scc_enable_acpi_mode(dev, SCC_SD_CTL, SCC_NVS_SD); |
| 32 |
} |
| 33 |
|
| 34 |
static const struct device_operations device_ops = { |
| 35 |
.read_resources = pci_dev_read_resources, |
| 36 |
.set_resources = pci_dev_set_resources, |
| 37 |
.enable_resources = pci_dev_enable_resources, |
| 38 |
.init = sd_init, |
| 39 |
.ops_pci = &soc_pci_ops, |
| 40 |
}; |
| 41 |
|
| 42 |
static const struct pci_driver southcluster __pci_driver = { |
| 43 |
.ops = &device_ops, |
| 44 |
.vendor = PCI_VID_INTEL, |
| 45 |
.device = SD_DEVID, |
| 46 |
}; |