linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [V2] i2c: i2c-qcom-geni: Correct I2C TRE sequence
@ 2024-01-29  6:10 Viken Dadhaniya
  2024-01-29 23:24 ` Andi Shyti
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Viken Dadhaniya @ 2024-01-29  6:10 UTC (permalink / raw)
  To: andersson, konrad.dybcio, andi.shyti, linux-arm-msm, linux-i2c,
	linux-kernel, vkoul, quic_bjorande, manivannan.sadhasivam
  Cc: quic_msavaliy, quic_vtanuku, Viken Dadhaniya

For i2c read operation, we are getting gsi mode timeout due
to malformed TRE(Transfer Ring Element). Currently we are
configuring incorrect TRE sequence in gpi driver
(drivers/dma/qcom/gpi.c) as below

- Sets up CONFIG
- Sets up DMA tre
- Sets up GO tre

As per HPG(Hardware programming guide), We should configure TREs in below
sequence for any i2c transfer

- Sets up CONFIG tre
- Sets up GO tre
- Sets up DMA tre

For only write operation or write followed by read operation,
existing software sequence is correct.

for only read operation, TRE sequence need to be corrected.
Hence, we have changed the sequence to submit GO tre before DMA tre.

Tested covering i2c read/write transfer on QCM6490 RB3 board.

Signed-off-by: Viken Dadhaniya <quic_vdadhani@quicinc.com>
Fixes: commit d8703554f4de ("i2c: qcom-geni: Add support for GPI DMA")
---
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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [V2] i2c: i2c-qcom-geni: Correct I2C TRE sequence
  2024-01-29  6:10 [V2] i2c: i2c-qcom-geni: Correct I2C TRE sequence Viken Dadhaniya
@ 2024-01-29 23:24 ` Andi Shyti
  2024-01-30 11:32   ` Bryan O'Donoghue
  2024-02-01 10:17   ` Viken Dadhaniya
  2024-01-29 23:49 ` Dmitry Baryshkov
  2024-01-30 15:24 ` Bryan O'Donoghue
  2 siblings, 2 replies; 10+ messages in thread
From: Andi Shyti @ 2024-01-29 23:24 UTC (permalink / raw)
  To: Viken Dadhaniya, Bryan O'Donoghue
  Cc: andersson, konrad.dybcio, linux-arm-msm, linux-i2c, linux-kernel,
	vkoul, quic_bjorande, manivannan.sadhasivam, quic_msavaliy,
	quic_vtanuku

Hi Viken,

as Bryan has done some comments in version 1, please, Cc him to
this patch.

On Mon, Jan 29, 2024 at 11:40:03AM +0530, Viken Dadhaniya wrote:
> For i2c read operation, we are getting gsi mode timeout due
> to malformed TRE(Transfer Ring Element). Currently we are
> configuring incorrect TRE sequence in gpi driver
> (drivers/dma/qcom/gpi.c) as below
> 
> - Sets up CONFIG
> - Sets up DMA tre
> - Sets up GO tre
> 
> As per HPG(Hardware programming guide), We should configure TREs in below
> sequence for any i2c transfer
> 
> - Sets up CONFIG tre
> - Sets up GO tre
> - Sets up DMA tre
> 
> For only write operation or write followed by read operation,
> existing software sequence is correct.
> 
> for only read operation, TRE sequence need to be corrected.
> Hence, we have changed the sequence to submit GO tre before DMA tre.
> 
> Tested covering i2c read/write transfer on QCM6490 RB3 board.
> 
> Signed-off-by: Viken Dadhaniya <quic_vdadhani@quicinc.com>
> Fixes: commit d8703554f4de ("i2c: qcom-geni: Add support for GPI DMA")

The format is:

Fixes: d8703554f4de ("i2c: qcom-geni: Add support for GPI DMA")

and goes above the SoB.

> ---
> 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);
> +		}
> +

Bryan, could you please check here?

Thanks for your review!

Andi

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [V2] i2c: i2c-qcom-geni: Correct I2C TRE sequence
  2024-01-29  6:10 [V2] i2c: i2c-qcom-geni: Correct I2C TRE sequence Viken Dadhaniya
  2024-01-29 23:24 ` Andi Shyti
@ 2024-01-29 23:49 ` Dmitry Baryshkov
  2024-01-30  9:42   ` Andi Shyti
  2024-02-01 10:19   ` Viken Dadhaniya
  2024-01-30 15:24 ` Bryan O'Donoghue
  2 siblings, 2 replies; 10+ messages in thread
From: Dmitry Baryshkov @ 2024-01-29 23:49 UTC (permalink / raw)
  To: Viken Dadhaniya
  Cc: andersson, konrad.dybcio, andi.shyti, linux-arm-msm, linux-i2c,
	linux-kernel, vkoul, quic_bjorande, manivannan.sadhasivam,
	quic_msavaliy, quic_vtanuku

On Mon, 29 Jan 2024 at 08:10, Viken Dadhaniya <quic_vdadhani@quicinc.com> wrote:
>
> For i2c read operation, we are getting gsi mode timeout due
> to malformed TRE(Transfer Ring Element). Currently we are
> configuring incorrect TRE sequence in gpi driver
> (drivers/dma/qcom/gpi.c) as below
>
> - Sets up CONFIG
> - Sets up DMA tre
> - Sets up GO tre
>
> As per HPG(Hardware programming guide), We should configure TREs in below
> sequence for any i2c transfer
>
> - Sets up CONFIG tre
> - Sets up GO tre
> - Sets up DMA tre

It is not clear how this is relevant and/or affected by swapping
I2C_WRITE and I2C_READ gpi calls.

>
> For only write operation or write followed by read operation,
> existing software sequence is correct.
>
> for only read operation, TRE sequence need to be corrected.
> Hence, we have changed the sequence to submit GO tre before DMA tre.
>
> Tested covering i2c read/write transfer on QCM6490 RB3 board.

Please read Documentation/process/submitting-patches.rst, understand
it and write a proper commit message.

>
> Signed-off-by: Viken Dadhaniya <quic_vdadhani@quicinc.com>
> Fixes: commit d8703554f4de ("i2c: qcom-geni: Add support for GPI DMA")

As it was pointed out, this line shows ignorance of the mentioned file
and of the existing community practices.

> ---
> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [V2] i2c: i2c-qcom-geni: Correct I2C TRE sequence
  2024-01-29 23:49 ` Dmitry Baryshkov
@ 2024-01-30  9:42   ` Andi Shyti
  2024-02-01 10:21     ` Viken Dadhaniya
  2024-02-01 10:19   ` Viken Dadhaniya
  1 sibling, 1 reply; 10+ messages in thread
From: Andi Shyti @ 2024-01-30  9:42 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: Viken Dadhaniya, andersson, konrad.dybcio, linux-arm-msm,
	linux-i2c, linux-kernel, vkoul, quic_bjorande,
	manivannan.sadhasivam, quic_msavaliy, quic_vtanuku

Hi Dmitry,

thanks a lot for your review!

On Tue, Jan 30, 2024 at 01:49:57AM +0200, Dmitry Baryshkov wrote:
> On Mon, 29 Jan 2024 at 08:10, Viken Dadhaniya <quic_vdadhani@quicinc.com> wrote:
> >
> > For i2c read operation, we are getting gsi mode timeout due
> > to malformed TRE(Transfer Ring Element). Currently we are
> > configuring incorrect TRE sequence in gpi driver
> > (drivers/dma/qcom/gpi.c) as below
> >
> > - Sets up CONFIG
> > - Sets up DMA tre
> > - Sets up GO tre
> >
> > As per HPG(Hardware programming guide), We should configure TREs in below
> > sequence for any i2c transfer
> >
> > - Sets up CONFIG tre
> > - Sets up GO tre
> > - Sets up DMA tre
> 
> It is not clear how this is relevant and/or affected by swapping
> I2C_WRITE and I2C_READ gpi calls.
> 
> >
> > For only write operation or write followed by read operation,
> > existing software sequence is correct.
> >
> > for only read operation, TRE sequence need to be corrected.
> > Hence, we have changed the sequence to submit GO tre before DMA tre.
> >
> > Tested covering i2c read/write transfer on QCM6490 RB3 board.
> 
> Please read Documentation/process/submitting-patches.rst, understand
> it and write a proper commit message.
> 
> >
> > Signed-off-by: Viken Dadhaniya <quic_vdadhani@quicinc.com>
> > Fixes: commit d8703554f4de ("i2c: qcom-geni: Add support for GPI DMA")
> 
> As it was pointed out, this line shows ignorance of the mentioned file
> and of the existing community practices.

If the issue is only in the commit message Viken can propose a
proper commit message as reply to this e-mail and I can fix it
before merging the change.

Important is that no issue is seen in the code.

Please, Viken, can you either send a v3 with a proper commit
message or write it in the reply to this e-mail with the changes
that Dmitry suggested.

> > ---
> > 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

If you are going to submit again, please make also sure that the
e-mail is formatted properly.

I'm not sure that this footer will be accepted by git.

Thanks,
Andi

> >
> >
> 
> 
> -- 
> With best wishes
> Dmitry

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [V2] i2c: i2c-qcom-geni: Correct I2C TRE sequence
  2024-01-29 23:24 ` Andi Shyti
@ 2024-01-30 11:32   ` Bryan O'Donoghue
  2024-02-01 10:17   ` Viken Dadhaniya
  1 sibling, 0 replies; 10+ messages in thread
From: Bryan O'Donoghue @ 2024-01-30 11:32 UTC (permalink / raw)
  To: Andi Shyti, Viken Dadhaniya
  Cc: andersson, konrad.dybcio, linux-arm-msm, linux-i2c, linux-kernel,
	vkoul, quic_bjorande, manivannan.sadhasivam, quic_msavaliy,
	quic_vtanuku

On 29/01/2024 23:24, Andi Shyti wrote:
> Hi Viken,
> 
> as Bryan has done some comments in version 1, please, Cc him to
> this patch.
> 
> On Mon, Jan 29, 2024 at 11:40:03AM +0530, Viken Dadhaniya wrote:
>> For i2c read operation, we are getting gsi mode timeout due
>> to malformed TRE(Transfer Ring Element). Currently we are
>> configuring incorrect TRE sequence in gpi driver
>> (drivers/dma/qcom/gpi.c) as below
>>
>> - Sets up CONFIG
>> - Sets up DMA tre
>> - Sets up GO tre
>>
>> As per HPG(Hardware programming guide), We should configure TREs in below
>> sequence for any i2c transfer
>>
>> - Sets up CONFIG tre
>> - Sets up GO tre
>> - Sets up DMA tre
>>
>> For only write operation or write followed by read operation,
>> existing software sequence is correct.
>>
>> for only read operation, TRE sequence need to be corrected.
>> Hence, we have changed the sequence to submit GO tre before DMA tre.
>>
>> Tested covering i2c read/write transfer on QCM6490 RB3 board.
>>
>> Signed-off-by: Viken Dadhaniya <quic_vdadhani@quicinc.com>
>> Fixes: commit d8703554f4de ("i2c: qcom-geni: Add support for GPI DMA")
> 
> The format is:
> 
> Fixes: d8703554f4de ("i2c: qcom-geni: Add support for GPI DMA")
> 
> and goes above the SoB.
> 
>> ---
>> 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);
>> +		}
>> +
> 
> Bryan, could you please check here?
> 
> Thanks for your review!
> 
> Andi

Assuming the Fixes tag is fixed.

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # qrb5165-rb5

---
bod

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [V2] i2c: i2c-qcom-geni: Correct I2C TRE sequence
  2024-01-29  6:10 [V2] i2c: i2c-qcom-geni: Correct I2C TRE sequence Viken Dadhaniya
  2024-01-29 23:24 ` Andi Shyti
  2024-01-29 23:49 ` Dmitry Baryshkov
@ 2024-01-30 15:24 ` Bryan O'Donoghue
  2024-02-01 10:23   ` Viken Dadhaniya
  2 siblings, 1 reply; 10+ messages in thread
From: Bryan O'Donoghue @ 2024-01-30 15:24 UTC (permalink / raw)
  To: Viken Dadhaniya, andersson, konrad.dybcio, andi.shyti,
	linux-arm-msm, linux-i2c, linux-kernel, vkoul, quic_bjorande,
	manivannan.sadhasivam
  Cc: quic_msavaliy, quic_vtanuku

On 29/01/2024 06:10, Viken Dadhaniya wrote:
> As per HPG(Hardware programming guide

Since you are doing a V3 here, please amend this too.

"As per HPG" means almost nothing outside of qcom.

"As per Qualcomm's internal Hardware Programming Guide"

Right thing to do to reference the document IMO but, you should make 
clear its an internal silicon specification that's not public.

Also not sure the TRE description adds much.

Just give a high level description of the sequences being out-of-order 
with respect to the hardware spec.

---
bod

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [V2] i2c: i2c-qcom-geni: Correct I2C TRE sequence
  2024-01-29 23:24 ` Andi Shyti
  2024-01-30 11:32   ` Bryan O'Donoghue
@ 2024-02-01 10:17   ` Viken Dadhaniya
  1 sibling, 0 replies; 10+ messages in thread
From: Viken Dadhaniya @ 2024-02-01 10:17 UTC (permalink / raw)
  To: Andi Shyti, Bryan O'Donoghue
  Cc: andersson, konrad.dybcio, linux-arm-msm, linux-i2c, linux-kernel,
	vkoul, quic_bjorande, manivannan.sadhasivam, quic_msavaliy,
	quic_vtanuku



On 1/30/2024 4:54 AM, Andi Shyti wrote:
> Hi Viken,
> 
> as Bryan has done some comments in version 1, please, Cc him to
> this patch.
> 
> On Mon, Jan 29, 2024 at 11:40:03AM +0530, Viken Dadhaniya wrote:
>> For i2c read operation, we are getting gsi mode timeout due
>> to malformed TRE(Transfer Ring Element). Currently we are
>> configuring incorrect TRE sequence in gpi driver
>> (drivers/dma/qcom/gpi.c) as below
>>
>> - Sets up CONFIG
>> - Sets up DMA tre
>> - Sets up GO tre
>>
>> As per HPG(Hardware programming guide), We should configure TREs in below
>> sequence for any i2c transfer
>>
>> - Sets up CONFIG tre
>> - Sets up GO tre
>> - Sets up DMA tre
>>
>> For only write operation or write followed by read operation,
>> existing software sequence is correct.
>>
>> for only read operation, TRE sequence need to be corrected.
>> Hence, we have changed the sequence to submit GO tre before DMA tre.
>>
>> Tested covering i2c read/write transfer on QCM6490 RB3 board.
>>
>> Signed-off-by: Viken Dadhaniya <quic_vdadhani@quicinc.com>
>> Fixes: commit d8703554f4de ("i2c: qcom-geni: Add support for GPI DMA")
> 
> The format is:
> 
> Fixes: d8703554f4de ("i2c: qcom-geni: Add support for GPI DMA")
> 
> and goes above the SoB.
> 

Submitted V3 with correct fix tag.

>> ---
>> 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);
>> +		}
>> +
> 
> Bryan, could you please check here?
> 
> Thanks for your review!
> 
> Andi

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [V2] i2c: i2c-qcom-geni: Correct I2C TRE sequence
  2024-01-29 23:49 ` Dmitry Baryshkov
  2024-01-30  9:42   ` Andi Shyti
@ 2024-02-01 10:19   ` Viken Dadhaniya
  1 sibling, 0 replies; 10+ messages in thread
From: Viken Dadhaniya @ 2024-02-01 10:19 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: andersson, konrad.dybcio, andi.shyti, linux-arm-msm, linux-i2c,
	linux-kernel, vkoul, quic_bjorande, manivannan.sadhasivam,
	quic_msavaliy, quic_vtanuku



On 1/30/2024 5:19 AM, Dmitry Baryshkov wrote:
> On Mon, 29 Jan 2024 at 08:10, Viken Dadhaniya <quic_vdadhani@quicinc.com> wrote:
>>
>> For i2c read operation, we are getting gsi mode timeout due
>> to malformed TRE(Transfer Ring Element). Currently we are
>> configuring incorrect TRE sequence in gpi driver
>> (drivers/dma/qcom/gpi.c) as below
>>
>> - Sets up CONFIG
>> - Sets up DMA tre
>> - Sets up GO tre
>>
>> As per HPG(Hardware programming guide), We should configure TREs in below
>> sequence for any i2c transfer
>>
>> - Sets up CONFIG tre
>> - Sets up GO tre
>> - Sets up DMA tre
> 
> It is not clear how this is relevant and/or affected by swapping
> I2C_WRITE and I2C_READ gpi calls.
> 

Submitted V3 with proper commit log.

>>
>> For only write operation or write followed by read operation,
>> existing software sequence is correct.
>>
>> for only read operation, TRE sequence need to be corrected.
>> Hence, we have changed the sequence to submit GO tre before DMA tre.
>>
>> Tested covering i2c read/write transfer on QCM6490 RB3 board.
> 
> Please read Documentation/process/submitting-patches.rst, understand
> it and write a proper commit message.
> 
>>
>> Signed-off-by: Viken Dadhaniya <quic_vdadhani@quicinc.com>
>> Fixes: commit d8703554f4de ("i2c: qcom-geni: Add support for GPI DMA")
> 
> As it was pointed out, this line shows ignorance of the mentioned file
> and of the existing community practices.
> 

Updated fixes tag in V3.

>> ---
>> 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
>>
>>
> 
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [V2] i2c: i2c-qcom-geni: Correct I2C TRE sequence
  2024-01-30  9:42   ` Andi Shyti
@ 2024-02-01 10:21     ` Viken Dadhaniya
  0 siblings, 0 replies; 10+ messages in thread
From: Viken Dadhaniya @ 2024-02-01 10:21 UTC (permalink / raw)
  To: Andi Shyti, Dmitry Baryshkov
  Cc: andersson, konrad.dybcio, linux-arm-msm, linux-i2c, linux-kernel,
	vkoul, quic_bjorande, manivannan.sadhasivam, quic_msavaliy,
	quic_vtanuku



On 1/30/2024 3:12 PM, Andi Shyti wrote:
> Hi Dmitry,
> 
> thanks a lot for your review!
> 
> On Tue, Jan 30, 2024 at 01:49:57AM +0200, Dmitry Baryshkov wrote:
>> On Mon, 29 Jan 2024 at 08:10, Viken Dadhaniya <quic_vdadhani@quicinc.com> wrote:
>>>
>>> For i2c read operation, we are getting gsi mode timeout due
>>> to malformed TRE(Transfer Ring Element). Currently we are
>>> configuring incorrect TRE sequence in gpi driver
>>> (drivers/dma/qcom/gpi.c) as below
>>>
>>> - Sets up CONFIG
>>> - Sets up DMA tre
>>> - Sets up GO tre
>>>
>>> As per HPG(Hardware programming guide), We should configure TREs in below
>>> sequence for any i2c transfer
>>>
>>> - Sets up CONFIG tre
>>> - Sets up GO tre
>>> - Sets up DMA tre
>>
>> It is not clear how this is relevant and/or affected by swapping
>> I2C_WRITE and I2C_READ gpi calls.
>>
>>>
>>> For only write operation or write followed by read operation,
>>> existing software sequence is correct.
>>>
>>> for only read operation, TRE sequence need to be corrected.
>>> Hence, we have changed the sequence to submit GO tre before DMA tre.
>>>
>>> Tested covering i2c read/write transfer on QCM6490 RB3 board.
>>
>> Please read Documentation/process/submitting-patches.rst, understand
>> it and write a proper commit message.
>>
>>>
>>> Signed-off-by: Viken Dadhaniya <quic_vdadhani@quicinc.com>
>>> Fixes: commit d8703554f4de ("i2c: qcom-geni: Add support for GPI DMA")
>>
>> As it was pointed out, this line shows ignorance of the mentioned file
>> and of the existing community practices.
> 
> If the issue is only in the commit message Viken can propose a
> proper commit message as reply to this e-mail and I can fix it
> before merging the change.
> 
> Important is that no issue is seen in the code.
> 
> Please, Viken, can you either send a v3 with a proper commit
> message or write it in the reply to this e-mail with the changes
> that Dmitry suggested.
> 

Submitted V3 with proper commit log

>>> ---
>>> 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
> 
> If you are going to submit again, please make also sure that the
> e-mail is formatted properly.
> 
> I'm not sure that this footer will be accepted by git.
> 
> Thanks,
> Andi
> 

Submitted V3 with proper email format.

>>>
>>>
>>
>>
>> -- 
>> With best wishes
>> Dmitry

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [V2] i2c: i2c-qcom-geni: Correct I2C TRE sequence
  2024-01-30 15:24 ` Bryan O'Donoghue
@ 2024-02-01 10:23   ` Viken Dadhaniya
  0 siblings, 0 replies; 10+ messages in thread
From: Viken Dadhaniya @ 2024-02-01 10:23 UTC (permalink / raw)
  To: Bryan O'Donoghue, andersson, konrad.dybcio, andi.shyti,
	linux-arm-msm, linux-i2c, linux-kernel, vkoul, quic_bjorande,
	manivannan.sadhasivam
  Cc: quic_msavaliy, quic_vtanuku



On 1/30/2024 8:54 PM, Bryan O'Donoghue wrote:
> On 29/01/2024 06:10, Viken Dadhaniya wrote:
>> As per HPG(Hardware programming guide
> 
> Since you are doing a V3 here, please amend this too.
> 
> "As per HPG" means almost nothing outside of qcom.
> 
> "As per Qualcomm's internal Hardware Programming Guide"
> 
> Right thing to do to reference the document IMO but, you should make 
> clear its an internal silicon specification that's not public.
> 
> Also not sure the TRE description adds much.
> 
> Just give a high level description of the sequences being out-of-order 
> with respect to the hardware spec.
> 
> ---
> bod

Updated commit log and provided TRE description with sequence in V3.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2024-02-01 10:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-29  6:10 [V2] i2c: i2c-qcom-geni: Correct I2C TRE sequence Viken Dadhaniya
2024-01-29 23:24 ` Andi Shyti
2024-01-30 11:32   ` Bryan O'Donoghue
2024-02-01 10:17   ` Viken Dadhaniya
2024-01-29 23:49 ` Dmitry Baryshkov
2024-01-30  9:42   ` Andi Shyti
2024-02-01 10:21     ` Viken Dadhaniya
2024-02-01 10:19   ` Viken Dadhaniya
2024-01-30 15:24 ` Bryan O'Donoghue
2024-02-01 10:23   ` Viken Dadhaniya

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).