From patchwork Wed Jul 5 08:27:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Nie X-Patchwork-Id: 107039 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp482514qge; Wed, 5 Jul 2017 01:27:24 -0700 (PDT) X-Received: by 10.84.228.193 with SMTP id y1mr20677413pli.18.1499243244262; Wed, 05 Jul 2017 01:27:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499243244; cv=none; d=google.com; s=arc-20160816; b=btR0nRbY8wg4rdXnJKfwpvImcEYo5k2lK4F9Q1E/aYUg2whmZ9ip+hE16nV6jw6ZQI cn6w/yX578QrVijrgDm3rxGEOhhnagWX+YuvwVjfsmWoe8fz2IlhGPGWWJa2fKglxojq SRabBbsX0a62DL70G7/3hfM5t5ae4i1AhM7n6FdACZklqTI3B6LCC1d6rIU/8eh9Ygyo 2obxdoqji6FHcgARgOAWx2ahZZ7auRODbffA9eji3kqqv22+IhRC+H8tAwJhI2A1KRvx We+jfvFDagAvqvMltHyAL7MTkbCYGWFwv0UVG4jHdDlpVEq96kplORlQJ1o+KOFFTpSh okrA== 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:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=B5BmqyM4p4kuOTMU4fAEDLQ97gs3yG/9ehmdgx4ydw8=; b=brzk3VFF9vzixmnegoXOFxf8bc0myuWRvMWoInATqwB07yZaKnB1pKQiZo2q953w0j LHLzIVuMFkOUGm6E2p9Oh+FH9HVDTHwqoCDio6iVlQiz/VdDXeF1zvKhTg6HTRs1XLRm d9pNcbXH4We7raLRQeZJV8C6W/RYc65oHX9ClB7EIUiDkN+cqSCCsgf10eL35fJf1lcY pzjWJj215qO6NOtW7qYDr6NOuWZpBTdX0J+xcgNjVs+ZJfqTin+Vb9PnFGOHSssdAJHx uCELtozjbHwQ99/EyWDtfYI0r8Dho6HAwH++iJ1DNILgoKyS2900gT8ouvpASw15IeQB lXzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=K3RHzpdc; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id d13si16802458pgn.237.2017.07.05.01.27.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jul 2017 01:27:24 -0700 (PDT) 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 header.b=K3RHzpdc; 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 sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id EAF3221A07AB5; Wed, 5 Jul 2017 01:25:43 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-pf0-x236.google.com (mail-pf0-x236.google.com [IPv6:2607:f8b0:400e:c00::236]) (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 C10D721A07AB5 for ; Wed, 5 Jul 2017 01:25:42 -0700 (PDT) Received: by mail-pf0-x236.google.com with SMTP id e7so126201448pfk.0 for ; Wed, 05 Jul 2017 01:27:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=TxYyDC6d0nFvA6FrZLOifc4b1riL0XU325wjZcy5Vjk=; b=K3RHzpdc91JMiH7p6rssCydW/9UmpjfnUczJM2axr/XltmJtgPgP2Je55ZhsPcVEuz 0ot7YD991NfKCCL2YQUEncaUYTo8da9Io+6whjsh3vkyaq180tJN7Tzo6Ids8XdDazGC +x20jZe80bcHVCJEJ87AIj5XI+ACadMHkgcvc= 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=TxYyDC6d0nFvA6FrZLOifc4b1riL0XU325wjZcy5Vjk=; b=W1geKHgCwRq+x5yJgX3kXWBebSQiY6+jEowjAK0pWzRCQSFnibPPN7MeCTvHe0r1Zk GGo7+yjzus8Mh8HVSPi7CrLu5aJqnBBB5Bh6AssKcPDUWfHXgZFudtraTH52jQp1TA5f 4utZEagoBIr+sOuaEZquH1e/A8NaMCjJWRG79Wc6uZn7jpN/VmldLU+ex1aXEHLcG0xh NJNRdx489Qedj9S7ljh58GwIGvMdusORy7FnEhiMCKfg9R1Eu43mk+i2GAis6Zy1L4mh Rs9v8GXcS50fAJz2Qs+NyP66G1Wvc3vn2tKN7gEAI82nMXe9W0yzy9ndTZ/GkLXEKCit 0KUA== X-Gm-Message-State: AIVw112y7CTWURsmqkD30KSHor6P8zk9mXSy0yVih+jFQJUlq+N5Fnmq XnFyXcr/0kqFaBfJ X-Received: by 10.98.108.74 with SMTP id h71mr15739196pfc.206.1499243241610; Wed, 05 Jul 2017 01:27:21 -0700 (PDT) Received: from localhost.localdomain ([113.53.228.78]) by smtp.gmail.com with ESMTPSA id z74sm35503722pfd.112.2017.07.05.01.27.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 05 Jul 2017 01:27:21 -0700 (PDT) From: Jun Nie To: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, haojian.zhuang@linaro.org, edk2-devel@lists.01.org Date: Wed, 5 Jul 2017 16:27:07 +0800 Message-Id: <1499243228-1225-1-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 Subject: [edk2] [PATCH v2 1/2] EmbeddedPkg/DwEmmcDxe: limit max clock for platform X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jason.liu@linaro.org, shawn.guo@linaro.org MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 --- EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c | 4 ++++ EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.inf | 1 + EmbeddedPkg/EmbeddedPkg.dec | 1 + 3 files changed, 6 insertions(+) -- 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Leif Lindholm diff --git a/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c b/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c index fe23d11..bb26b69 100644 --- a/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c +++ b/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c @@ -560,6 +560,10 @@ DwEmmcSetIos ( EFI_STATUS Status = EFI_SUCCESS; UINT32 Data; + if ((PcdGet32 (PcdDwEmmcDxeMaxClockFreqInHz) != 0) && + (BusClockFreq > PcdGet32 (PcdDwEmmcDxeMaxClockFreqInHz))) { + return EFI_UNSUPPORTED; + } if (TimingMode != EMMCBACKWARD) { Data = MmioRead32 (DWEMMC_UHSREG); switch (TimingMode) { diff --git a/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.inf b/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.inf index e3c8313..99b4f99 100644 --- a/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.inf +++ b/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.inf @@ -48,6 +48,7 @@ [Pcd] gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeBaseAddress gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeClockFrequencyInHz + gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeMaxClockFreqInHz [Depex] TRUE diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec index 5ea2f22..2da9b2f 100644 --- a/EmbeddedPkg/EmbeddedPkg.dec +++ b/EmbeddedPkg/EmbeddedPkg.dec @@ -169,6 +169,7 @@ # DwEmmc Driver PCDs gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeBaseAddress|0x0|UINT32|0x00000035 gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeClockFrequencyInHz|0x0|UINT32|0x00000036 + gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeMaxClockFreqInHz|0x0|UINT32|0x00000037 # # Android FastBoot