From: Zhang Haijun <b42677@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3 V2] esdhc: Workaround for card can't be detected on T4240QDS
Date: Fri, 10 Jan 2014 11:48:51 +0800 [thread overview]
Message-ID: <52CF6DA3.30402@freescale.com> (raw)
In-Reply-To: <DE65AC0F-FE0C-4767-B53B-74DC453F24C7@antoniou-consulting.com>
Thanks Pantelis.
I'll rework this patch as you suggested.
Thanks.
Regards,
Haijun
? 2014/1/9 18:42, Pantelis Antoniou ??:
> Hi Haijun,
>
> On Dec 11, 2013, at 7:35 AM, Haijun Zhang wrote:
>
>> Card detection pin is ineffective on T4240QDS Rev1.0.
>> There are two cards can be connected to board.
>> 1. eMMC card is built-in board, can not be removed. so
>> For eMMC card it is always there.
>> 2. Card detecting pin is functional for SDHC card in Rev2.0.
>>
>> This workaround force sdhc driver scan and initialize the card
>> regardless of whether the card is inserted or not in case Rev1.0.
>>
>> Signed-off-by: Haijun Zhang <Haijun.Zhang@freescale.com>
>> ---
>> changes for V2:
>> - Add the judgement condition for this broken card
>>
>> drivers/mmc/fsl_esdhc.c | 9 +++++++++
>> include/configs/T4240QDS.h | 2 ++
>> 2 files changed, 11 insertions(+)
>>
>> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
>> index 134a02d..b3b5f37 100644
>> --- a/drivers/mmc/fsl_esdhc.c
>> +++ b/drivers/mmc/fsl_esdhc.c
>> @@ -548,6 +548,15 @@ static int esdhc_getcd(struct mmc *mmc)
>> struct fsl_esdhc *regs = (struct fsl_esdhc *)cfg->esdhc_base;
>> int timeout = 1000;
>>
>> + /*
>> + * Card detecting pin is not functional on T4240QDS with rev 1.0 SoC.
>> + * Presuming card is present.
>> + */
>> +#if defined(CONFIG_T4240QDS)
>> + if (!(readb(QIXIS_BASE + QIXIS_BRDCFG5) & QIXIS_MUX_SDHC) ||
>> + IS_SVR_REV(get_svr(), 1, 0))
>> + return 1;
>> +#endif
> I just don't like this. It's a bunch of completely board specific code dropped
> in the middle of a generic driver.
>
> Rework to something like this:
>
> In the board file (T4240QDS)
>
> #define CONFIG_ESDHC_DETECT_QUIRK \
> (!(readb(QIXIS_BASE + QIXIS_BRDCFG5) & QIXIS_MUX_SDHC) || \
> IS_SVR_REV(get_svr(), 1, 0)))
>
> And do this in the driver:
>
> #ifdef CONFIG_ESDHC_DETECT_QUIRK
> if (CONFIG_ESDHC_DETECT_QUIRK)
> return 1;
> #endif
>
> Do the same to all other quirks please.
>
>> while (!(esdhc_read32(®s->prsstat) & PRSSTAT_CINS) && --timeout)
>> udelay(1000);
>>
>> diff --git a/include/configs/T4240QDS.h b/include/configs/T4240QDS.h
>> index c96df54..955e6b9 100644
>> --- a/include/configs/T4240QDS.h
>> +++ b/include/configs/T4240QDS.h
>> @@ -165,6 +165,8 @@ unsigned long get_board_ddr_clk(void);
>> #define QIXIS_RCFG_CTL_RECONFIG_IDLE 0x20
>> #define QIXIS_RCFG_CTL_RECONFIG_START 0x21
>> #define QIXIS_RCFG_CTL_WATCHDOG_ENBLE 0x08
>> +#define QIXIS_BRDCFG5 0x55
>> +#define QIXIS_MUX_SDHC 2
>> #define QIXIS_BASE_PHYS (0xf00000000ull | QIXIS_BASE)
>>
>> #define CONFIG_SYS_CSPR3_EXT (0xf)
>> --
>> 1.8.4.1
>>
>>
> Regards
>
> -- Pantelis
>
>
>
prev parent reply other threads:[~2014-01-10 3:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-11 5:35 [U-Boot] [PATCH 1/3 V2] esdhc: Workaround for card can't be detected on T4240QDS Haijun Zhang
2013-12-11 5:35 ` [U-Boot] [PATCH 2/3 V2] esdhc: Detecting 8 bit width before mmc initialization Haijun Zhang
2014-01-09 10:43 ` Pantelis Antoniou
2014-01-10 3:55 ` Zhang Haijun
2013-12-11 5:35 ` [U-Boot] [PATCH 3/3 V2] eSDHC: Calculate envaddr accroding to the address format Haijun Zhang
2014-01-09 10:46 ` Pantelis Antoniou
2014-01-09 10:42 ` [U-Boot] [PATCH 1/3 V2] esdhc: Workaround for card can't be detected on T4240QDS Pantelis Antoniou
2014-01-10 3:48 ` Zhang Haijun [this message]
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=52CF6DA3.30402@freescale.com \
--to=b42677@freescale.com \
--cc=u-boot@lists.denx.de \
/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.