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:c0c::244; helo=mail-wr0-x244.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x244.google.com (mail-wr0-x244.google.com [IPv6:2a00:1450:400c:c0c::244]) (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 88F93203525FD for ; Thu, 26 Oct 2017 06:09:42 -0700 (PDT) Received: by mail-wr0-x244.google.com with SMTP id o44so3092492wrf.11 for ; Thu, 26 Oct 2017 06:13:28 -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=UhlIAPZv2TuHARu6ZUiJmBasVUA49F9Dyy9dRkTDyns=; b=U5uKHQBxS5t47rMY154zTb+SV8tbD6vtkSfymMeOZFI3Ce8I40PgcYbmkBYnfsAxED a8q7UqJ5ZrdXUTzckbEB/1Oiil7Q0P/7KCloMHpvgWH2v8B8+YGngJ8UzY5M2g/cVXpk cv4SEH95JQWxuJRdm+A1iaJt1JkVhr+rK+UpE= 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=UhlIAPZv2TuHARu6ZUiJmBasVUA49F9Dyy9dRkTDyns=; b=tDHBGHEd3vtrBQzJpSTuMtZbA/oD8Q2qkGQ5v+iD4AvOm6rr8lcsqLCWreRhkpy7tv 5tWMFvnsqJnT/ml61mP+bkMWkaOe8SxWWobs5z6MtdHhZ38RAgv0hNp+zp5x7uIuLlzE iOkU1jahRTP92oRFluayfmJuaI/11dTvQJIcdDEfH7IQoQCcYftgs0FuB+nMCcGp7ZH8 DkEVwOLp/XqVd4z3NxnpSJ/wl3DcpwBzqtHRRltNvZ/NjITPdKjQrlmmp5XUYvYdZGer CQDNCROIceztVzxKdaI/XtP698CLla+g+C2WzASlOBSK0pYGJ9NhPDCCGyUFKtbChQDF 8pZg== X-Gm-Message-State: AMCzsaWR5Xjn5KKJLq7+ptD0B2g6jrlycd2S7u3mDLy4EZJ+aHqKDA/2 NYgkZHxeeDx8Ket2QsoZyN4Gng== X-Google-Smtp-Source: ABhQp+T4u31ZIQYEfulyS+1NCC8WhEMZ4vwJmA0jwWAMGu6/Fsx9GWB/13VDWbaFU96/d8Zpo8qqAg== X-Received: by 10.223.184.205 with SMTP id c13mr4839521wrg.268.1509023607344; Thu, 26 Oct 2017 06:13:27 -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 m64sm1327010wmb.10.2017.10.26.06.13.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Oct 2017 06:13:26 -0700 (PDT) Date: Thu, 26 Oct 2017 14:13:24 +0100 From: Leif Lindholm To: Marcin Wojtas Cc: edk2-devel@lists.01.org, ard.biesheuvel@linaro.org, nadavh@marvell.com, neta@marvell.com, kostap@marvell.com, jinghua@marvell.com, jsd@semihalf.com, David Greeson Message-ID: <20171026131324.6md5ji7olqzx6n3f@bivouac.eciton.net> References: <1508980777-29006-1-git-send-email-mw@semihalf.com> <1508980777-29006-4-git-send-email-mw@semihalf.com> MIME-Version: 1.0 In-Reply-To: <1508980777-29006-4-git-send-email-mw@semihalf.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [platforms: PATCH 03/10] Marvell/Drivers: MvI2cDxe: Reduce bus occupation time X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2017 13:09:42 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Oct 26, 2017 at 03:19:30AM +0200, Marcin Wojtas wrote: > From: David Greeson > > During each transaction start, clearing the I2C_CONTROL_FLAG > was surrounded by 3 uncoditional stalls. This was not necessary, > so replace them with one busy-wait loop, whose polling > count could be also safely reduced. > > Above improvements result in faster transfer initialization > and allow to reduce the I2C bus occupation. See now why I keep nagging about explanations for delays? :) > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: David Greeson > Signed-off-by: Marcin Wojtas Reviewed-by: Leif Lindholm > --- > Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c | 6 +----- > Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h | 2 +- > 2 files changed, 2 insertions(+), 6 deletions(-) > > diff --git a/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c b/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c > index 8ed96f0..3c26d18 100755 > --- a/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c > +++ b/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.c > @@ -243,9 +243,8 @@ MvI2cClearIflg ( > IN I2C_MASTER_CONTEXT *I2cMasterContext > ) > { > - gBS->Stall(I2C_OPERATION_TIMEOUT); > + MvI2cPollCtrl (I2cMasterContext, I2C_OPERATION_TIMEOUT, I2C_CONTROL_IFLG); > MvI2cControlClear(I2cMasterContext, I2C_CONTROL_IFLG); > - gBS->Stall(I2C_OPERATION_TIMEOUT); > } > > /* Timeout is given in us */ > @@ -295,9 +294,6 @@ MvI2cLockedStart ( > MvI2cClearIflg(I2cMasterContext); > } > > - /* Without this delay we Timeout checking IFLG if the Timeout is 0 */ > - gBS->Stall(I2C_OPERATION_TIMEOUT); > - > if (MvI2cPollCtrl(I2cMasterContext, Timeout, I2C_CONTROL_IFLG)) { > DEBUG((DEBUG_ERROR, "MvI2cDxe: Timeout sending %sSTART condition\n", > Mask == I2C_STATUS_START ? "" : "repeated ")); > diff --git a/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h b/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h > index 028fd54..3c9beaf 100644 > --- a/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h > +++ b/Platform/Marvell/Drivers/I2c/MvI2cDxe/MvI2cDxe.h > @@ -68,7 +68,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > > #define I2C_SOFT_RESET 0x1c > #define I2C_TRANSFER_TIMEOUT 10000 > -#define I2C_OPERATION_TIMEOUT 1000 > +#define I2C_OPERATION_TIMEOUT 100 > > #define I2C_UNKNOWN 0x0 > #define I2C_SLOW 0x1 > -- > 2.7.4 >