From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Ben Dooks <ben@fluff.org>,
linux-kernel@vger.kernel.org, sdhci-devel@lists.ossman.eu,
linuxppc-dev@ozlabs.org, Pierre Ossman <pierre@ossman.eu>
Subject: [PATCH 2/4] sdhci-of: Avoid writing reserved bits into host control register
Date: Fri, 7 Aug 2009 20:49:57 +0400 [thread overview]
Message-ID: <20090807164957.GA524@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20090807163940.GA29192@oksana.dev.rtsoft.ru>
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: Anton Vorontsov <avorontsov@ru.mvista.com>
---
drivers/mmc/host/sdhci-of.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/host/sdhci-of.c b/drivers/mmc/host/sdhci-of.c
index 92b5667..8440fd9 100644
--- a/drivers/mmc/host/sdhci-of.c
+++ b/drivers/mmc/host/sdhci-of.c
@@ -48,6 +48,8 @@ struct sdhci_of_host {
#define ESDHC_CLOCK_HCKEN 0x00000002
#define ESDHC_CLOCK_IPGEN 0x00000001
+#define ESDHC_HOST_CONTROL_RES 0x05
+
static u32 esdhc_readl(struct sdhci_host *host, int 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 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);
}
--
1.6.3.3
WARNING: multiple messages have this Message-ID (diff)
From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Pierre Ossman <pierre@ossman.eu>,
Kumar Gala <galak@kernel.crashing.org>, Ben Dooks <ben@fluff.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
linux-kernel@vger.kernel.org, sdhci-devel@lists.ossman.eu,
linuxppc-dev@ozlabs.org
Subject: [PATCH 2/4] sdhci-of: Avoid writing reserved bits into host control register
Date: Fri, 7 Aug 2009 20:49:57 +0400 [thread overview]
Message-ID: <20090807164957.GA524@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <20090807163940.GA29192@oksana.dev.rtsoft.ru>
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: Anton Vorontsov <avorontsov@ru.mvista.com>
---
drivers/mmc/host/sdhci-of.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/host/sdhci-of.c b/drivers/mmc/host/sdhci-of.c
index 92b5667..8440fd9 100644
--- a/drivers/mmc/host/sdhci-of.c
+++ b/drivers/mmc/host/sdhci-of.c
@@ -48,6 +48,8 @@ struct sdhci_of_host {
#define ESDHC_CLOCK_HCKEN 0x00000002
#define ESDHC_CLOCK_IPGEN 0x00000001
+#define ESDHC_HOST_CONTROL_RES 0x05
+
static u32 esdhc_readl(struct sdhci_host *host, int 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 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);
}
--
1.6.3.3
next prev parent reply other threads:[~2009-08-07 16:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-07 16:39 [PATCH 0/4] sdhci-of: Some fixes for high-speed and 4-bit SD cards Anton Vorontsov
2009-08-07 16:39 ` Anton Vorontsov
2009-08-07 16:40 ` [PATCH 1/4] sdhci-of: Fix SD clock calculation Anton Vorontsov
2009-08-07 16:40 ` Anton Vorontsov
2009-08-07 16:49 ` Anton Vorontsov [this message]
2009-08-07 16:49 ` [PATCH 2/4] sdhci-of: Avoid writing reserved bits into host control register Anton Vorontsov
2009-08-07 16:50 ` [PATCH 3/4] sdhci-of: Fix high-speed cards recognition Anton Vorontsov
2009-08-07 16:50 ` Anton Vorontsov
2009-08-07 17:08 ` David Vrabel
2009-08-07 17:08 ` David Vrabel
2009-08-07 18:43 ` Anton Vorontsov
2009-08-07 18:43 ` Anton Vorontsov
2009-08-07 16:50 ` [PATCH 4/4] sdhci-of: Cleanup eSDHC's set_clock() a little bit Anton Vorontsov
2009-08-07 16:50 ` Anton Vorontsov
2009-08-07 18:41 ` [PATCH 0/4] sdhci-of: Some fixes for high-speed and 4-bit SD cards Anton Vorontsov
2009-08-07 18:41 ` Anton Vorontsov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090807164957.GA524@oksana.dev.rtsoft.ru \
--to=avorontsov@ru.mvista.com \
--cc=akpm@linux-foundation.org \
--cc=ben@fluff.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=pierre@ossman.eu \
--cc=sdhci-devel@lists.ossman.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.