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

Commit c0859269 authored by Anton Vorontsov's avatar Anton Vorontsov Committed by Linus Torvalds
Browse files

sdhci-of: avoid writing reserved bits into host control register



SDHCI core tries to write HISPD bit into the host control register, but
the eSDHC controllers don't have that bit, and that causes all sorts of
misbehaviour when using 4-bit mode capable SD cards.

Signed-off-by: default avatarAnton Vorontsov <avorontsov@ru.mvista.com>
Cc: Pierre Ossman <pierre@ossman.eu>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: David Vrabel <david.vrabel@csr.com>
Cc: Ben Dooks <ben@fluff.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1e5df752
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -48,6 +48,8 @@ struct sdhci_of_host {
#define ESDHC_CLOCK_HCKEN	0x00000002
#define ESDHC_CLOCK_HCKEN	0x00000002
#define ESDHC_CLOCK_IPGEN	0x00000001
#define ESDHC_CLOCK_IPGEN	0x00000001


#define ESDHC_HOST_CONTROL_RES	0x05

static u32 esdhc_readl(struct sdhci_host *host, int reg)
static u32 esdhc_readl(struct sdhci_host *host, int reg)
{
{
	return in_be32(host->ioaddr + reg);
	return in_be32(host->ioaddr + reg);
@@ -109,6 +111,10 @@ static void esdhc_writeb(struct sdhci_host *host, u8 val, int reg)
	int base = reg & ~0x3;
	int base = reg & ~0x3;
	int shift = (reg & 0x3) * 8;
	int shift = (reg & 0x3) * 8;


	/* Prevent SDHCI core from writing reserved bits (e.g. HISPD). */
	if (reg == SDHCI_HOST_CONTROL)
		val &= ~ESDHC_HOST_CONTROL_RES;

	clrsetbits_be32(host->ioaddr + base , 0xff << shift, val << shift);
	clrsetbits_be32(host->ioaddr + base , 0xff << shift, val << shift);
}
}