Skip to content
Snippets Groups Projects
Commit 7e78f7ad authored by Dirk Eibach's avatar Dirk Eibach Committed by Heiko Schocher
Browse files

ppc4xx: Fix i2c repeated start


Debugging some i2c trouble I saw on my scope that repeated
start is not working properply. The 4xx even held clock pulled down
after transfers. Having a look in the driver I realized
that IIC_CNTL_RPST is set on that part of the transfer that should
begin with a repeated start. But repeated start is about not sending a
stop condition, so IIC_CNTL_RPST has to be set on the last transfer
before the repeated start happens.

Signed-off-by: default avatarDirk Eibach <dirk.eibach@gdsys.cc>
Reviewed-by: default avatarStefan Roese <sr@denx.de>
parent 11ada922
No related branches found
No related tags found
No related merge requests found
...@@ -158,8 +158,7 @@ static void ppc4xx_i2c_init(struct i2c_adapter *adap, int speed, int slaveaddr) ...@@ -158,8 +158,7 @@ static void ppc4xx_i2c_init(struct i2c_adapter *adap, int speed, int slaveaddr)
* *
* Typical case is a Write of an addr followd by a Read. The * Typical case is a Write of an addr followd by a Read. The
* IBM FAQ does not cover this. On the last byte of the write * IBM FAQ does not cover this. On the last byte of the write
* we don't set the creg CHT bit, and on the first bytes of the * we don't set the creg CHT bit but the RPST bit.
* read we set the RPST bit.
* *
* It does not support address only transfers, there must be * It does not support address only transfers, there must be
* a data part. If you want to write the address yourself, put * a data part. If you want to write the address yourself, put
...@@ -247,6 +246,10 @@ static int _i2c_transfer(struct i2c_adapter *adap, ...@@ -247,6 +246,10 @@ static int _i2c_transfer(struct i2c_adapter *adap,
if ((!cmd_type && (ptr == addr)) || ((tran + bc) != cnt)) if ((!cmd_type && (ptr == addr)) || ((tran + bc) != cnt))
creg |= IIC_CNTL_CHT; creg |= IIC_CNTL_CHT;
/* last part of address, prepare for repeated start on read */
if (cmd_type && (ptr == addr) && ((tran + bc) == cnt))
creg |= IIC_CNTL_RPST;
if (reading) { if (reading) {
creg |= IIC_CNTL_READ; creg |= IIC_CNTL_READ;
} else { } else {
...@@ -314,8 +317,6 @@ static int _i2c_transfer(struct i2c_adapter *adap, ...@@ -314,8 +317,6 @@ static int _i2c_transfer(struct i2c_adapter *adap,
cnt = data_len; cnt = data_len;
tran = 0; tran = 0;
reading = cmd_type; reading = cmd_type;
if (reading)
creg = IIC_CNTL_RPST;
} }
} }
return result; return result;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment