From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tolunay Orkun Date: Thu, 26 May 2005 17:35:14 -0500 Subject: [U-Boot-Users] [PATCH] soft_i2c/i2c_probe(): Perform reads instead of writes In-Reply-To: <87ekbt3g7h.fsf@p4.48ers.dk> References: <87ekbt3g7h.fsf@p4.48ers.dk> Message-ID: <42964F22.60600@orkun.us> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Peter, I believe the implementation was correct but the comment was wrong. It should be a write transaction with just address byte. After the address byte is transmitted the I2C slave will acknowledge (if present) and we finish the transaction by generating the stop condition. i.e. fake write. Best regards, Tolunay Peter Korsgaard wrote: > Hi, > > The following little patch makes the i2c_probe function use reads > instead of writes to match the comment (broken in r1.2). > > * Patch by Peter Korsgaard, 26 May 2005: > Use reads instead of writes for probe in soft_i2c. > > > > ------------------------------------------------------------------------ > > Index: common/soft_i2c.c > =================================================================== > RCS file: /cvsroot/u-boot/u-boot/common/soft_i2c.c,v > retrieving revision 1.5 > diff -u -p -u -r1.5 soft_i2c.c > --- common/soft_i2c.c 21 Nov 2004 00:06:35 -0000 1.5 > +++ common/soft_i2c.c 26 May 2005 19:45:05 -0000 > @@ -290,7 +290,7 @@ int i2c_probe(uchar addr) > > /* perform 1 byte read transaction */ > send_start(); > - rc = write_byte ((addr << 1) | 0); > + rc = write_byte ((addr << 1) | 1); > send_stop(); > > return (rc ? 1 : 0); > > > ------------------------------------------------------------------------ > >