public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Haojian Zhuang <haojian.zhuang@linaro.org>
To: ryan.harkin@linaro.org, edk2-devel@lists.01.org,
	leif.lindholm@linaro.org, ard.biesheuvel@linaro.org
Cc: Haojian Zhuang <haojian.zhuang@linaro.org>
Subject: [PATCH v3 10/10] PL180: update for indentifying SD
Date: Wed, 21 Sep 2016 23:02:27 +0800	[thread overview]
Message-ID: <1474470147-23156-11-git-send-email-haojian.zhuang@linaro.org> (raw)
In-Reply-To: <1474470147-23156-1-git-send-email-haojian.zhuang@linaro.org>

When CMD6 & ACMD51 are added into indentifying SD process, PL180
should also support CMD6 & ACMD51. Otherwise, it'll hang when
system tries to read expected data.

Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
---
 ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c b/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c
index 5526aac..7647608 100644
--- a/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c
+++ b/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c
@@ -126,6 +126,15 @@ MciSendCommand (
     MciPrepareDataPath (MCI_DATACTL_CARD_TO_CONT);
   } else if ((MmcCmd == MMC_CMD24) || (MmcCmd == MMC_CMD20)) {
     MciPrepareDataPath (MCI_DATACTL_CONT_TO_CARD);
+  } else if (MmcCmd == MMC_CMD6) {
+    MmioWrite32 (MCI_DATA_TIMER_REG, 0xFFFFFFF);
+    MmioWrite32 (MCI_DATA_LENGTH_REG, 64);
+    MmioWrite32 (MCI_DATA_CTL_REG, MCI_DATACTL_ENABLE | MCI_DATACTL_CARD_TO_CONT | MCI_DATACTL_STREAM_TRANS);
+  } else if (MmcCmd == MMC_ACMD51) {
+    MmioWrite32 (MCI_DATA_TIMER_REG, 0xFFFFFFF);
+    /* SCR register is 8 bytes long. */
+    MmioWrite32 (MCI_DATA_LENGTH_REG, 8);
+    MmioWrite32 (MCI_DATA_CTL_REG, MCI_DATACTL_ENABLE | MCI_DATACTL_CARD_TO_CONT | MCI_DATACTL_STREAM_TRANS);
   }
 
   // Create Command for PL180
@@ -223,7 +232,11 @@ MciReadBlockData (
 
   // Read data from the RX FIFO
   Loop   = 0;
-  Finish = MMCI0_BLOCKLEN / 4;
+  if (Length < MMCI0_BLOCKLEN) {
+    Finish = Length / 4;
+  } else {
+    Finish = MMCI0_BLOCKLEN / 4;
+  }
 
   // Raise the TPL at the highest level to disable Interrupts.
   Tpl = gBS->RaiseTPL (TPL_HIGH_LEVEL);
-- 
2.7.4



  parent reply	other threads:[~2016-09-21 15:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21 15:02 [PATCH v3 00/10] enhance mmc Haojian Zhuang
2016-09-21 15:02 ` [PATCH v3 01/10] MmcDxe: wait OCR busy bit free Haojian Zhuang
2016-09-21 15:02 ` [PATCH v3 02/10] MmcDxe: move ECSD into CardInfo structure Haojian Zhuang
2016-09-21 15:02 ` [PATCH v3 03/10] MmcDxe: add SPEC_VERS field in CSD structure Haojian Zhuang
2016-09-21 15:02 ` [PATCH v3 04/10] MmcDxe: add interface to change io width and speed Haojian Zhuang
2016-09-21 15:02 ` [PATCH v3 05/10] MmcDxe: declare ECSD structure Haojian Zhuang
2016-09-21 15:02 ` [PATCH v3 06/10] MmcDxe: set io bus width before reading EXTCSD Haojian Zhuang
2016-09-21 15:02 ` [PATCH v3 07/10] MmcDxe: Fix uninitialized mediaid for SD Haojian Zhuang
2016-09-21 15:02 ` [PATCH v3 08/10] MmcDxe: set iospeed and bus width in SD stack Haojian Zhuang
2016-09-21 15:02 ` [PATCH v3 09/10] MmcDxe: expand to support multiple blocks Haojian Zhuang
2016-09-21 15:02 ` Haojian Zhuang [this message]
2016-10-11 16:22 ` [PATCH v3 00/10] enhance mmc Ryan Harkin
2016-10-11 16:24   ` Ard Biesheuvel
2016-10-11 16:27     ` Ryan Harkin
2016-10-11 16:28       ` Ard Biesheuvel
2016-10-11 17:03         ` Ryan Harkin
2016-10-11 23:33           ` Haojian Zhuang
2016-10-12  5:32             ` Ryan Harkin

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=1474470147-23156-11-git-send-email-haojian.zhuang@linaro.org \
    --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