Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp113194rdb; Thu, 1 Feb 2024 03:55:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IHaW5+NpECYzn4M77i5TIA/F0fCSEy45tvbiTw1sRW00mkG1d01eRetFDRmq25AkMs1Fd7M X-Received: by 2002:a05:6a00:179a:b0:6df:df6b:392 with SMTP id s26-20020a056a00179a00b006dfdf6b0392mr4049338pfg.20.1706788534872; Thu, 01 Feb 2024 03:55:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706788534; cv=pass; d=google.com; s=arc-20160816; b=KP0jUt8s29Bi0kHLnxlrsAMj8yC0X0ZK4pmZ7SBlIc7+yWLoKiNvXN79wa9Y43jogZ nWoMmhr5/gUtfBGpnbtZlj/9K9l5DJ+FJJzpPHrx7PyzTgyfDQQl++0eGnDQYo3m7RN5 vNednhnBfjaZstPk4+ZVbE2I8f4j3X3UKU0Lg/amly+F9QJv1DZgDX5MUmT9S+M6eJqp tiJpOnqxPqR5Njp5fYzzyGh1xkRnzCSKGIZK8Hd85Ghiz1/ncfkEu/Zp68zLumtP7kEI hLF46flftC/n0eqr6f8O1gf2sr7/coj0NEj9H5pbmgnmwRY1lt6Od8oLfl+2kbaITmmT EdpA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=4H6LBU62Ttqy2KFiZYwMZoro4w2GfWXjhJ/+N8HmJ1Q=; fh=rmS3oELZ65CuJcfJo7u6NrQ4hzfqECPXR+dDP1TIb78=; b=ZsHXr5cOqq3ddRBhIy+vgDOoEzg7wj/Vz7GqpjsIHsiXXaf0IqygIx3fPNsUOdyXzO VhqpHdmM52HlvFJbAz70+SAeRPWQxk5xtKoh2VM8IgVUuDc+9JMvNQgaIyun7kzCc763 60cJL7R36DJ0JqP//SXkRK2EiU75oQ10vU7AD3xRjYb1SlozLTY8VQL2n3oZi1NmROQT yDYV516pg+9epyRQFYZZGYcC/IdEph6eKFywRWkg4ivtQ6Fz1JNLv5rGttgNItaZdXXv J5RA1CUYll2Rr0WVQfLCRNumPAf6A9Wd1P2LhmWmiUyUBZDgPtJhFTGd/nqQn0bymiQ/ /Vtw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O6vF4Bja; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-48049-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48049-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org X-Forwarded-Encrypted: i=1; AJvYcCWqXKi+CaZDxTLSy6+FAijx3F4MYM/GWCDKkPOdXGHnLpHo/kcTkDm1XBSJi/3sILyfpsHbCJS/7U54bLpaPepkJ0nRlB7M0VG5Hg9SYw== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id h28-20020aa79f5c000000b006dbb3201417si11657309pfr.125.2024.02.01.03.55.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 03:55:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48049-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O6vF4Bja; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-48049-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48049-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 84C12284B4B for ; Thu, 1 Feb 2024 11:55:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3289F12CDB4; Thu, 1 Feb 2024 11:54:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="O6vF4Bja" Received: from mail-yb1-f172.google.com (mail-yb1-f172.google.com [209.85.219.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BA1B15B995 for ; Thu, 1 Feb 2024 11:54:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706788460; cv=none; b=ZwCDPrZyuJGsVec/yTkQa4QGLUtdq1kFFO177Hga2TFU+BC4DyPW/FyPg+K397QnHVc1YaPkkW7jCwNClCpAClvZ/mi5ryy3AfNPAvk21IrUkM4QIQX2yy3snhmCAVa9ewoCPhSu/6Rmue3FHW+dz0wtWsYFzvXK6TS/FniPbtg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706788460; c=relaxed/simple; bh=xZlpBSv6fkEsA2L7w/b7DPQtVdArKyORbXqibI/jExE=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=GK7R2bTiU76mSr4MOkrSVLNd5EXm7VQXsDzeZ9bz0jMLjgQc5bRwGOtKGbhF2zrJgNT7YkGxwXnC3qFtaEkBn7+yaNHocS7elqx3KFY1XR0TNG7MXMCe885wOSakOiNG4SwvdtRi/jq92vMfwjiHLeWqzN8wrzP8tFJoYZUaX8k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=O6vF4Bja; arc=none smtp.client-ip=209.85.219.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yb1-f172.google.com with SMTP id 3f1490d57ef6-dc6d9a8815fso575377276.3 for ; Thu, 01 Feb 2024 03:54:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706788457; x=1707393257; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=4H6LBU62Ttqy2KFiZYwMZoro4w2GfWXjhJ/+N8HmJ1Q=; b=O6vF4BjaZHJsVk+if3ylpZuTdmZqQl6byk8gKQnHWFhb7sWpaCl4/h9/WhoUZGcjlj RAZiLtkhd1ruUsusSrcVKZ1Tnd/T1CFs2eI6MQw3j6Sa6/KJo4bE68rJjUD750+bev/8 dd4lZ4plJzB64YdWPfNV3gBpPeD6AUx7TS4Y4YKBZyUlVNsaFebumcaOoyuiH+YuOHEB D48jOgfx9soZEeuFaGD1rVQTqbwb9qO9za29W8sZRgG4kwGQdX7TpsOk69P7PLlm6G+Z acLlCRoCSvBXJeB2k3voGjmkFEIf3hGp648irabqF+TTul9B+RCSNRE3aMUAIZA1sJ0O 7GgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706788457; x=1707393257; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4H6LBU62Ttqy2KFiZYwMZoro4w2GfWXjhJ/+N8HmJ1Q=; b=eOLZpQkzJRuTkQTgYv7CYoohdMRuSPHle4NtcA071eFmMq3pPBkvXS7zMHJ5QOcrn5 5oq1PyqP3ijZr9+/MdmDr4IGiXcVC4urF+qeh6UYkUapuLRort4aTHg4CTwE5P6hU97V HmlzXkggzjjRs/l0tR7v3hw3ZrhD7FxpHYk+9PpMkci0ciIoaMFwyfoR06EyeQdF/1WE +/lXCTPb58huLb4GCmDcZ4aqZWxtbj4YA+CWwZKRA71Bj4Ua2dvffpvgmy8cpeysNE5G REZftaeWslLOHC3Y0OkrI6Oov7mOuo3rFyeQXdcRoykUIVgVSNPNMkScfUGayXlgRsK3 8X6w== X-Gm-Message-State: AOJu0YzRJbG9By+KjiJEPxNCES6xzmkAmgh+T1GMNAf/4FmJE/yq6EpQ iP1yC15CtItycQy/y9cYsZLXx7hH6MhY8DZOLH6EzejA2JFy5iPDCTpZvQ5fDQxZUvWs72uybku jkoGdaBklhC8pcrrMGthx7zxxyoK/8V1+4gMeDBYW5SjWCylZx4w= X-Received: by 2002:a25:2e4a:0:b0:dc6:ad45:3c51 with SMTP id b10-20020a252e4a000000b00dc6ad453c51mr4463301ybn.36.1706788457347; Thu, 01 Feb 2024 03:54:17 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240201101323.13676-1-quic_vdadhani@quicinc.com> In-Reply-To: <20240201101323.13676-1-quic_vdadhani@quicinc.com> From: Dmitry Baryshkov Date: Thu, 1 Feb 2024 13:54:06 +0200 Message-ID: Subject: Re: [V3] i2c: i2c-qcom-geni: Correct I2C TRE sequence To: Viken Dadhaniya Cc: andersson@kernel.org, konrad.dybcio@linaro.org, andi.shyti@kernel.org, linux-arm-msm@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, vkoul@kernel.org, quic_bjorande@quicinc.com, manivannan.sadhasivam@linaro.org, bryan.odonoghue@linaro.org, quic_msavaliy@quicinc.com, quic_vtanuku@quicinc.com Content-Type: text/plain; charset="UTF-8" On Thu, 1 Feb 2024 at 12:13, Viken Dadhaniya wrote: > > For i2c read operation in GSI mode, we are getting timeout > due to malformed TRE basically incorrect TRE sequence > in gpi(drivers/dma/qcom/gpi.c) driver. > > TRE stands for Transfer Ring Element - which is basically an element with > size of 4 words. It contains all information like slave address, > clk divider, dma address value data size etc). > > Mainly we have 3 TREs(Config, GO and DMA tre). > - CONFIG TRE : consists of internal register configuration which is > required before start of the transfer. > - DMA TRE : contains DDR/Memory address, called as DMA descriptor. > - GO TRE : contains Transfer directions, slave ID, Delay flags, Length > of the transfer. > > Driver calls GPI driver API to config each TRE depending on the protocol. > If we see GPI driver, for RX operation we are configuring DMA tre and > for TX operation we are configuring GO tre. > > For read operation tre sequence will be as below which is not aligned > to hardware programming guide. > > - CONFIG tre > - DMA tre > - GO tre > > As per Qualcomm's internal Hardware Programming Guide, we should configure > TREs in below sequence for any RX only transfer. > > - CONFIG tre > - GO tre > - DMA tre > > In summary, for RX only transfers, we are reordering DMA and GO TREs. > Tested covering i2c read/write transfer on QCM6490 RB3 board. This hasn't improved. You must describe what is the connection between TRE types and the geni_i2c_gpi calls. It is not obvious until somebody looks into the GPI DMA driver. Another point, for some reason you are still using just the patch version in email subject. Please fix your setup so that the email subject also includes the `[PATCH` part in the subject, which is there by default. Hint: git format-patch -1 -v4 will do that for you without a need to correct anything afterwards. > > Fixes: d8703554f4de ("i2c: qcom-geni: Add support for GPI DMA") > Signed-off-by: Viken Dadhaniya I think you got some review tags for v2, didn't you? They should have been included here, otherwise the efforts spent by the reviewer are lost. > --- > v2 -> v3: > - Update commit log to explain change in simple way. > - Correct fix tag format. > > v1 -> v2: > - Remove redundant check. > - update commit log. > - add fix tag. > --- > --- > drivers/i2c/busses/i2c-qcom-geni.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c > index 0d2e7171e3a6..da94df466e83 100644 > --- a/drivers/i2c/busses/i2c-qcom-geni.c > +++ b/drivers/i2c/busses/i2c-qcom-geni.c > @@ -613,20 +613,20 @@ static int geni_i2c_gpi_xfer(struct geni_i2c_dev *gi2c, struct i2c_msg msgs[], i > > peripheral.addr = msgs[i].addr; > > + ret = geni_i2c_gpi(gi2c, &msgs[i], &config, > + &tx_addr, &tx_buf, I2C_WRITE, gi2c->tx_c); > + if (ret) > + goto err; > + > if (msgs[i].flags & I2C_M_RD) { > ret = geni_i2c_gpi(gi2c, &msgs[i], &config, > &rx_addr, &rx_buf, I2C_READ, gi2c->rx_c); > if (ret) > goto err; > - } > - > - ret = geni_i2c_gpi(gi2c, &msgs[i], &config, > - &tx_addr, &tx_buf, I2C_WRITE, gi2c->tx_c); > - if (ret) > - goto err; > > - if (msgs[i].flags & I2C_M_RD) > dma_async_issue_pending(gi2c->rx_c); > + } > + > dma_async_issue_pending(gi2c->tx_c); > > timeout = wait_for_completion_timeout(&gi2c->done, XFER_TIMEOUT); > -- > QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member > of Code Aurora Forum, hosted by The Linux Foundation > > -- With best wishes Dmitry