From patchwork Tue Nov 8 15:21:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 81347 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp1604256qge; Tue, 8 Nov 2016 07:22:46 -0800 (PST) X-Received: by 10.98.158.155 with SMTP id f27mr24135853pfk.165.1478618566616; Tue, 08 Nov 2016 07:22:46 -0800 (PST) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id d6si37455976pgf.317.2016.11.08.07.22.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Nov 2016 07:22:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id DC53681D8E; Tue, 8 Nov 2016 07:22:42 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-pf0-x230.google.com (mail-pf0-x230.google.com [IPv6:2607:f8b0:400e:c00::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 81C7881D57 for ; Tue, 8 Nov 2016 07:22:41 -0800 (PST) Received: by mail-pf0-x230.google.com with SMTP id i88so109015137pfk.2 for ; Tue, 08 Nov 2016 07:22:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/2U6AuSYFzrCb261svDewKAG3qB+3/PEgpzxDoVefik=; b=aDwIBsk3wnQhS6sUbJuFleiHC+Kz184nG5mq/cs7HW8wsJ0Zo7M1nz+1Yao4MyjSaP dMODxTIKMK+VVr9BeKTyDbCo7INCeOugd7kTBOC9gNc1aApu8Np2suQHzSaJZZJv76g9 1hvPVDeQvSs/599vqBHiqM/sbxETxyjb73gd4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/2U6AuSYFzrCb261svDewKAG3qB+3/PEgpzxDoVefik=; b=WmlPSVT783lcwsDTAr0ZcLLOPV4m/EmBAKLHngfmphczOPCggr0IpC6I9BRkzn+XH8 kfy4wH1EUXnUJRCw+v2QPGkywbP0Ipk9arU2I0+9R6Rn8hR9oda+CtaSvkwqbvWaqvmx 7JXFKz1qhI2zlo0ZL5Xj9WbmIP3Nrsa/4awvPPczrU/2Htt7VuLkjqULS7X3IPvVA+/g IVGCFzU7tMFlvSQgnYsmasuQ2CszSVn0JbB7sCNtuqhYInzxMc3ji0UD8/H9/J7U3JyL XKYBS4xSsPUFwoBD13nYwAi2Tm+PfQ5XzlLPdEvMF2agdsXXrahxheh215Hi8L2WZpGD pm8A== X-Gm-Message-State: ABUngvcyZV61QvGYhWfK3UYeM/KEXTDrzeA47aU3LCp5O6AzvJDlMHD7XB3AqQ0g+PI+7lyi X-Received: by 10.98.147.93 with SMTP id b90mr24155823pfe.170.1478618564387; Tue, 08 Nov 2016 07:22:44 -0800 (PST) Received: from localhost.localdomain ([45.56.159.76]) by smtp.gmail.com with ESMTPSA id g10sm7971804pac.14.2016.11.08.07.22.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Nov 2016 07:22:44 -0800 (PST) From: Haojian Zhuang To: ryan.harkin@linaro.org, edk2-devel@lists.01.org, leif.lindholm@linaro.org, ard.biesheuvel@linaro.org Date: Tue, 8 Nov 2016 23:21:15 +0800 Message-Id: <1478618476-12608-11-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478618476-12608-1-git-send-email-haojian.zhuang@linaro.org> References: <1478618476-12608-1-git-send-email-haojian.zhuang@linaro.org> Subject: [edk2] [PATCH v4 10/11] PL180: update for indentifying SD X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Haojian Zhuang MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 --- ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c b/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c index 5526aac..4d839e7 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);