| 1 |
|
| 2 |
|
| 3 |
#include <baseboard/variants.h> |
| 4 |
#include <bootstate.h> |
| 5 |
#include <device/pci_ids.h> |
| 6 |
#include <gpio.h> |
| 7 |
#include <intelblocks/pcr.h> |
| 8 |
#include <soc/pci_devs.h> |
| 9 |
#include <soc/pcr_ids.h> |
| 10 |
|
| 11 |
#define HOSTCTRL2 0x3E |
| 12 |
#define HOSTCTRL2_PRESET (1 << 15) |
| 13 |
#define MMC_CAP_BYP 0x810 |
| 14 |
#define MMC_CAP_BYP_EN 0x5A |
| 15 |
#define MMC_CAP_BYP_REG1 0x814 |
| 16 |
#define MMC_CAP_BYP_SDR50 (1 << 13) |
| 17 |
#define MMC_CAP_BYP_SDR104 (1 << 14) |
| 18 |
#define MMC_CAP_BYP_DDR50 (1 << 15) |
| 19 |
|
| 20 |
|
| 21 |
static void disable_sdr_modes(struct resource *res) |
| 22 |
{ |
| 23 |
write32(res2mmio(res, MMC_CAP_BYP, 0), MMC_CAP_BYP_EN); |
| 24 |
clrsetbits32(res2mmio(res, MMC_CAP_BYP_REG1, 0), |
| 25 |
MMC_CAP_BYP_SDR104 | MMC_CAP_BYP_SDR50, |
| 26 |
MMC_CAP_BYP_DDR50); |
| 27 |
} |
| 28 |
|
| 29 |
void variant_mainboard_final(void) |
| 30 |
{ |
| 31 |
struct device *dev; |
| 32 |
|
| 33 |
dev = pcidev_path_on_root(PCH_DEVFN_SDCARD); |
| 34 |
if (dev) { |
| 35 |
struct resource *res = probe_resource(dev, PCI_BASE_ADDRESS_0); |
| 36 |
if (res) { |
| 37 |
disable_sdr_modes(res); |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
clrsetbits16(res2mmio(res, HOSTCTRL2, 0), 0, |
| 42 |
HOSTCTRL2_PRESET); |
| 43 |
} |
| 44 |
} |
| 45 |
|
| 46 |
dev = pcidev_path_on_root(PCH_DEVFN_EMMC); |
| 47 |
if (dev) { |
| 48 |
struct resource *res = probe_resource(dev, PCI_BASE_ADDRESS_0); |
| 49 |
if (res) |
| 50 |
disable_sdr_modes(res); |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
static void finalize_boot(void *unused) |
| 55 |
{ |
| 56 |
|
| 57 |
gpio_output(GPP_F20, 1); |
| 58 |
} |
| 59 |
|
| 60 |
BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_BOOT, BS_ON_ENTRY, finalize_boot, NULL); |