Date: Tue, 21 Nov 2006 16:16:19 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 110182 for review Message-ID: <200611211616.kALGGJ30045040@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=110182 Change 110182 by sam@sam_ebb on 2006/11/18 02:52:03 Get it working: o slave address in avila docs is correct; don't believe what linux print probes, it's the 7-bit address >> 1 o correct set method to send register pointer before 4 bytes of data in a single transaction Affected files ... .. //depot/projects/arm/src/sys/arm/xscale/ixp425/ds1672.c#3 edit Differences ... ==== //depot/projects/arm/src/sys/arm/xscale/ixp425/ds1672.c#3 (text+ko) ==== @@ -54,8 +54,7 @@ #define IIC_M_WR 0 /* write operation */ -/* NB: Gateworks doc say this is 0x80 but Linux uses 0x68 */ -#define DS1672_ADDR 0x68 /* slave address */ +#define DS1672_ADDR 0xd0 /* slave address */ #define DS1672_COUNTER 0 /* counter (bytes 0-3) */ #define DS1672_CTRL 4 /* control (1 byte) */ @@ -89,7 +88,7 @@ static int ds1672_gettime(device_t dev, struct timespec *ts) { - uint8_t addr[2] = { 0, DS1672_COUNTER }; + uint8_t addr[1] = { DS1672_COUNTER }; uint8_t secs[4]; struct iic_msg msgs[2] = { { DS1672_ADDR, IIC_M_WR, 1, addr }, @@ -110,19 +109,18 @@ static int ds1672_settime(device_t dev, struct timespec *ts) { - uint8_t addr[2] = { 0, DS1672_COUNTER }; - uint8_t secs[4]; - struct iic_msg msgs[2] = { - { DS1672_ADDR, IIC_M_WR, 1, addr }, - { DS1672_ADDR, IIC_M_WR, 4, secs }, + /* NB: register pointer precedes actual data */ + uint8_t data[5] = { DS1672_COUNTER }; + struct iic_msg msgs[1] = { + { DS1672_ADDR, IIC_M_WR, 5, data }, }; - secs[1] = (ts->tv_sec >> 0) & 0xff; - secs[2] = (ts->tv_sec >> 8) & 0xff; - secs[3] = (ts->tv_sec >> 16) & 0xff; - secs[4] = (ts->tv_sec >> 24) & 0xff; + data[1] = (ts->tv_sec >> 0) & 0xff; + data[2] = (ts->tv_sec >> 8) & 0xff; + data[3] = (ts->tv_sec >> 16) & 0xff; + data[4] = (ts->tv_sec >> 24) & 0xff; - return iicbus_transfer(dev, msgs, 2); + return iicbus_transfer(dev, msgs, 1); } static device_method_t ds1672_methods[] = {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200611211616.kALGGJ30045040>