From: Leif Lindholm <leif.lindholm@linaro.org>
To: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
Cc: ard.biesheuvel@linaro.org, edk2-devel@lists.01.org,
jun.nie@linaro.org, haojian.zhuang@linaro.org
Subject: Re: [PATCH v2] SD/eMMC : Fix Command Argument for SD/eMMC R/W operation.
Date: Wed, 30 Jan 2019 17:49:52 +0000 [thread overview]
Message-ID: <20190130174952.aeynrpzdj7glrnym@bivouac.eciton.net> (raw)
In-Reply-To: <1548338718-16247-1-git-send-email-meenakshi.aggarwal@nxp.com>
I updated the subject line to start with EmbeddedPkg: instead.
On Thu, Jan 24, 2019 at 07:35:18PM +0530, Meenakshi Aggarwal wrote:
> Issue : SD read failure for high capacity cards e.g. 64 GB
> i
And I dropped the above stray i.
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Pushed as b566259c8a.
Thanks!
> Reason : Command argument value exceeds 32 bit for block number 0x3787FFF
> and cant be fit into 32 bit wide SD host controller register.
>
> Fix :
> AccessMode bits [29:30] of OCR is a valid definition to calculate
> data address for eMMC cards.
>
> For SD cards, data address is calculated on the basis of
> card capacity status bit[30] of OCR.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
> ---
> EmbeddedPkg/Universal/MmcDxe/Mmc.h | 2 ++
> EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c | 21 ++++++++++++++++-----
> 2 files changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/EmbeddedPkg/Universal/MmcDxe/Mmc.h b/EmbeddedPkg/Universal/MmcDxe/Mmc.h
> index a77ba41..62de2c8 100644
> --- a/EmbeddedPkg/Universal/MmcDxe/Mmc.h
> +++ b/EmbeddedPkg/Universal/MmcDxe/Mmc.h
> @@ -70,6 +70,8 @@
> #define SD_HIGH_SPEED 50000000
> #define SWITCH_CMD_SUCCESS_MASK 0x0f000000
>
> +#define SD_CARD_CAPACITY 0x00000002
> +
> #define BUSWIDTH_4 4
>
> typedef enum {
> diff --git a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c
> index a2b9232..1dea7d3 100644
> --- a/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c
> +++ b/EmbeddedPkg/Universal/MmcDxe/MmcBlockIo.c
> @@ -148,12 +148,23 @@ MmcTransferBlock (
> MmcHostInstance = MMC_HOST_INSTANCE_FROM_BLOCK_IO_THIS (This);
> MmcHost = MmcHostInstance->MmcHost;
>
> - //Set command argument based on the card access mode (Byte mode or Block mode)
> - if ((MmcHostInstance->CardInfo.OCRData.AccessMode & MMC_OCR_ACCESS_MASK) ==
> - MMC_OCR_ACCESS_SECTOR) {
> - CmdArg = Lba;
> + if (MmcHostInstance->CardInfo.CardType != EMMC_CARD) {
> + //Set command argument based on the card capacity
> + //if 0 : SDSC card
> + //if 1 : SDXC/SDHC
> + if (MmcHostInstance->CardInfo.OCRData.AccessMode & SD_CARD_CAPACITY) {
> + CmdArg = Lba;
> + } else {
> + CmdArg = Lba * This->Media->BlockSize;
> + }
> } else {
> - CmdArg = Lba * This->Media->BlockSize;
> + //Set command argument based on the card access mode (Byte mode or Block mode)
> + if ((MmcHostInstance->CardInfo.OCRData.AccessMode & MMC_OCR_ACCESS_MASK) ==
> + MMC_OCR_ACCESS_SECTOR) {
> + CmdArg = Lba;
> + } else {
> + CmdArg = Lba * This->Media->BlockSize;
> + }
> }
>
> Status = MmcHost->SendCommand (MmcHost, Cmd, CmdArg);
> --
> 1.9.1
>
prev parent reply other threads:[~2019-01-30 17:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-16 13:21 [PATCH] SD/eMMC : Fix Command Argument for SD/eMMC R/W operation Meenakshi Aggarwal
2019-01-17 11:23 ` Leif Lindholm
2019-01-22 4:29 ` Meenakshi Aggarwal
2019-01-23 15:04 ` Leif Lindholm
2019-01-24 14:05 ` [PATCH v2] " Meenakshi Aggarwal
2019-01-29 4:43 ` Meenakshi Aggarwal
2019-01-30 4:26 ` Meenakshi Aggarwal
2019-01-30 17:49 ` Leif Lindholm [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-list 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=20190130174952.aeynrpzdj7glrnym@bivouac.eciton.net \
--to=devel@edk2.groups.io \
/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