Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 68077b02 authored by Major Lee's avatar Major Lee Committed by Chris Ball
Browse files

mmc: sdhci-pci: add 8-bit bus width support for mrst hc0



And hook platform_8bit_width to support 8-bit bus width.

Signed-off-by: default avatarMajor Lee <major_lee@wistron.com>
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarDirk Brandewie <dirk.brandewie@gmail.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent 94dd5b33
Loading
Loading
Loading
Loading
+33 −0
Original line number Original line Diff line number Diff line
@@ -143,6 +143,12 @@ static const struct sdhci_pci_fixes sdhci_cafe = {
			  SDHCI_QUIRK_BROKEN_TIMEOUT_VAL,
			  SDHCI_QUIRK_BROKEN_TIMEOUT_VAL,
};
};


static int mrst_hc_probe_slot(struct sdhci_pci_slot *slot)
{
	slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA;
	return 0;
}

/*
/*
 * ADMA operation is disabled for Moorestown platform due to
 * ADMA operation is disabled for Moorestown platform due to
 * hardware bugs.
 * hardware bugs.
@@ -159,6 +165,7 @@ static int mrst_hc_probe(struct sdhci_pci_chip *chip)


static const struct sdhci_pci_fixes sdhci_intel_mrst_hc0 = {
static const struct sdhci_pci_fixes sdhci_intel_mrst_hc0 = {
	.quirks		= SDHCI_QUIRK_BROKEN_ADMA | SDHCI_QUIRK_NO_HISPD_BIT,
	.quirks		= SDHCI_QUIRK_BROKEN_ADMA | SDHCI_QUIRK_NO_HISPD_BIT,
	.probe_slot	= mrst_hc_probe_slot,
};
};


static const struct sdhci_pci_fixes sdhci_intel_mrst_hc1_hc2 = {
static const struct sdhci_pci_fixes sdhci_intel_mrst_hc1_hc2 = {
@@ -789,8 +796,34 @@ static int sdhci_pci_enable_dma(struct sdhci_host *host)
	return 0;
	return 0;
}
}


static int sdhci_pci_8bit_width(struct sdhci_host *host, int width)
{
	u8 ctrl;

	ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);

	switch (width) {
	case MMC_BUS_WIDTH_8:
		ctrl |= SDHCI_CTRL_8BITBUS;
		ctrl &= ~SDHCI_CTRL_4BITBUS;
		break;
	case MMC_BUS_WIDTH_4:
		ctrl |= SDHCI_CTRL_4BITBUS;
		ctrl &= ~SDHCI_CTRL_8BITBUS;
		break;
	default:
		ctrl &= ~(SDHCI_CTRL_8BITBUS | SDHCI_CTRL_4BITBUS);
		break;
	}

	sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);

	return 0;
}

static struct sdhci_ops sdhci_pci_ops = {
static struct sdhci_ops sdhci_pci_ops = {
	.enable_dma	= sdhci_pci_enable_dma,
	.enable_dma	= sdhci_pci_enable_dma,
	.platform_8bit_width	= sdhci_pci_8bit_width,
};
};


/*****************************************************************************\
/*****************************************************************************\