summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-2.6.32/mtcdp-embedded/linux-2.6.32.3-at25.patch
blob: 3aa9096b2b7f2f7a453c03bbfe48a115f144cc4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
diff -uprN -X linux-2.6.32.3/Documentation/dontdiff linux-2.6.32.3-vanilla/drivers/misc/eeprom/at25.c linux-2.6.32.3/drivers/misc/eeprom/at25.c
--- linux-2.6.32.3-vanilla/drivers/misc/eeprom/at25.c	2010-01-06 17:07:45.000000000 -0600
+++ linux-2.6.32.3/drivers/misc/eeprom/at25.c	2010-10-27 11:05:36.000000000 -0500
@@ -147,6 +147,7 @@ at25_ee_write(struct at25_data *at25, co
 	unsigned		written = 0;
 	unsigned		buf_size;
 	u8			*bounce;
+	int			a8;
 
 	if (unlikely(off >= at25->bin.size))
 		return -EFBIG;
@@ -163,6 +164,11 @@ at25_ee_write(struct at25_data *at25, co
 	if (!bounce)
 		return -ENOMEM;
 
+	if (!strcmp(at25->chip.name, "at25040b"))
+		a8 = 1;
+	else
+		a8 = 0;
+
 	/* For write, rollover is within the page ... so we write at
 	 * most one page, then manually roll over to the next page.
 	 */
@@ -183,6 +189,13 @@ at25_ee_write(struct at25_data *at25, co
 			break;
 		}
 
+		if (a8) {
+			if (offset & BIT(8))
+				bounce[0] |= BIT(3);
+			else
+				bounce[0] &= ~BIT(3);
+		}
+
 		/* 8/16/24-bit address is written MSB first */
 		switch (at25->addrlen) {
 		default:	/* case 3 */