From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::241; helo=mail-wm0-x241.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (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 D8CB421BADAB2 for ; Fri, 3 Aug 2018 06:28:13 -0700 (PDT) Received: by mail-wm0-x241.google.com with SMTP id o18-v6so6479231wmc.0 for ; Fri, 03 Aug 2018 06:28:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=sS3iljyBvRznM15Tpd1Ax+3RI76bSlw3+3UEE+if7wQ=; b=DrDWPYBDBNba0chR02DMnCzwbHJ+h84mYF7OZ8iLAPtRLWBTpI3LKrZ5VyTkJHSFJM MyvON77GGAOGdNIcawVrWNiI7A4PhnzCFjcwhOg2Q2TJpXckZnzdgiYJDoURBxq0Uz8L oB+WtAtKcHNsjfiINjKvNOmJhb/UnRreCfDlM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=sS3iljyBvRznM15Tpd1Ax+3RI76bSlw3+3UEE+if7wQ=; b=SSYa4x/foc+GCYP3tp2yElQiSIoSKH7NJk5WWAEDldwLOoUH3QKekf5w4jsBibS3ch i2rVk3XTQnz9ykkZNsJ6Zqq0uMY8cJJWUz9IkMLYdJOsIQNqKJiNIxRZRy+3KR0iDtQS QhGIlhvthwx/Bn2LKZQ6sY8MH90ppy0MPMXCgbf4AftULVt/iUWZPr+wOO9O9CzbrAdd /HKjWEnxThHSolNAtzfo/iMlZSfbb8bykS8+ASwHudWAvf0GMsZ6HN2hFajBOSOM+8Yi VzN6HynR+DOrmLJqG3tX71GsN8aKHeo5IOKArJI2jpbRsRFtSbTcUoEUvty3vJDrMfnE 37Sw== X-Gm-Message-State: AOUpUlFtFj+GvkWNmHUVEu6wAKb/3jCL1CTdHUBLX8hM1tNdZvMZrIgQ P3Wy87s0XQfmDCeXSBxA14kdfg== X-Google-Smtp-Source: AAOMgpemijDayPTFatH+wDBRERx2bQ+T9xVj8un6qOvd/ox0EMm53tpyu9yrKu4NWZYPhFzUKGLJyQ== X-Received: by 2002:a1c:b84e:: with SMTP id i75-v6mr4684175wmf.158.1533302892363; Fri, 03 Aug 2018 06:28:12 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id f6-v6sm6223532wrw.78.2018.08.03.06.28.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Aug 2018 06:28:11 -0700 (PDT) Date: Fri, 3 Aug 2018 14:28:09 +0100 From: Leif Lindholm To: Ming Huang Cc: linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org, graeme.gregory@linaro.org, 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 , Heyi Guo Message-ID: <20180803132809.c75xwhyp4mtdms42@bivouac.eciton.net> References: <20180724070922.63362-1-ming.huang@linaro.org> <20180724070922.63362-17-ming.huang@linaro.org> MIME-Version: 1.0 In-Reply-To: <20180724070922.63362-17-ming.huang@linaro.org> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [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: Fri, 03 Aug 2018 13:28:14 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jul 24, 2018 at 03:09:00PM +0800, Ming Huang wrote: > From: shaochangliang > > Because I2C Port5 salve device connect under 95545 device, salve -> slave What is 95545? > 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) { What is special about 5? Can it be given a descriptive #define? > + I2C_Delay(1000); Please add a comment on why this special treatment is needed. Space before '(' . > + } else { > + I2C_Delay(2); Space before '(' > + } > 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); > + } All the same comments as for previous instance. > 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); Space before '('. / Leif > if(++ulTimes > I2C_READ_TIMEOUT) > { > (VOID)I2C_Disable(I2cInfo->Socket, I2cInfo->Port); > -- > 2.17.0 >