* [U-Boot-Users] [PATCH] soft_i2c/i2c_probe(): Perform reads instead of writes
@ 2005-05-26 20:06 Peter Korsgaard
2005-05-26 22:35 ` Tolunay Orkun
2006-03-12 0:31 ` Wolfgang Denk
0 siblings, 2 replies; 7+ messages in thread
From: Peter Korsgaard @ 2005-05-26 20:06 UTC (permalink / raw)
To: u-boot
A non-text attachment was scrubbed...
Name: uboot.softi2c.probe.patch
Type: text/x-patch
Size: 521 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20050526/3ce30481/attachment.bin
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot-Users] [PATCH] soft_i2c/i2c_probe(): Perform reads instead of writes
2005-05-26 20:06 [U-Boot-Users] [PATCH] soft_i2c/i2c_probe(): Perform reads instead of writes Peter Korsgaard
@ 2005-05-26 22:35 ` Tolunay Orkun
2005-06-11 14:41 ` Peter Korsgaard
2006-03-12 0:31 ` Wolfgang Denk
1 sibling, 1 reply; 7+ messages in thread
From: Tolunay Orkun @ 2005-05-26 22:35 UTC (permalink / raw)
To: u-boot
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);
>
>
> ------------------------------------------------------------------------
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot-Users] [PATCH] soft_i2c/i2c_probe(): Perform reads instead of writes
2005-05-26 22:35 ` Tolunay Orkun
@ 2005-06-11 14:41 ` Peter Korsgaard
2005-06-14 21:34 ` Tolunay Orkun
0 siblings, 1 reply; 7+ messages in thread
From: Peter Korsgaard @ 2005-06-11 14:41 UTC (permalink / raw)
To: u-boot
>>>>> "Tolunay" == Tolunay Orkun <listmember@orkun.us> writes:
Hi, and sorry for the slow response!
Tolunay> Peter, I believe the implementation was correct but the
Tolunay> comment was wrong. It should be a write transaction with
Tolunay> just address byte. After the address byte is transmitted the
Tolunay> I2C slave will acknowledge (if present) and we finish the
Tolunay> transaction by generating the stop condition. i.e. fake
Tolunay> write.
Why write? Wouldn't a zero byte read transaction be safer?
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot-Users] [PATCH] soft_i2c/i2c_probe(): Perform reads instead of writes
2005-06-11 14:41 ` Peter Korsgaard
@ 2005-06-14 21:34 ` Tolunay Orkun
2005-06-15 3:16 ` Eugene Surovegin
2005-06-15 6:25 ` Peter Korsgaard
0 siblings, 2 replies; 7+ messages in thread
From: Tolunay Orkun @ 2005-06-14 21:34 UTC (permalink / raw)
To: u-boot
Peter Korsgaard wrote:
>>>>>>"Tolunay" == Tolunay Orkun <listmember@orkun.us> writes:
>>>>>>
>>>>>>
>
>Hi, and sorry for the slow response!
>
> Tolunay> Peter, I believe the implementation was correct but the
> Tolunay> comment was wrong. It should be a write transaction with
> Tolunay> just address byte. After the address byte is transmitted the
> Tolunay> I2C slave will acknowledge (if present) and we finish the
> Tolunay> transaction by generating the stop condition. i.e. fake
> Tolunay> write.
>
>Why write? Wouldn't a zero byte read transaction be safer?
>
>
>
I have read somewhere (that I cannot find now), that some device would
lock up on 0-byte read vs 0-byte write. Since the current code is
working as it is unless there is demonstrable problem with it, I would
fix the comment only.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot-Users] [PATCH] soft_i2c/i2c_probe(): Perform reads instead of writes
2005-06-14 21:34 ` Tolunay Orkun
@ 2005-06-15 3:16 ` Eugene Surovegin
2005-06-15 6:25 ` Peter Korsgaard
1 sibling, 0 replies; 7+ messages in thread
From: Eugene Surovegin @ 2005-06-15 3:16 UTC (permalink / raw)
To: u-boot
On Tue, Jun 14, 2005 at 04:34:38PM -0500, Tolunay Orkun wrote:
> Peter Korsgaard wrote:
>
> >>>>>>"Tolunay" == Tolunay Orkun <listmember@orkun.us> writes:
> >>>>>>
> >>>>>>
> >
> >Hi, and sorry for the slow response!
> >
> >Tolunay> Peter, I believe the implementation was correct but the
> >Tolunay> comment was wrong. It should be a write transaction with
> >Tolunay> just address byte. After the address byte is transmitted the
> >Tolunay> I2C slave will acknowledge (if present) and we finish the
> >Tolunay> transaction by generating the stop condition. i.e. fake
> >Tolunay> write.
> >
> >Why write? Wouldn't a zero byte read transaction be safer?
> >
> >
> >
> I have read somewhere (that I cannot find now), that some device would
> lock up on 0-byte read vs 0-byte write. Since the current code is
> working as it is unless there is demonstrable problem with it, I would
> fix the comment only.
Ebony (PPC440GP eval board) has a device like this, IIRC it's a clock
driver, zero-read locks the bus completely.
In general, zero write is safer, also SMBUS spec defines such
transaction as SMBUS QUICK; interestingly, there is no read
equivalent :).
Also, from personal testing, using zero-write as detection hack,
yields more devices than zero-read.
--
Eugene
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot-Users] [PATCH] soft_i2c/i2c_probe(): Perform reads instead of writes
2005-06-14 21:34 ` Tolunay Orkun
2005-06-15 3:16 ` Eugene Surovegin
@ 2005-06-15 6:25 ` Peter Korsgaard
1 sibling, 0 replies; 7+ messages in thread
From: Peter Korsgaard @ 2005-06-15 6:25 UTC (permalink / raw)
To: u-boot
A non-text attachment was scrubbed...
Name: uboot.softi2c.probe.patch
Type: text/x-patch
Size: 510 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20050615/dde88430/attachment.bin
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot-Users] [PATCH] soft_i2c/i2c_probe(): Perform reads instead of writes
2005-05-26 20:06 [U-Boot-Users] [PATCH] soft_i2c/i2c_probe(): Perform reads instead of writes Peter Korsgaard
2005-05-26 22:35 ` Tolunay Orkun
@ 2006-03-12 0:31 ` Wolfgang Denk
1 sibling, 0 replies; 7+ messages in thread
From: Wolfgang Denk @ 2006-03-12 0:31 UTC (permalink / raw)
To: u-boot
In message <87ekbt3g7h.fsf@p4.48ers.dk> you wrote:
>
> * Patch by Peter Korsgaard, 26 May 2005:
> Use reads instead of writes for probe in soft_i2c.
Rejected. Tolunay's explanation was correct: only the comment was
wrong. Fixed the comment now.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I distrust all systematisers, and avoid them. The will to a system
shows a lack of honesty.
- Friedrich Wilhelm Nietzsche _G?tzen-D?mmerung [The Twilight of the
Idols]_ ``Maxims and Missiles'' no. 26
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-03-12 0:31 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-26 20:06 [U-Boot-Users] [PATCH] soft_i2c/i2c_probe(): Perform reads instead of writes Peter Korsgaard
2005-05-26 22:35 ` Tolunay Orkun
2005-06-11 14:41 ` Peter Korsgaard
2005-06-14 21:34 ` Tolunay Orkun
2005-06-15 3:16 ` Eugene Surovegin
2005-06-15 6:25 ` Peter Korsgaard
2006-03-12 0:31 ` Wolfgang Denk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox