[PATCH 1/2] Add support for Maxim/Dallas DS1374 Real-Time Clock Chip

Eugene Surovegin ebs at ebshome.net
Sat Jun 4 07:46:54 EST 2005


On Fri, Jun 03, 2005 at 02:36:06PM -0700, Randy Vinson wrote:
> Greetings,
>  I've put together a small I2C client for the Maxim/Dallas DS1374 RTC
> chip and tested it on a Freescale MPC8349ADS board that uses the chip.
> The attached patch adds support for the chip itself and a follow-up patch
> will add support to the Freescale board.

[snip]

> +	down(&ds1374_mutex);
> +
> +	/*
> +	 * Since the reads are being performed one byte at a time using
> +	 * the SMBus vs a 4-byte i2c transfer, there is a chance that a
> +	 * carry will occur during the read. To detect this, 2 reads are
> +	 * performed and compared.
> +	 */
> +	do {
> +		t1 = ds1374_read_rtc();
> +		t2 = ds1374_read_rtc();
> +	} while (t1 != t2 && limit--);

I wonder, why you chose to use those 1-byte SMBus transfers instead of 
i2c transfer.

I wrote similar DS1374 driver some time ago which used those transfers 
and they worked just fine.

-- 
Eugene





More information about the Linuxppc-embedded mailing list