public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
To: "ard.biesheuvel@linaro.org" <ard.biesheuvel@linaro.org>,
	"leif.lindholm@linaro.org" <leif.lindholm@linaro.org>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	"jun.nie@linaro.org" <jun.nie@linaro.org>,
	"haojian.zhuang@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 04:26:36 +0000	[thread overview]
Message-ID: <VI1PR04MB4685FE9F13356F2EF553F8538E900@VI1PR04MB4685.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <VI1PR04MB4685998AC4E40161EEABD2428E970@VI1PR04MB4685.eurprd04.prod.outlook.com>

Any comments?

> -----Original Message-----
> From: Meenakshi Aggarwal
> Sent: Tuesday, January 29, 2019 10:13 AM
> To: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>;
> ard.biesheuvel@linaro.org; leif.lindholm@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.
> 
> Hi,
> 
> Please share review comments.
> 
> Thanks,
> Meenakshi
> 
> > -----Original Message-----
> > From: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
> > Sent: Thursday, January 24, 2019 7:35 PM
> > To: ard.biesheuvel@linaro.org; leif.lindholm@linaro.org; edk2-
> > devel@lists.01.org; jun.nie@linaro.org; haojian.zhuang@linaro.org
> > Cc: Meenakshi Aggarwal <meenakshi.aggarwal@nxp.com>
> > Subject: [PATCH v2] SD/eMMC : Fix Command Argument for SD/eMMC R/W
> > operation.
> >
> > Issue : SD read failure for high capacity cards e.g. 64 GB i 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



  reply	other threads:[~2019-01-30  4:26 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 [this message]
2019-01-30 17:49   ` Leif Lindholm

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=VI1PR04MB4685FE9F13356F2EF553F8538E900@VI1PR04MB4685.eurprd04.prod.outlook.com \
    --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