aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Adami <andrea.adami@gmail.com>2013-12-31 17:50:16 +0100
committerAndrea Adami <andrea.adami@gmail.com>2013-12-31 18:38:11 +0100
commitc82171b469e4515023908d86482df9baf7c5fc01 (patch)
treee70ef184ea00c560673ad755769d1b64f4074e71
parent8f8102dd91a23849016b0940cfd4da02a34cf237 (diff)
downloadmeta-handheld-c82171b469e4515023908d86482df9baf7c5fc01.tar.gz
linux-yocto*: collie: update Partition Configuration Register patch
The CFI readings of the number of hardware partitions is now fixed and correctly showing 2. Further output is valid only for the default case of 2 asymmetric partitions but the CFI code in kernel does only care about the number of equal partitions. So we set the PCR accordingly but with 2 symmetric partitions of 2 planes each without loosing the advantages of the Dual Work. Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
-rw-r--r--recipes-kernel/linux/linux-yocto-3.10/patches/patches-mtd/collie-PCR.patch90
-rw-r--r--recipes-kernel/linux/linux-yocto-dev/patches/patches-mtd/collie-PCR.patch90
-rw-r--r--recipes-kernel/linux/linux-yocto-tiny-kexecboot-3.10/patches/patches-mtd/collie-PCR.patch90
3 files changed, 153 insertions, 117 deletions
diff --git a/recipes-kernel/linux/linux-yocto-3.10/patches/patches-mtd/collie-PCR.patch b/recipes-kernel/linux/linux-yocto-3.10/patches/patches-mtd/collie-PCR.patch
index ce7681a..38e9d8a 100644
--- a/recipes-kernel/linux/linux-yocto-3.10/patches/patches-mtd/collie-PCR.patch
+++ b/recipes-kernel/linux/linux-yocto-3.10/patches/patches-mtd/collie-PCR.patch
@@ -1,59 +1,71 @@
-From e5ca5b21330a683329e2912786f6b7cecbc5d5c9 Mon Sep 17 00:00:00 2001
+From 26bb41a25e95365adfc34e8c48d7a2e0a3bc6670 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
+Date: Tue, 31 Dec 2013 17:33:20 +0100
+Subject: [PATCH] mtd: cfi_probe.c: add PCR fixup for collie NOR flash
+
+The Partition Configuration Register on collie defaults to
+an asymmetric configuration of 2 partitions, P0 composed by 3 planes
+and P1 by one plane.
+The cfi code requires equal-sized partitions so we have only 3 choices:
+
+1 single partition (no Dual Work)
+2 symmetric partitions
+4 symmetric partitions
+
+Considering that Sharp-Specific Extended Query hardcodes the value of
+2 (really asymmetric but 2) partitions we reset the PCR here to 0x200
+after the first Read Identifier Codes/OTP command (90H).
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
+index d255352..18b03cd 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,
+@@ -228,6 +228,46 @@ 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
++ /* Sharp LH28F640BFHE partitioning fixup
++ * The device at boot has 2 asymmetrical partitions:
++ * HEX = BIN
++ * 400 = 100 2 P0 3 planes, P1 1 plane (boot default)
+ */
-+ 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);
++ if (cfi->mfr == CFI_MFR_SHARP && cfi->id == 0x00b0) {
++ /* read PCR */
++ unsigned long PCR, SR;
++ PCR = cfi_read_query16(map, base + 6 * ofs_factor);
++ //printk ("Partition Configuration Register was:%lx\n", PCR);
+
-+ /* 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);
++ /* Set PCR two-cycle command sequence.
++ * After executing this commands the device returns to
++ * read array mode and status registers are cleared
++ *
++ * HEX BIN NR PARTITIONS
++ * 400 = 100 2 3 planes + 1 plane (boot default)
++ *
++ * 000 = 000 1 1 partition of 4 planes, no Dual Work
++ * 200 = 010 2 2 partitions of 2 planes
++ * 700 = 111 4 4 partitions of 1 plane
++ */
++ cfi_send_gen_cmd(0x60, 0x200, base, map, cfi, cfi->device_type, NULL);
++ cfi_send_gen_cmd(0x04, 0x200, base, map, cfi, cfi->device_type, NULL);
+
-+ /* Check SR.4, 5
++ /* check Status Register */
++ cfi_send_gen_cmd(0x70, 0, base, map, cfi, cfi->device_type, NULL);
++ SR = cfi_read_query16(map, base + 6 * ofs_factor);
++
++ /* Optionally 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);
-+
-+
-+
++ //printk ("Status Register is:%lx\n", SR);
+
++ /* read again PCR */
++ cfi_send_gen_cmd(0x90, addr_unlock1, base, 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
-
diff --git a/recipes-kernel/linux/linux-yocto-dev/patches/patches-mtd/collie-PCR.patch b/recipes-kernel/linux/linux-yocto-dev/patches/patches-mtd/collie-PCR.patch
index ce7681a..38e9d8a 100644
--- a/recipes-kernel/linux/linux-yocto-dev/patches/patches-mtd/collie-PCR.patch
+++ b/recipes-kernel/linux/linux-yocto-dev/patches/patches-mtd/collie-PCR.patch
@@ -1,59 +1,71 @@
-From e5ca5b21330a683329e2912786f6b7cecbc5d5c9 Mon Sep 17 00:00:00 2001
+From 26bb41a25e95365adfc34e8c48d7a2e0a3bc6670 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
+Date: Tue, 31 Dec 2013 17:33:20 +0100
+Subject: [PATCH] mtd: cfi_probe.c: add PCR fixup for collie NOR flash
+
+The Partition Configuration Register on collie defaults to
+an asymmetric configuration of 2 partitions, P0 composed by 3 planes
+and P1 by one plane.
+The cfi code requires equal-sized partitions so we have only 3 choices:
+
+1 single partition (no Dual Work)
+2 symmetric partitions
+4 symmetric partitions
+
+Considering that Sharp-Specific Extended Query hardcodes the value of
+2 (really asymmetric but 2) partitions we reset the PCR here to 0x200
+after the first Read Identifier Codes/OTP command (90H).
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
+index d255352..18b03cd 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,
+@@ -228,6 +228,46 @@ 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
++ /* Sharp LH28F640BFHE partitioning fixup
++ * The device at boot has 2 asymmetrical partitions:
++ * HEX = BIN
++ * 400 = 100 2 P0 3 planes, P1 1 plane (boot default)
+ */
-+ 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);
++ if (cfi->mfr == CFI_MFR_SHARP && cfi->id == 0x00b0) {
++ /* read PCR */
++ unsigned long PCR, SR;
++ PCR = cfi_read_query16(map, base + 6 * ofs_factor);
++ //printk ("Partition Configuration Register was:%lx\n", PCR);
+
-+ /* 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);
++ /* Set PCR two-cycle command sequence.
++ * After executing this commands the device returns to
++ * read array mode and status registers are cleared
++ *
++ * HEX BIN NR PARTITIONS
++ * 400 = 100 2 3 planes + 1 plane (boot default)
++ *
++ * 000 = 000 1 1 partition of 4 planes, no Dual Work
++ * 200 = 010 2 2 partitions of 2 planes
++ * 700 = 111 4 4 partitions of 1 plane
++ */
++ cfi_send_gen_cmd(0x60, 0x200, base, map, cfi, cfi->device_type, NULL);
++ cfi_send_gen_cmd(0x04, 0x200, base, map, cfi, cfi->device_type, NULL);
+
-+ /* Check SR.4, 5
++ /* check Status Register */
++ cfi_send_gen_cmd(0x70, 0, base, map, cfi, cfi->device_type, NULL);
++ SR = cfi_read_query16(map, base + 6 * ofs_factor);
++
++ /* Optionally 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);
-+
-+
-+
++ //printk ("Status Register is:%lx\n", SR);
+
++ /* read again PCR */
++ cfi_send_gen_cmd(0x90, addr_unlock1, base, 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
-
diff --git a/recipes-kernel/linux/linux-yocto-tiny-kexecboot-3.10/patches/patches-mtd/collie-PCR.patch b/recipes-kernel/linux/linux-yocto-tiny-kexecboot-3.10/patches/patches-mtd/collie-PCR.patch
index ce7681a..38e9d8a 100644
--- a/recipes-kernel/linux/linux-yocto-tiny-kexecboot-3.10/patches/patches-mtd/collie-PCR.patch
+++ b/recipes-kernel/linux/linux-yocto-tiny-kexecboot-3.10/patches/patches-mtd/collie-PCR.patch
@@ -1,59 +1,71 @@
-From e5ca5b21330a683329e2912786f6b7cecbc5d5c9 Mon Sep 17 00:00:00 2001
+From 26bb41a25e95365adfc34e8c48d7a2e0a3bc6670 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
+Date: Tue, 31 Dec 2013 17:33:20 +0100
+Subject: [PATCH] mtd: cfi_probe.c: add PCR fixup for collie NOR flash
+
+The Partition Configuration Register on collie defaults to
+an asymmetric configuration of 2 partitions, P0 composed by 3 planes
+and P1 by one plane.
+The cfi code requires equal-sized partitions so we have only 3 choices:
+
+1 single partition (no Dual Work)
+2 symmetric partitions
+4 symmetric partitions
+
+Considering that Sharp-Specific Extended Query hardcodes the value of
+2 (really asymmetric but 2) partitions we reset the PCR here to 0x200
+after the first Read Identifier Codes/OTP command (90H).
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
+index d255352..18b03cd 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,
+@@ -228,6 +228,46 @@ 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
++ /* Sharp LH28F640BFHE partitioning fixup
++ * The device at boot has 2 asymmetrical partitions:
++ * HEX = BIN
++ * 400 = 100 2 P0 3 planes, P1 1 plane (boot default)
+ */
-+ 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);
++ if (cfi->mfr == CFI_MFR_SHARP && cfi->id == 0x00b0) {
++ /* read PCR */
++ unsigned long PCR, SR;
++ PCR = cfi_read_query16(map, base + 6 * ofs_factor);
++ //printk ("Partition Configuration Register was:%lx\n", PCR);
+
-+ /* 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);
++ /* Set PCR two-cycle command sequence.
++ * After executing this commands the device returns to
++ * read array mode and status registers are cleared
++ *
++ * HEX BIN NR PARTITIONS
++ * 400 = 100 2 3 planes + 1 plane (boot default)
++ *
++ * 000 = 000 1 1 partition of 4 planes, no Dual Work
++ * 200 = 010 2 2 partitions of 2 planes
++ * 700 = 111 4 4 partitions of 1 plane
++ */
++ cfi_send_gen_cmd(0x60, 0x200, base, map, cfi, cfi->device_type, NULL);
++ cfi_send_gen_cmd(0x04, 0x200, base, map, cfi, cfi->device_type, NULL);
+
-+ /* Check SR.4, 5
++ /* check Status Register */
++ cfi_send_gen_cmd(0x70, 0, base, map, cfi, cfi->device_type, NULL);
++ SR = cfi_read_query16(map, base + 6 * ofs_factor);
++
++ /* Optionally 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);
-+
-+
-+
++ //printk ("Status Register is:%lx\n", SR);
+
++ /* read again PCR */
++ cfi_send_gen_cmd(0x90, addr_unlock1, base, 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
-