From patchwork Tue Jul 24 07:09:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Huang X-Patchwork-Id: 142720 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp6934430ljj; Tue, 24 Jul 2018 00:16:36 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcW1wPIukV+/ya38etM4rC661jIDAthzIRe1LklkyRVmA/jvOnhflPGhfa3U0+o+N6f8lCY X-Received: by 2002:a62:170c:: with SMTP id 12-v6mr16439361pfx.139.1532416596037; Tue, 24 Jul 2018 00:16:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532416596; cv=none; d=google.com; s=arc-20160816; b=vQPTuMGX3Hw/JUwoRsdnlwD6HRJRLtc+kkooQW71AkN8pY3LSVf+pez1R2Q9wL1/N0 +N8PV7W9noRa/I78i4cqM0Wn3Bz2tpVhiSa3+0QiWAxS1tr4Pmd3JwbqNGOQa+3fQeWS jjVQyShqjVZYcN/BaiQ9IfJ+hVd02I0r5TeA8P4kMfLlUwKCOLUFfzwJb7Hw7Rv7licM bh2jqNdg3NL+CQd7wB4kHHLuKM6J/OZl0cY8Xju6R5LMQ11X01t4ruau2Zs6xzrw7UQW MRsCcEaOnDoZgfaDHqqnP5HU0jtVx3aionLcqRNOWDDQ3+4L8MVJk8esNNFbrk93tWqG gE2g== 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=b+iBQ6bW0pK7BZJVoNVOQqMElBFcxyFkgavsFZy3XHw=; b=bUjqSvQBswBtFFT4l1PCXbs/V80l+TGM0Oxnl8K8OiiW62OaZas+IR+ED3fzIqeXqW XE9+4v/nfBZyNf1zV6pkBYZVVp5qKsNutBsdty021qkqZTuVxW1QS4824TxQ0wI9D6Cf GaL+TKpESgh24pUAcN9IQwJw2VLFo1MeexOg5kdnMFjmAnkeRIaJ8aR50pUxoPJxbzZJ uMqvHdMMFzKsZRMsujgQewLMrNHl9dskB8nkCY1YPNfYDGJwhxzMs4tp54HctJpDkFKn 11efSKS/QlMbpmO5wRTnMmau3/xok8o2OAf3Vrj2+SmG9zUJX/lwWl+XKiObrqOV18+X htzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=LO1qI5nY; 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 j91-v6si9858411pld.402.2018.07.24.00.16.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jul 2018 00:16:36 -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.s=google header.b=LO1qI5nY; 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 A3F0F210C1244; Tue, 24 Jul 2018 00:16:35 -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::544; helo=mail-pg1-x544.google.com; envelope-from=ming.huang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) (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 D22B1210C123B for ; Tue, 24 Jul 2018 00:16:34 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id g2-v6so2221897pgs.6 for ; Tue, 24 Jul 2018 00:16:34 -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=gIAb9y5XO6mpsIRqCfpnDvQUI7eTFDKG4e9oV4pTl9k=; b=LO1qI5nY9GdbTGLL7JwSseBj+hrCrO6TJhOj8BDXOaQZnbwFrYEvAxlUwjqZn0NwyQ nk8kdhmoHeMNeHssjV2nHOX4ZBjNhJM8FECJMC6mxbFGGBGPmvCDsgXqQf44bmi/dl4y U/cUndbKfduOIdlEJ9LK6ZmcdJbvbPRN3Y58w= 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=gIAb9y5XO6mpsIRqCfpnDvQUI7eTFDKG4e9oV4pTl9k=; b=uOPkpqykyx7VVkc0K14y4TznMaise5nHXYjau1M9QIAwznz3jnEXgAKTcYKoDxIdo+ 6WYGvDhEK5KVOEHEc9C6LnfHxfQMWmY3wlixJRq7QiGGeXdUfq8S0lLCHFQIv0ewzFzy 6LW54XzYkRSLo038JZljIVaBl7mUKa8SvGafzRlN08vYAnbDiyA8oZI68CYmv+IDDnE6 zsDmDPxTH2P0MSGOC/NHL8GcKM9OdZ6arPaWqJD3eelWPbHDy5PvjpQAiZmGYDN6el37 iHUiAEDLav42UNiSaJM0rJs+nY+q4xRKk6GMqwhzjh8WhHlrDBGEKZadS8ptR/Fpep5/ UMKA== X-Gm-Message-State: AOUpUlENx/F332jViDvSKQw5VajEy0nN2Q9ro2ecFFr9rKO2QSnCvgTe 9elIgFye6u0uDv83EiyXRZWQ+g== X-Received: by 2002:a62:e106:: with SMTP id q6-v6mr16685105pfh.75.1532416594566; Tue, 24 Jul 2018 00:16:34 -0700 (PDT) Received: from localhost.localdomain ([120.31.149.194]) by smtp.gmail.com with ESMTPSA id t14-v6sm11449788pgu.0.2018.07.24.00.16.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Jul 2018 00:16:33 -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: Tue, 24 Jul 2018 15:09:00 +0800 Message-Id: <20180724070922.63362-17-ming.huang@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180724070922.63362-1-ming.huang@linaro.org> References: <20180724070922.63362-1-ming.huang@linaro.org> Subject: [edk2] [PATCH edk2-platforms v1 16/38] Silicon/Hisilicon/D06: Add I2C delay for HNS auto config X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 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, shaochangliang , huangdaode@hisilicon.com, guoheyi@huawei.com, wanghuiqiang@huawei.com MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" From: shaochangliang Because I2C Port5 salve device connect under 95545 device, it will cost more time to access I2C slave device, so add delay time for HNS auto config. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: shaochangliang Signed-off-by: Ming Huang Signed-off-by: Heyi Guo --- Silicon/Hisilicon/Library/I2CLib/I2CLib.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) -- 2.17.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 16636987a6..fa8c510f36 100644 --- a/Silicon/Hisilicon/Library/I2CLib/I2CLib.c +++ b/Silicon/Hisilicon/Library/I2CLib/I2CLib.c @@ -248,7 +248,11 @@ CheckI2CTimeOut ( if (Transfer == I2CTx) { ulFifo = I2C_GetTxStatus (Socket,Port); while (ulFifo != 0) { - I2C_Delay(2); + if (Port == 5) { + I2C_Delay(1000); + } else { + I2C_Delay(2); + } if (++ulTimes > I2C_READ_TIMEOUT) { (VOID)I2C_Disable (Socket, Port); return EFI_TIMEOUT; @@ -259,7 +263,11 @@ CheckI2CTimeOut ( else { ulFifo = I2C_GetRxStatus (Socket,Port); while (ulFifo == 0) { - I2C_Delay(2); + if (Port == 5) { + I2C_Delay(1000); + } else { + I2C_Delay(2); + } if (++ulTimes > I2C_READ_TIMEOUT) { (VOID)I2C_Disable (Socket, Port); return EFI_TIMEOUT; @@ -359,7 +367,7 @@ I2CWrite(I2C_DEVICE *I2cInfo, UINT16 InfoOffset, UINT32 ulLength, UINT8 *pBuf) ulFifo = I2C_GetTxStatus(I2cInfo->Socket,I2cInfo->Port); while(ulFifo > I2C_TXRX_THRESHOLD) { - I2C_Delay(2); + I2C_Delay(1000); if(++ulTimes > I2C_READ_TIMEOUT) { (VOID)I2C_Disable(I2cInfo->Socket, I2cInfo->Port);