Re: [linux-yocto] [kernel v5.2/standard/xlnx-soc][PATCH 1/2] i2c: cadence: do not clear bus_hold_flag in mrecv

2019-10-23 Thread Quanyang Wang

Hi Shubhrajyoti,

On 10/23/19 5:17 PM, Shubhrajyoti Datta wrote:

Hi ,


-Original Message-
From: Quanyang Wang 
Sent: Wednesday, October 23, 2019 2:24 PM
To: Michal Simek ; Bruce ;
Shubhrajyoti Datta 
Cc: linux-yocto@yoctoproject.org; git 
Subject: Re: [linux-yocto][kernel v5.2/standard/xlnx-soc][PATCH 1/2] i2c:
cadence: do not clear bus_hold_flag in mrecv

Hi,

On 10/14/19 2:07 PM, Michal Simek wrote:

On 13. 10. 19 15:33, quanyang.w...@windriver.com wrote:

From: Quanyang Wang 

When using i2c_smbus_read_byte_data to read one byte from a slave
device, because of the commit d358def70688
("i2c: cadence: Fix the hold bit setting"), the transaction becomes:

S Addr Wr [A] Comm [A] P S Addr Rd [A] [Data] NA P
 ^
  CR_HOLD bit as 0

This will result that the read operation fails and will read "0xff"
from the slave device. In the SMBus protocol stipulates that it must
follow that command with a repeated START condition as below:

S Addr Wr [A] Comm [A] Sr Addr Rd [A] [Data] NA P

So keep CR_HOLD bit to be 1 to make sure that the read operation
begins with a Sr (repeated START) but not a STOP followed by START.

Signed-off-by: Quanyang Wang 
---
   drivers/i2c/busses/i2c-cadence.c | 2 --
   1 file changed, 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cadence.c
b/drivers/i2c/busses/i2c-cadence.c
index 6b011931e090..d9493914be15 100644
--- a/drivers/i2c/busses/i2c-cadence.c
+++ b/drivers/i2c/busses/i2c-cadence.c
@@ -626,8 +626,6 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
 */
if ((id->recv_count > CDNS_I2C_FIFO_DEPTH)  || id->bus_hold_flag)
ctrl_reg |= CDNS_I2C_CR_HOLD;
-   else
-   ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD;

cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET);



Shubhrajyoti: Can you please comment?

Any comment?

I am not finding code segment in the tree
I am checking

https://gitenterprise.xilinx.com/Linux/linux-xlnx/blob/master/drivers/i2c/busses/i2c-cadence.c

maybe you can try moving to the latest code.


And when SDK kernel applies with this patch "i2c: cadence: Fix the hold 
bit setting",


using i2c_smbus_read_byte_data to access ucd90120 
(drivers/hwmon/pmbus/ucd9000.c) in the board zc706 can reproduce this error.


Thanks,

Quanyang


M
-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


Re: [linux-yocto] [kernel v5.2/standard/xlnx-soc][PATCH 1/2] i2c: cadence: do not clear bus_hold_flag in mrecv

2019-10-23 Thread Quanyang Wang

Hi,

On 10/14/19 2:07 PM, Michal Simek wrote:

On 13. 10. 19 15:33, quanyang.w...@windriver.com wrote:

From: Quanyang Wang 

When using i2c_smbus_read_byte_data to read one byte from a
slave device, because of the commit d358def70688
("i2c: cadence: Fix the hold bit setting"), the transaction becomes:

S Addr Wr [A] Comm [A] P S Addr Rd [A] [Data] NA P
^
 CR_HOLD bit as 0

This will result that the read operation fails and will read "0xff" from
the slave device. In the SMBus protocol stipulates that it must follow that
command with a repeated START condition as below:

S Addr Wr [A] Comm [A] Sr Addr Rd [A] [Data] NA P

So keep CR_HOLD bit to be 1 to make sure that the read operation begins
with a Sr (repeated START) but not a STOP followed by START.

Signed-off-by: Quanyang Wang 
---
  drivers/i2c/busses/i2c-cadence.c | 2 --
  1 file changed, 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
index 6b011931e090..d9493914be15 100644
--- a/drivers/i2c/busses/i2c-cadence.c
+++ b/drivers/i2c/busses/i2c-cadence.c
@@ -626,8 +626,6 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
 */
if ((id->recv_count > CDNS_I2C_FIFO_DEPTH)  || id->bus_hold_flag)
ctrl_reg |= CDNS_I2C_CR_HOLD;
-   else
-   ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD;
  
  	cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET);
  


Shubhrajyoti: Can you please comment?

Any comment?


M

--
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [kernel v5.2/standard/xlnx-soc][PATCH 1/2] i2c: cadence: do not clear bus_hold_flag in mrecv

2019-10-13 Thread quanyang.wang
From: Quanyang Wang 

When using i2c_smbus_read_byte_data to read one byte from a
slave device, because of the commit d358def70688
("i2c: cadence: Fix the hold bit setting"), the transaction becomes:

S Addr Wr [A] Comm [A] P S Addr Rd [A] [Data] NA P
   ^
CR_HOLD bit as 0

This will result that the read operation fails and will read "0xff" from
the slave device. In the SMBus protocol stipulates that it must follow that
command with a repeated START condition as below:

S Addr Wr [A] Comm [A] Sr Addr Rd [A] [Data] NA P

So keep CR_HOLD bit to be 1 to make sure that the read operation begins
with a Sr (repeated START) but not a STOP followed by START.

Signed-off-by: Quanyang Wang 
---
 drivers/i2c/busses/i2c-cadence.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
index 6b011931e090..d9493914be15 100644
--- a/drivers/i2c/busses/i2c-cadence.c
+++ b/drivers/i2c/busses/i2c-cadence.c
@@ -626,8 +626,6 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
 */
if ((id->recv_count > CDNS_I2C_FIFO_DEPTH)  || id->bus_hold_flag)
ctrl_reg |= CDNS_I2C_CR_HOLD;
-   else
-   ctrl_reg = ctrl_reg & ~CDNS_I2C_CR_HOLD;
 
cdns_i2c_writereg(ctrl_reg, CDNS_I2C_CR_OFFSET);
 
-- 
2.17.1

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto