From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 1/4] mmc: fsl_esdhc: Add CMD11 support to switch to 1.8V
Date: Tue, 17 Feb 2015 20:41:44 +0100 [thread overview]
Message-ID: <201502172041.44596.marex@denx.de> (raw)
In-Reply-To: <1424176966-24749-1-git-send-email-otavio@ossystems.com.br>
On Tuesday, February 17, 2015 at 01:42:43 PM, Otavio Salvador wrote:
> This adds support to switch to 1.8V in case CMD11 succeeds.
>
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> ---
>
> Changes in v2:
> - Fixed split string (Marek)
>
> drivers/mmc/fsl_esdhc.c | 29 ++++++++++++++++++++++-------
> include/fsl_esdhc.h | 2 ++
> include/mmc.h | 1 +
> 3 files changed, 25 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
> index c55eb28..6a3e147 100644
> --- a/drivers/mmc/fsl_esdhc.c
> +++ b/drivers/mmc/fsl_esdhc.c
> @@ -54,19 +54,21 @@ struct fsl_esdhc {
> uint fevt; /* Force event register */
> uint admaes; /* ADMA error status register */
> uint adsaddr; /* ADMA system address register */
> - char reserved2[160]; /* reserved */
> + char reserved2[100]; /* reserved */
> + uint vendorspec; /* Vendor Specific register */
> + char reserved3[59]; /* reserved */
> uint hostver; /* Host controller version register */
> - char reserved3[4]; /* reserved */
> - uint dmaerraddr; /* DMA error address register */
> char reserved4[4]; /* reserved */
> - uint dmaerrattr; /* DMA error attribute register */
> + uint dmaerraddr; /* DMA error address register */
> char reserved5[4]; /* reserved */
> + uint dmaerrattr; /* DMA error attribute register */
> + char reserved6[4]; /* reserved */
> uint hostcapblt2; /* Host controller capabilities register 2 */
> - char reserved6[8]; /* reserved */
> + char reserved7[8]; /* reserved */
> uint tcr; /* Tuning control register */
> - char reserved7[28]; /* reserved */
> + char reserved8[28]; /* reserved */
> uint sddirctl; /* SD direction control register */
> - char reserved8[712]; /* reserved */
> + char reserved9[712]; /* reserved */
> uint scr; /* eSDHC control register */
> };
>
> @@ -341,6 +343,15 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
> struct mmc_data *data) goto out;
> }
>
> + /* Switch voltage to 1.8V if CMD11 succeeded */
> + if (cmd->cmdidx == SD_CMD_SWITCH_UHS18V) {
> + esdhc_setbits32(®s->vendorspec, ESDHC_VENDORSPEC_VSELECT);
> +
> + printf("Run CMD11 1.8V switch\n");
> + /* Sleep for 5 ms - max time for card to switch to 1.8V */
> + udelay(5000);
> + }
> +
> /* Workaround for ESDHC errata ENGcm03648 */
> if (!data && (cmd->resp_type & MMC_RSP_BUSY)) {
> int timeout = 2500;
> @@ -413,6 +424,10 @@ out:
> while ((esdhc_read32(®s->sysctl) & SYSCTL_RSTD))
> ;
This endless loop could use fixing ... anyone ?
> }
> +
> + /* If this was CMD11, then notify that power cycle is needed */
> + if (cmd->cmdidx == SD_CMD_SWITCH_UHS18V)
> + printf("CMD11 to switch to 1.8V mode failed, card
requires power
> cycle.\n"); }
>
> esdhc_write32(®s->irqstat, -1);
Reviewed-by: Marek Vasut <marex@denx.de>
next prev parent reply other threads:[~2015-02-17 19:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-17 12:42 [U-Boot] [PATCH v2 1/4] mmc: fsl_esdhc: Add CMD11 support to switch to 1.8V Otavio Salvador
2015-02-17 12:42 ` [U-Boot] [PATCH v2 2/4] mmc: fsl_esdhc: Add support to force VSELECT set Otavio Salvador
2015-02-23 8:19 ` Stefano Babic
2015-02-17 12:42 ` [U-Boot] [PATCH v2 3/4] imx: mx6sl: Extend USDHC SD2 pins to support 8-wire use Otavio Salvador
2015-02-23 8:19 ` Stefano Babic
2015-02-17 12:42 ` [U-Boot] [PATCH v2 4/4] warp: Add initial WaRP Board support Otavio Salvador
2015-02-23 8:19 ` Stefano Babic
2015-02-17 19:41 ` Marek Vasut [this message]
2015-02-23 8:19 ` [U-Boot] [PATCH v2 1/4] mmc: fsl_esdhc: Add CMD11 support to switch to 1.8V Stefano Babic
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=201502172041.44596.marex@denx.de \
--to=marex@denx.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox