From patchwork Thu Aug 23 16:07:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Huang X-Patchwork-Id: 144943 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp313583ljw; Thu, 23 Aug 2018 09:08:26 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxZUfokXtf7dLg/SWS4wsaGDo2MQX3AEJ+1LeTlJ0XS8XagGs53sTR4zX63XLbYvlK/KZuc X-Received: by 2002:a17:902:2b84:: with SMTP id l4-v6mr13627894plb.296.1535040506052; Thu, 23 Aug 2018 09:08:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535040506; cv=none; d=google.com; s=arc-20160816; b=J1jApxdRS4vEgVu1Ltk9t0VS3tfWWjcl/CNe+n7l5JtK0A+PyaCbNbATiqprJGVe60 Pttboh7bNqV/AdWT1t2flLoiI6qKfV9h6LSGqR46B3js6Z39NcIpYMiEkP8ZUSdKJhCV dQPkJt7AZv2VJo8WN516vXLF+y6cjRZR50cz0jsRvaOQylWk4oiMzdAI1ekB5I+v8JNP BwlxvNRSgLGpw8+jxcj0R/Fef6lb/e51pQYCptqF/HmENlHQSbHXyaedd9bHNPKLYXvD OFxKtU+RGIGRw+WEUD5WugTqo8MRZTwabgD4Xm2Js3nYA0l68hThB96oQdnZGxNhQmLf ZKbQ== 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:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=3owM3rQ+tlR3FMkCcHqn0skRBB3ECH4pUVBC7o5ze1s=; b=zyiTAQuMu6YN0GuqZiecXy/QIRjSg9My/Tsy2HmclyyeFPEfiIumvIV6M6qAmlVjO5 YNYRm+79ozZYHkBkJgGct+QsYRC76sN/VQIzL68/ga0jXGoFVmKfqoBOzKOZ+K4qNqH6 ewvxMLgCvwnvpgejyaB5PjwKyr2mbo8kyAOoToR50UEIYXOh9Y2a2PYymxSgPulAVA05 UJWUq3kYHRt4M2yXhLH7DLyqWUakX9nny0La4KZMPyzZJ/wR2WyxvcKhS4SygV+1rBeG K2TKt9Z7B4qNP98MFn399gGA2K+mywAbUxMO9ARI/glY5KmwNNgk2SfUwIXBH8SF0sRw VIRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=beDmWYCn; 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 d11-v6si4913113pgh.564.2018.08.23.09.08.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Aug 2018 09:08:26 -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.s=google header.b=beDmWYCn; 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 764AF21103DD0; Thu, 23 Aug 2018 09:08:25 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::436; helo=mail-pf1-x436.google.com; envelope-from=ming.huang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) (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 09CED21103DCA for ; Thu, 23 Aug 2018 09:08:24 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id k21-v6so2971078pff.11 for ; Thu, 23 Aug 2018 09:08:24 -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:in-reply-to:references; bh=UFvQ3hDX+SOpwj4fkBoHbJpRY7EIERCDXQErYVioMEs=; b=beDmWYCn1QP4352O8ArJVy9OaGnG0NxNIqY0a/6N9FdEvP3aU5eoXXlovYScAl8rsj YGrjnzmmAynsWY3cIBY//zViqkn6oEvBa44O7Vy3adBLdfLT8lrvZ41KuonaxAbQEO+G NvNfKk8L+Wg56n7BY0A1LsB/lrdWHCynV+7OE= 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:in-reply-to :references; bh=UFvQ3hDX+SOpwj4fkBoHbJpRY7EIERCDXQErYVioMEs=; b=nQkaJmMo6AN2GOGl2X41Iev8AURozaBxL/tPPRktRrsOzIF3BBF7F7f6IUyv85PQ5m YEO60dbnngyE4TtTKfcKC/4O9t6GHLsFSHjrPrSO8OCnQFZeukerwtdfQH/p0ZifQJBi GaJOQH+7ANXYrgy1yQ6rmNLmKnun7lNf60lNyfrzdJX+ouJzFcYb/XtaKE1qt+PubhYX 4R5QHpczy4SRuAmI4KaPbt/c1TN294hRQgIRDoelctkO+vtORwIvfE0QBebRh0Yx22KZ O/KwpwUOGU01lyIpfslbg7ISqyC4sP5b17ma7olRAnEk8OW62b66DXGYvRbQaVhlpuhX 0huA== X-Gm-Message-State: AOUpUlERp2rn5Rd4Yx5X+L0aKO4oOMv8UAQ2TF+wxxoeue5K0z37LKwt 5AmM0iZT0mwEMuxW+3ouvnTJab3ZtIc= X-Received: by 2002:a17:902:9a01:: with SMTP id v1-v6mr59178019plp.20.1535040503737; Thu, 23 Aug 2018 09:08:23 -0700 (PDT) Received: from localhost.localdomain ([120.31.149.194]) by smtp.gmail.com with ESMTPSA id d19-v6sm5788083pgv.61.2018.08.23.09.08.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Aug 2018 09:08:23 -0700 (PDT) From: Ming Huang To: leif.lindholm@linaro.org, linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org, graeme.gregory@linaro.org Date: Fri, 24 Aug 2018 00:07:17 +0800 Message-Id: <20180823160743.45638-6-ming.huang@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180823160743.45638-1-ming.huang@linaro.org> References: <20180823160743.45638-1-ming.huang@linaro.org> Subject: [edk2] [PATCH edk2-platforms v4 05/31] Silicon/Hisilicon: Optimize I2CLib for HNS config CDR time X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: huangming23@huawei.com, xinliang.liu@linaro.org, john.garry@huawei.com, zhangjinsong2@huawei.com, guoheyi@huawei.com, shaochangliang , huangdaode@hisilicon.com, michael.d.kinney@intel.com, lersek@redhat.com, wanghuiqiang@huawei.com MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" From: shaochangliang Use I2C 400KB speed for config CDR. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ming Huang Reviewed-by: Leif Lindholm --- Silicon/Hisilicon/Library/I2CLib/I2CLib.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) -- 2.18.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Silicon/Hisilicon/Library/I2CLib/I2CLib.c b/Silicon/Hisilicon/Library/I2CLib/I2CLib.c index b8c92fa8ea..63d9e2af25 100644 --- a/Silicon/Hisilicon/Library/I2CLib/I2CLib.c +++ b/Silicon/Hisilicon/Library/I2CLib/I2CLib.c @@ -28,6 +28,9 @@ #include "I2CLibInternal.h" #include "I2CHw.h" +#define I2C_100KB_SPEED 0x1 +#define I2C_400KB_SPEED 0x2 + VOID I2C_Delay ( UINT32 Count @@ -158,7 +161,11 @@ I2CInit ( I2C_REG_READ (Base + I2C_CON_OFFSET, I2cControlReg.Val32); I2cControlReg.bits.master = 1; - I2cControlReg.bits.Speed = 0x1; + if(SpeedMode == Normal) { + I2cControlReg.bits.Speed = I2C_100KB_SPEED; + } else { + I2cControlReg.bits.Speed = I2C_400KB_SPEED; + } I2cControlReg.bits.restart_en = 1; I2cControlReg.bits.slave_disable = 1; I2C_REG_WRITE (Base + I2C_CON_OFFSET, I2cControlReg.Val32);