From: Haijun Zhang <Haijun.Zhang@freescale.com>
To: <linux-mmc@vger.kernel.org>, <linuxppc-dev@lists.ozlabs.org>
Cc: scottwood@freescale.com, cjb@laptop.org, AFLEMING@freescale.com,
Haijun Zhang <haijun.zhang@freescale.com>,
cbouatmailru@gmail.com
Subject: [PATCH 3/4 V2] mmc: esdhc: Correct host version of T4240-R1.0
Date: Wed, 17 Jul 2013 18:11:30 +0800 [thread overview]
Message-ID: <1374055891-20703-2-git-send-email-Haijun.Zhang@freescale.com> (raw)
In-Reply-To: <1374055891-20703-1-git-send-email-Haijun.Zhang@freescale.com>
Vender version and sdhc spec version of T4240-R1.0 is incorrect.
The right value should be VVN=0x13, SVN = 0x1. The wrong version
number will break down the ADMA data transfer.
This defect only exist in T4240-R1.0. Will be fixed in T4240-R2.0.
Also share vvn and svr for public use.
Signed-off-by: Haijun Zhang <haijun.zhang@freescale.com>
---
changes for V2:
- Remove broken ADMA quirk.
- Rebuild patch of Add quirks to support T4240 board
drivers/mmc/host/sdhci-of-esdhc.c | 29 +++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index adfaadd..570bca8 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -26,7 +26,7 @@
#define VENDOR_V_22 0x12
#define VENDOR_V_23 0x13
-static u32 svr;
+static u32 svr, vvn;
static u32 esdhc_readl(struct sdhci_host *host, int reg)
{
@@ -43,11 +43,9 @@ static u32 esdhc_readl(struct sdhci_host *host, int reg)
* For FSL eSDHC, must aligned 4-byte, so use 0xFC to read the
* the verdor version number, oxFE is SDHCI_HOST_VERSION.
*/
- if ((reg == SDHCI_CAPABILITIES) && (ret & SDHCI_CAN_DO_ADMA1)) {
- u32 tmp = in_be32(host->ioaddr + SDHCI_SLOT_INT_STATUS);
- tmp = (tmp & SDHCI_VENDOR_VER_MASK) >> SDHCI_VENDOR_VER_SHIFT;
- if (tmp > VENDOR_V_22)
- ret |= SDHCI_CAN_DO_ADMA2;
+ if ((reg == SDHCI_CAPABILITIES) && (ret & SDHCI_CAN_DO_ADMA1) &&
+ (vvn > VENDOR_V_22)) {
+ ret |= SDHCI_CAN_DO_ADMA2;
}
return ret;
@@ -63,6 +61,12 @@ static u16 esdhc_readw(struct sdhci_host *host, int reg)
ret = in_be32(host->ioaddr + base) & 0xffff;
else
ret = (in_be32(host->ioaddr + base) >> shift) & 0xffff;
+
+ /* T4240-R1.0 had a incorrect vendor version and spec version */
+ if ((reg == SDHCI_HOST_VERSION) &&
+ ((SVR_SOC_VER(svr) == SVR_T4240) && (SVR_REV(svr) == 0x10)))
+ ret = (VENDOR_V_23 << SDHCI_VENDOR_VER_SHIFT) | SDHCI_SPEC_200;
+
return ret;
}
@@ -175,17 +179,12 @@ static void esdhc_reset(struct sdhci_host *host, u8 mask)
*/
static void esdhci_of_adma_workaround(struct sdhci_host *host, u32 intmask)
{
- u32 tmp;
bool applicable;
dma_addr_t dmastart;
dma_addr_t dmanow;
- tmp = esdhc_readl(host, SDHCI_SLOT_INT_STATUS);
- tmp = (tmp & SDHCI_VENDOR_VER_MASK) >> SDHCI_VENDOR_VER_SHIFT;
-
applicable = (intmask & SDHCI_INT_DATA_END) &&
- (intmask & SDHCI_INT_BLK_GAP) &&
- (tmp == VENDOR_V_23);
+ (intmask & SDHCI_INT_BLK_GAP) && (vvn == VENDOR_V_23);
if (applicable) {
esdhc_reset(host, SDHCI_RESET_DATA);
@@ -318,10 +317,9 @@ static void esdhc_of_resume(struct sdhci_host *host)
static void esdhc_of_platform_init(struct sdhci_host *host)
{
- u32 vvn;
+ svr = mfspr(SPRN_SVR);
+ vvn = esdhc_readw(host, SDHCI_HOST_VERSION);
- vvn = in_be32(host->ioaddr + SDHCI_SLOT_INT_STATUS);
- vvn = (vvn & SDHCI_VENDOR_VER_MASK) >> SDHCI_VENDOR_VER_SHIFT;
if (vvn == VENDOR_V_22)
host->quirks2 |= SDHCI_QUIRK2_HOST_NO_CMD23;
@@ -390,7 +388,6 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)
struct device_node *np;
int ret;
- svr = mfspr(SPRN_SVR);
host = sdhci_pltfm_init(pdev, &sdhci_esdhc_pdata, 0);
if (IS_ERR(host))
return PTR_ERR(host);
--
1.8.0
next prev parent reply other threads:[~2013-07-17 11:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-17 10:11 [PATCH 2/4 V2] mmc: esdhc: workaround for dma err in the last system transaction Haijun Zhang
2013-07-17 10:11 ` Haijun Zhang [this message]
2013-07-17 17:11 ` [PATCH 3/4 V2] mmc: esdhc: Correct host version of T4240-R1.0 Scott Wood
2013-07-18 2:30 ` Zang Roy-R61911
2013-07-18 15:24 ` Scott Wood
2013-07-22 14:30 ` Kumar Gala
2013-07-23 2:03 ` Zhang Haijun-B42677
2013-07-17 10:11 ` [PATCH 4/4 V2] mmc: esdhc: Add broken timeout quirk for p4/p5 board Haijun Zhang
2013-07-17 17:13 ` Scott Wood
2013-07-19 2:19 ` Zhang Haijun-B42677
2013-07-19 17:24 ` Scott Wood
2013-07-22 1:57 ` Zhang Haijun-B42677
2013-07-19 2:21 ` [PATCH 2/4 V2] mmc: esdhc: workaround for dma err in the last system transaction Zhang Haijun-B42677
2013-08-23 6:39 ` Zhang Haijun
2013-08-23 15:40 ` Scott Wood
2013-08-26 1:03 ` Zhang Haijun
2013-08-26 1:50 ` Zhang Haijun
2013-08-26 16:36 ` Scott Wood
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=1374055891-20703-2-git-send-email-Haijun.Zhang@freescale.com \
--to=haijun.zhang@freescale.com \
--cc=AFLEMING@freescale.com \
--cc=cbouatmailru@gmail.com \
--cc=cjb@laptop.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=scottwood@freescale.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).