aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-yocto-tiny-kexecboot-3.10/patches/patches-mtd/collie-PCR.patch
blob: ce7681ae8227787e91760ab503a61330a09acb72 (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
57
58
59
From e5ca5b21330a683329e2912786f6b7cecbc5d5c9 Mon Sep 17 00:00:00 2001
From: Andrea Adami <andrea.adami@gmail.com>
Date: Wed, 11 Dec 2013 00:27:34 +0100
Subject: [PATCH] cfi_probe.c: hack to reset Partition Control Register
 on collie

Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
---
 drivers/mtd/chips/cfi_probe.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/drivers/mtd/chips/cfi_probe.c b/drivers/mtd/chips/cfi_probe.c
index d255352..e2e80db 100644
--- a/drivers/mtd/chips/cfi_probe.c
+++ b/drivers/mtd/chips/cfi_probe.c
@@ -228,6 +228,40 @@ static int __xipram cfi_chip_setup(struct map_info *map,
 	cfi->mfr = cfi_read_query16(map, base);
 	cfi->id = cfi_read_query16(map, base + ofs_factor);
 
+
+
+
+	/* read PCR */
+	unsigned long PCR, SR;
+	PCR = cfi_read_query16(map, base + 6 * ofs_factor);
+	printk ("Partition Configuration Register was:%lx\n", PCR);
+
+	/* Set PCR two-cycle command sequence.
+	 * After executing this command, the device
+	 * returns to read array mode and status registers are cleared
+	 */
+	cfi_send_gen_cmd(0x60, 0x0000, base, map, cfi, cfi->device_type, NULL);
+	cfi_send_gen_cmd(0x04, 0x0000, base, map, cfi, cfi->device_type, NULL);
+
+	/* chech Status Register */
+	cfi_send_gen_cmd(0x70, 0, base, map, cfi, cfi->device_type, NULL);
+	SR = cfi_read_query16(map, base + 6 * ofs_factor);
+
+		/* Check SR.4, 5
+		 * Both 1 = Command Sequence Error
+		 */
+	printk ("Status Register is:%lx\n", SR);
+
+
+	/* read again PCR */
+	cfi_send_gen_cmd(0x90, addr_unlock1, 0, map, cfi, cfi->device_type, NULL);
+	PCR = cfi_read_query16(map, base + 6 * ofs_factor);
+	printk ("Partition Configuration Register is now:%lx\n", PCR);
+
+
+
+
+
 	/* Get AMD/Spansion extended JEDEC ID */
 	if (cfi->mfr == CFI_MFR_AMD && (cfi->id & 0xff) == 0x7e)
 		cfi->id = cfi_read_query(map, base + 0xe * ofs_factor) << 8 |
-- 
1.8.1.5