summaryrefslogtreecommitdiff
path: root/target/linux/amazon/patches-2.6.37/160-cfi-swap.patch
blob: 65ce6616d36bcde1303c7016cd386c940bc00d31 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -1166,6 +1166,9 @@ static int __xipram do_write_oneword(str
 	int retry_cnt = 0;
 
 	adr += chip->start;
+#ifdef CONFIG_AMAZON
+	adr ^= 2;
+#endif
 
 	mutex_lock(&chip->mutex);
 	ret = get_chip(map, chip, adr, FL_WRITING);
@@ -1433,7 +1436,11 @@ static int __xipram do_write_buffer(stru
 	z = 0;
 	while(z < words * map_bankwidth(map)) {
 		datum = map_word_load(map, buf);
+#ifdef CONFIG_AMAZON
+		map_write(map, datum, (adr + z) ^ 0x2);
+#else
 		map_write(map, datum, adr + z);
+#endif
 
 		z += map_bankwidth(map);
 		buf += map_bankwidth(map);
@@ -1678,6 +1685,9 @@ static int __xipram do_erase_oneblock(st
 	int ret = 0;
 
 	adr += chip->start;
+#ifdef CONFIG_AMAZON
+	adr ^= 2;
+#endif
 
 	mutex_lock(&chip->mutex);
 	ret = get_chip(map, chip, adr, FL_ERASING);
@@ -1806,6 +1816,10 @@ static int do_atmel_lock(struct map_info
 	struct cfi_private *cfi = map->fldrv_priv;
 	int ret;
 
+#ifdef CONFIG_AMAZON
+	adr ^= 2;
+#endif
+
 	mutex_lock(&chip->mutex);
 	ret = get_chip(map, chip, adr + chip->start, FL_LOCKING);
 	if (ret)
@@ -1842,6 +1856,10 @@ static int do_atmel_unlock(struct map_in
 	struct cfi_private *cfi = map->fldrv_priv;
 	int ret;
 
+#ifdef CONFIG_AMAZON
+	adr ^= 2;
+#endif
+
 	mutex_lock(&chip->mutex);
 	ret = get_chip(map, chip, adr + chip->start, FL_UNLOCKING);
 	if (ret)