From patchwork Fri Jun 30 03:02:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 106658 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1800038qge; Thu, 29 Jun 2017 20:03:20 -0700 (PDT) X-Received: by 10.237.63.141 with SMTP id s13mr24530174qth.61.1498791800077; Thu, 29 Jun 2017 20:03:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498791800; cv=none; d=google.com; s=arc-20160816; b=h+ahMEDNMQXHXq4dpKiFPL4CJAuJFS0+FHmfc8+/iUfAaKOdoNOAb7L2ztSoAcDy08 ogM6tdzLv2lk8JKYOT7MV3sC/JiRa1uaYtb2ztoKdgUGAlqq2EtTv59h0fy99yIaP2Rh 0rTkXkRcTvNP/vp1Xb6apre5HIW0BGsomWtQ1YrmYtVT5ycnaRVadC7vrPo6AhJIxWt4 +GEYCwRXLirgcvXBf9akw9YkdMLDxXmDqH8Poyq3fWOi1i7MEFdgxtb7JYANS+zF2l0o tiKlas1aMzVUd1Ia/WqUnA4auLyHmZCkkngNp7kQV5Cxb72Zcoj65+hTptYfKCHu/Ymc UmVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from:delivered-to :arc-authentication-results; bh=d2eDDLQYgUqwNqx7h6C6UMePDUTpO4GsHRMWqaxCo8M=; b=cRVwnEIzR+aCDf6+NUaAShTYQM2jcP0F2ZmdrLmHDtqW5PY626Bh5s2mWl0vV3siEU 3ZZQmE5ddH4h2t4iAo+o8A9zCFg9wVQa9RxM1guRHEeBK/iXWd5qKK8S610WU2U5Jn2s zXR6iR9dldthHWXst39MnnmuT+gapTkeyKvJWkoSIH6ERjt17xeVXdlcVB7E+noTRp+7 zboNRaffKXEBQrBWqFHJScgjRhmKe3Ig39WTWpJaoARWgXXVwmSjfQnCJ1dBh/UZ2l8J UejqWLXPN+YBNbDcDemBaijlmiMaE7wFolGVAFez1ZBM8cSg3s3JprwS4jXPIpAy6Yek K74Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id d79si6877513qkh.222.2017.06.29.20.03.19; Thu, 29 Jun 2017 20:03:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 1025860A79; Fri, 30 Jun 2017 03:03:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 060FC60A12; Fri, 30 Jun 2017 03:03:15 +0000 (UTC) X-Original-To: linaro-uefi@lists.linaro.org Delivered-To: linaro-uefi@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id EA39C60A4D; Fri, 30 Jun 2017 03:03:12 +0000 (UTC) Received: from mail-pf0-f181.google.com (mail-pf0-f181.google.com [209.85.192.181]) by lists.linaro.org (Postfix) with ESMTPS id 241CC6099C for ; Fri, 30 Jun 2017 03:03:12 +0000 (UTC) Received: by mail-pf0-f181.google.com with SMTP id s66so59760163pfs.1 for ; Thu, 29 Jun 2017 20:03:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=TNAT6w23UfgmQmvt3z4oDTkG3+g2AD2Eh/WgFOwzWHM=; b=Sq+vrir796DawAEISH1/51rPUHl0Tv40v+UPFUw26vHvENw+D9eIxiW4j65b+FltOo tYUgzLH3g1IL1lyLKWPyLCfLWv7A1P9Pr34JoDmKZQkukp3zWLNeo48Vi3VKovlkiJUd 7BpwuI/o/P+rJuzYGVInd3C2d3aJvN3TOgY6c3SRtupZ2wMghfq8Sdn5hJmNWCxcq76L //QNwyzIvliZ8B8NfS4tAUz+oGF9TnqS8bMZFALO+1VFrTS5nxWTqNfYIPccInL4gkTn 6SsZktWclkkLGUKojVGXPCxRqak3dn/J4Fpb4LmwxWua5Fk/UGwr6iJirBs1+KEUF2W/ Ul/A== X-Gm-Message-State: AKS2vOzAie9rBz2crziG6kCyxC2k/ESjme3Y3lqgfhDk8T8IPzORS8cp 0awgVx+gHEOcpU2zHJw= X-Received: by 10.84.231.136 with SMTP id g8mr22128042plk.257.1498791791319; Thu, 29 Jun 2017 20:03:11 -0700 (PDT) Received: from localhost.localdomain ([113.53.228.63]) by smtp.gmail.com with ESMTPSA id u2sm17084885pgn.28.2017.06.29.20.03.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 29 Jun 2017 20:03:10 -0700 (PDT) From: Jun Nie To: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, haojian.zhuang@linaro.org, linaro-uefi@lists.linaro.org Date: Fri, 30 Jun 2017 11:02:56 +0800 Message-Id: <1498791777-16122-1-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 Cc: jason.liu@linaro.org, shawn.guo@linaro.org Subject: [Linaro-uefi] [PATCH 1/2] Drivers/Mmc/DwEmmc: limit max clock for platform X-BeenThere: linaro-uefi@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "For discussions about Linaro-related UEFI development. Not a substitute for edk2-devel." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" Some boards may have max clock limitation. Add a Pcd to notify driver. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jun Nie --- Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.c | 3 +++ Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.dec | 1 + Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.inf | 1 + 3 files changed, 5 insertions(+) diff --git a/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.c b/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.c index fe23d11..c67dd0d 100644 --- a/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.c +++ b/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.c @@ -560,6 +560,9 @@ DwEmmcSetIos ( EFI_STATUS Status = EFI_SUCCESS; UINT32 Data; + if (BusClockFreq > PcdGet32 (PcdDwEmmcDxeMaxClockFrequencyInHz)) + return EFI_UNSUPPORTED; + if (TimingMode != EMMCBACKWARD) { Data = MmioRead32 (DWEMMC_UHSREG); switch (TimingMode) { diff --git a/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.dec b/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.dec index c4bf7ed..7b84a9a 100644 --- a/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.dec +++ b/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.dec @@ -40,3 +40,4 @@ # DwEmmc Driver PCDs gDwEmmcDxeTokenSpaceGuid.PcdDwEmmcDxeBaseAddress|0x0|UINT32|0x00000001 gDwEmmcDxeTokenSpaceGuid.PcdDwEmmcDxeClockFrequencyInHz|0x0|UINT32|0x00000002 + gDwEmmcDxeTokenSpaceGuid.PcdDwEmmcDxeMaxClockFrequencyInHz|0x0|UINT32|52000000 diff --git a/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.inf b/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.inf index c0cbba7..99176f1 100644 --- a/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.inf +++ b/Drivers/Mmc/DwEmmcDxe/DwEmmcDxe.inf @@ -49,6 +49,7 @@ [Pcd] gDwEmmcDxeTokenSpaceGuid.PcdDwEmmcDxeBaseAddress gDwEmmcDxeTokenSpaceGuid.PcdDwEmmcDxeClockFrequencyInHz + gDwEmmcDxeTokenSpaceGuid.PcdDwEmmcDxeMaxClockFrequencyInHz [Depex] TRUE