From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Google-Smtp-Source: AA+uWPz3jf0eW2VBce6+r4R5wRSxm92BjfU/JJU6qaI9ZZIravwru7roHgACVDAPE11/rjx5s1Q2gg== 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 Cc: ard.biesheuvel@linaro.org, michael.d.kinney@intel.com, lersek@redhat.com, guoheyi@huawei.com, wanghuiqiang@huawei.com, huangming23@huawei.com, zhangjinsong2@huawei.com, huangdaode@hisilicon.com, john.garry@huawei.com, xinliang.liu@linaro.org, shaochangliang , Ming Huang 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: [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: , X-List-Received-Date: Thu, 23 Aug 2018 16:08:24 -0000 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(-) 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); -- 2.18.0