From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-x231.google.com (mail-io0-x231.google.com [IPv6:2607:f8b0:4001:c06::231]) (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 4449A81CA3 for ; Wed, 23 Nov 2016 00:59:30 -0800 (PST) Received: by mail-io0-x231.google.com with SMTP id j65so12937907iof.0 for ; Wed, 23 Nov 2016 00:59:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=3QkwtmblU0wwPXprTqcH8J/qFag6ix0uVrQyeJIamgw=; b=DnJQXrjeLA7gfQsvAqpFbUuoqbxcoqQw8xtuxKK0ZUVvtI7++N8BIWTsTnlAFWWkaW ueDGgiFRXgRyh4O2fyYNadpg6dxI43x4/GU2ADG93BMbEDf5OeBdgGnbWIBHPQkrRgiX gAS0SvtZhzXlL3rYj1HeQDaA2vc1FWRv0Mv4w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=3QkwtmblU0wwPXprTqcH8J/qFag6ix0uVrQyeJIamgw=; b=Rfe0u7DtGDue7MZX9hsNabeXXZWCsXRWs0NRoVoxiP891ckFJVqThvfFkAQnaoM9TU ZctkhMBOECShLaGcR0zWbn2NST7cjwBNDysoE9zozltXO2jiudoCliZsuT9YBQOtXu/L MOYXA6HYXuvgvEjb1nhMqQ4/YWZKnMtSbM9woPIfKob0dLfYXjpyOlYD0Qk/m44xL/Ar PvN4xPPXHU4oiCfmEZ/f3wWH2WnZ93J/SjxgWKuWxYk7zQNQOOFFjrpiKwterCzb5948 zBP43g8erFpsiXUxXasJ/bGSaG0NLt/GeiwTI5rrtH/Rc5IGeXrbHjkZ52kVW7dpY+dX e1iQ== X-Gm-Message-State: AKaTC006+3HwoSpkf+4j/ikR3jr2vtVmW7i9cy9AZtIv6PyV59f7TRk6eVotVTb3xziw0lLOrVmpOlEGBDvYoi6E X-Received: by 10.107.2.8 with SMTP id 8mr1968760ioc.83.1479891569649; Wed, 23 Nov 2016 00:59:29 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.59.147 with HTTP; Wed, 23 Nov 2016 00:59:29 -0800 (PST) In-Reply-To: <1479884921-25398-4-git-send-email-haojian.zhuang@linaro.org> References: <1479884921-25398-1-git-send-email-haojian.zhuang@linaro.org> <1479884921-25398-4-git-send-email-haojian.zhuang@linaro.org> From: Ard Biesheuvel Date: Wed, 23 Nov 2016 08:59:29 +0000 Message-ID: To: Haojian Zhuang Cc: Ryan Harkin , edk2-devel-01 , Leif Lindholm Subject: Re: [PATCH v7 3/4] 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: , X-List-Received-Date: Wed, 23 Nov 2016 08:59:30 -0000 Content-Type: text/plain; charset=UTF-8 On 23 November 2016 at 07:08, Haojian Zhuang wrote: > 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. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Haojian Zhuang > Tested-by: Ryan Harkin Reviewed-by: Ard Biesheuvel > --- > ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c | 29 ++++++++++++++++++++------- > 1 file changed, 22 insertions(+), 7 deletions(-) > > diff --git a/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c b/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c > index 5526aac..b2ba4c0 100644 > --- a/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c > +++ b/ArmPlatformPkg/Drivers/PL180MciDxe/PL180Mci.c > @@ -63,11 +63,6 @@ MciIsReadOnly ( > return (MmioRead32 (FixedPcdGet32 (PcdPL180SysMciRegAddress)) & SYS_MCI_WPROT); > } > > -#if 0 > -//Note: This function has been commented out because it is not used yet. > -// This function could be used to remove the hardcoded BlockLen used > -// in MciPrepareDataPath > - > // Convert block size to 2^n > STATIC > UINT32 > @@ -87,7 +82,6 @@ GetPow2BlockLen ( > > return Pow2BlockLen; > } > -#endif > > VOID > MciPrepareDataPath ( > @@ -126,6 +120,23 @@ 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); > +#ifndef USE_STREAM > + MmioWrite32 (MCI_DATA_CTL_REG, MCI_DATACTL_ENABLE | MCI_DATACTL_CARD_TO_CONT | GetPow2BlockLen (64)); > +#else > + MmioWrite32 (MCI_DATA_CTL_REG, MCI_DATACTL_ENABLE | MCI_DATACTL_CARD_TO_CONT | MCI_DATACTL_STREAM_TRANS); > +#endif > + } else if (MmcCmd == MMC_ACMD51) { > + MmioWrite32 (MCI_DATA_TIMER_REG, 0xFFFFFFF); > + /* SCR register is 8 bytes long. */ > + MmioWrite32 (MCI_DATA_LENGTH_REG, 8); > +#ifndef USE_STREAM > + MmioWrite32 (MCI_DATA_CTL_REG, MCI_DATACTL_ENABLE | MCI_DATACTL_CARD_TO_CONT | GetPow2BlockLen (8)); > +#else > + MmioWrite32 (MCI_DATA_CTL_REG, MCI_DATACTL_ENABLE | MCI_DATACTL_CARD_TO_CONT | MCI_DATACTL_STREAM_TRANS); > +#endif > } > > // Create Command for PL180 > @@ -223,7 +234,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 >