Signed-off-by: David Wu <davidwu@arcturusnetworks.com>
diff -urNa uClinux-dist/linux-2.6.x/drivers/rtc/rtc-ds1307.c uClinux-dist-ep2500/linux-2.6.x/drivers/rtc/rtc-ds1307.c
--- uClinux-dist/linux-2.6.x/drivers/rtc/rtc-ds1307.c	2009-12-30 17:05:24.000000000 -0500
+++ uClinux-dist-ep2500/linux-2.6.x/drivers/rtc/rtc-ds1307.c	2009-12-30 17:43:15.000000000 -0500
@@ -91,7 +91,7 @@
 #	define RX8025_BIT_PON		0x10
 #	define RX8025_BIT_VDET		0x40
 #	define RX8025_BIT_XST		0x20
-
+#define RX8025_TRANSFER_MODE	0x00   /* 0x08 */
 
 struct ds1307 {
 	u8			regs[11];
@@ -152,10 +152,16 @@
 static s32 ds1307_read_block_data_once(struct i2c_client *client, u8 command,
 				  u8 length, u8 *values)
 {
+	struct ds1307	*ds1307 = i2c_get_clientdata(client);
+	int reg_shift = 0;
 	s32 i, data;
 
+
+	if (ds1307->type == rx_8025) {
+		reg_shift = 4;
+	}
 	for (i = 0; i < length; i++) {
-		data = i2c_smbus_read_byte_data(client, command + i);
+		data = i2c_smbus_read_byte_data(client, command + (i << reg_shift));
 		if (data < 0)
 			return data;
 		values[i] = data;
@@ -192,10 +198,15 @@
 static s32 ds1307_write_block_data(struct i2c_client *client, u8 command,
 				   u8 length, const u8 *values)
 {
+	struct ds1307	*ds1307 = i2c_get_clientdata(client);
+	int reg_shift = 0;
 	u8 currvalues[I2C_SMBUS_BLOCK_MAX];
 	int tries = 0;
 
 	dev_dbg(&client->dev, "ds1307_write_block_data (length=%d)\n", length);
+	if (ds1307->type == rx_8025) {
+		reg_shift = 4;
+	}
 	do {
 		s32 i, ret;
 
@@ -205,7 +216,7 @@
 			return -EIO;
 		}
 		for (i = 0; i < length; i++) {
-			ret = i2c_smbus_write_byte_data(client, command + i,
+			ret = i2c_smbus_write_byte_data(client, command + (i << reg_shift),
 							values[i]);
 			if (ret < 0)
 				return ret;
@@ -687,8 +698,8 @@
 		break;
 
 	case rx_8025:
-		tmp = i2c_smbus_read_i2c_block_data(ds1307->client,
-				RX8025_REG_CTRL1 << 4 | 0x08, 2, buf);
+		tmp = ds1307->read_block_data(ds1307->client,
+				RX8025_REG_CTRL1 << 4 | RX8025_TRANSFER_MODE, 2, buf);
 		if (tmp != 2) {
 			pr_debug("read error %d\n", tmp);
 			err = -EIO;
@@ -699,7 +710,7 @@
 		if (!(ds1307->regs[1] & RX8025_BIT_XST)) {
 			ds1307->regs[1] |= RX8025_BIT_XST;
 			i2c_smbus_write_byte_data(client,
-						  RX8025_REG_CTRL2 << 4 | 0x08,
+						  RX8025_REG_CTRL2 << 4,
 						  ds1307->regs[1]);
 			dev_warn(&client->dev,
 				 "oscillator stop detected - SET TIME!\n");
@@ -708,7 +719,7 @@
 		if (ds1307->regs[1] & RX8025_BIT_PON) {
 			ds1307->regs[1] &= ~RX8025_BIT_PON;
 			i2c_smbus_write_byte_data(client,
-						  RX8025_REG_CTRL2 << 4 | 0x08,
+						  RX8025_REG_CTRL2 << 4,
 						  ds1307->regs[1]);
 			dev_warn(&client->dev, "power-on detected\n");
 		}
@@ -716,7 +727,7 @@
 		if (ds1307->regs[1] & RX8025_BIT_VDET) {
 			ds1307->regs[1] &= ~RX8025_BIT_VDET;
 			i2c_smbus_write_byte_data(client,
-						  RX8025_REG_CTRL2 << 4 | 0x08,
+						  RX8025_REG_CTRL2 << 4,
 						  ds1307->regs[1]);
 			dev_warn(&client->dev, "voltage drop detected\n");
 		}
@@ -727,12 +738,12 @@
 
 			/* switch to 24 hour mode */
 			i2c_smbus_write_byte_data(client,
-						  RX8025_REG_CTRL1 << 4 | 0x08,
+						  RX8025_REG_CTRL1 << 4,
 						  ds1307->regs[0] |
 						  RX8025_BIT_2412);
 
-			tmp = i2c_smbus_read_i2c_block_data(ds1307->client,
-					RX8025_REG_CTRL1 << 4 | 0x08, 2, buf);
+			tmp = ds1307->read_block_data(ds1307->client,
+					RX8025_REG_CTRL1 << 4 | RX8025_TRANSFER_MODE, 2, buf);
 			if (tmp != 2) {
 				pr_debug("read error %d\n", tmp);
 				err = -EIO;
@@ -747,7 +758,7 @@
 				hour += 12;
 
 			i2c_smbus_write_byte_data(client,
-						  DS1307_REG_HOUR << 4 | 0x08,
+						  DS1307_REG_HOUR << 4,
 						  hour);
 		}
 		break;
