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::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-Google-Smtp-Source: AAOMgpdSICLxZZyy3/HUP4gMvT5yNoRGUzI2pVx9Ukgcin/C3l/oWWvjvCiYVr0AQ9+qnxlfFrdb3w== 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 Cc: ard.biesheuvel@linaro.org, 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 , Heyi Guo 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: [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: , X-List-Received-Date: Tue, 24 Jul 2018 07:16:35 -0000 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(-) 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); -- 2.17.0