From patchwork Mon Jul 3 04:01: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: 106872 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp5303830qge; Sun, 2 Jul 2017 21:02:13 -0700 (PDT) X-Received: by 10.84.229.77 with SMTP id d13mr8666210pln.239.1499054533225; Sun, 02 Jul 2017 21:02:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499054533; cv=none; d=google.com; s=arc-20160816; b=zFzb73WHpeNEYP2u/XRvOZq6QZqCiVJF77nsYY5/EZsESObApudRw0ewT16PVaSZIN GmV1WbqixkqT03SB4AW6rVi2eoKUEr7VqG2XtbB4gkRe4hkyEa2/oj6fF4ugPbbvLOwZ Nahdsql+bI28dM9gQ7KCR5I92BsWW+wDpCIeG4RIgnPPG9NvWcLHDOX7UGCffE1BUKKb 2/myhYsOgpfY8eTpO/5Mybd8C0OARq7iWjLLPcZ1eUFIhyVa4yRmTnY0FpQd3UOVOlxC oEN0GvjbL8MCWnvEZA+bacwYJBCVqpTlNCYEmu2RNUvQIv+R4kln4u5MwNQVCL5cuOKT 7yww== 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=S3C4AOVDClz1Slg+nv53Uc0NqUF4Lp6qD/IyIWMTjO0=; b=h2EqB5p6e1lyh3a4Z2tgKDpzsyrd0AIhQ2kgdbCD1xsOb78CgsvzPFNV2oM6nhbXN2 zt3ZMMkH4eZGXUvwCWw5UWlcwtYRWmh8afoXrte4Gt56eu/fQYPdSV4Fm1QEpNbC6BYA 1OigaQMiGjmdetJ0X0YnLsC9g9x3Pl0NThoChoSP7JI+mprYvczywHYSOAxdsYjyV76M lQXvQA95DIDtPtr24FL5xIWeMzNf7Ro8Czp4cnbWrX4SpT6LnSW4eHKlxqJpiJogL8xY eJ4ZOkaP3aw8/Ea3vvDdguIfnfCCC7lxTHXZOG0gqRVHePmBT8USvm8Vv5wTSF82J1HM VgrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=Tk6gon+H; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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. [198.145.21.10]) by mx.google.com with ESMTPS id v31si12222671plg.345.2017.07.02.21.02.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Jul 2017 21:02:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=Tk6gon+H; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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 5A03621CAD9BC; Sun, 2 Jul 2017 21:00:35 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-pf0-x22f.google.com (mail-pf0-x22f.google.com [IPv6:2607:f8b0:400e:c00::22f]) (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 35D8621CAD9B0 for ; Sun, 2 Jul 2017 21:00:34 -0700 (PDT) Received: by mail-pf0-x22f.google.com with SMTP id c73so93566317pfk.2 for ; Sun, 02 Jul 2017 21:02:11 -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=vU5BbZGC7JEL18TROVTBdBaHn3pO5Vw4BkhGitq8rdg=; b=Tk6gon+HItLAmVaUd+IBszaOzXuNgqJRYTaqsP4Q0sWm4TULrKsGvxk+FQP/Uohgnh 8t6YZXqBS7UIoghoVnv9RBUCOPDY/OttVsz1wX4qijTnmT6Lg6KyhTpXrVHE7StAjwP0 VYRXpV5gJlw+fu7ElAD6yu6RNpC7tsY8Q88Ms= 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=vU5BbZGC7JEL18TROVTBdBaHn3pO5Vw4BkhGitq8rdg=; b=U66B3Z0mGtuETShF6lrSRQjJLjW6y25TmMF2trVZMDYj4sL/pPfDvnObFsx4wMiefE Y/nOGVRqUxrbQGh5mea+7RGk23yYMod1Y2E1BlQ4wHDhiE+k2GS1k6pe6eglmiXovlYI 2/M2x4uZ7hNlcADhINO5P0gEpAtdxaOZW8nJ857oShd9Fwz1HxHXun076W2uVcsnSY3R prcrWofLK13u7VGTAle4y4zRN5ioY42VnhlLkd3iHMkMytTdy4e8nxFPcmwtjuTa+Cna iwL3E0RA+SAiW5rSNzp+UoDfUU0Dqb+dp0KxV2mzu/IhTQtbIfzsuKq4pf6GBnvg1tNh ptkQ== X-Gm-Message-State: AIVw112z6yvYZ4LBqX3fgJ/PX6EOSD7FT+/ENf40ylQF2lN28Tqxu511 nlvN7uQtdeBhIwsO X-Received: by 10.98.163.203 with SMTP id q72mr7787966pfl.97.1499054530677; Sun, 02 Jul 2017 21:02:10 -0700 (PDT) Received: from localhost.localdomain ([113.53.228.63]) by smtp.gmail.com with ESMTPSA id l85sm5761583pfi.53.2017.07.02.21.02.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 02 Jul 2017 21:02:10 -0700 (PDT) From: Jun Nie To: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, haojian.zhuang@linaro.org, edk2-devel@lists.01.org Date: Mon, 3 Jul 2017 12:01:56 +0800 Message-Id: <1499054517-22398-1-git-send-email-jun.nie@linaro.org> X-Mailer: git-send-email 1.9.1 Subject: [edk2] [PATCH] 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 diff --git a/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c b/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c index fe23d11..308f3a7 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 (BusClockFreq > PcdGet32 (PcdDwEmmcDxeMaxClockFrequencyInHz)) { + 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..3582997 100644 --- a/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.inf +++ b/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.inf @@ -48,6 +48,7 @@ [Pcd] gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeBaseAddress gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeClockFrequencyInHz + gDwEmmcDxeTokenSpaceGuid.PcdDwEmmcDxeMaxClockFrequencyInHz [Depex] TRUE diff --git a/EmbeddedPkg/EmbeddedPkg.dec b/EmbeddedPkg/EmbeddedPkg.dec index 0d4a062..aec8259 100644 --- a/EmbeddedPkg/EmbeddedPkg.dec +++ b/EmbeddedPkg/EmbeddedPkg.dec @@ -167,6 +167,7 @@ # DwEmmc Driver PCDs gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeBaseAddress|0x0|UINT32|0x00000035 gEmbeddedTokenSpaceGuid.PcdDwEmmcDxeClockFrequencyInHz|0x0|UINT32|0x00000036 + gDwEmmcDxeTokenSpaceGuid.PcdDwEmmcDxeMaxClockFrequencyInHz|0x0|UINT32|400000000 # # Android FastBoot