aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Adami <andrea.adami@gmail.com>2013-12-30 19:20:57 +0100
committerAndrea Adami <andrea.adami@gmail.com>2013-12-31 18:38:03 +0100
commit79421ad3059d5ed9173a5d73e394513b2d5ac644 (patch)
tree165aabc65c3d800fe1223ed31c4ad5000daa063f
parent96a35cfddb247a55adf15af12f1ca396073eb338 (diff)
downloadmeta-handheld-79421ad3059d5ed9173a5d73e394513b2d5ac644.tar.gz
linux-yocto*: collie: apply workaround for CFI NOR misdetection
It is still unclear whether collie is a special case or the setup of 2x16bit chips on 32bit bus needs some bugfix. Apparently the issue is only with the answer of READ QUERY (0x98): the logs show that both chips are answering in all other cases. Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
-rw-r--r--recipes-kernel/linux/linux-yocto-3.10/collie/collie.scc1
-rw-r--r--recipes-kernel/linux/linux-yocto-3.10/patches/patches-mtd/collie-match-cfi-qry.patch29
-rw-r--r--recipes-kernel/linux/linux-yocto-dev/collie/collie.scc1
-rw-r--r--recipes-kernel/linux/linux-yocto-dev/patches/patches-mtd/collie-match-cfi-qry.patch29
-rw-r--r--recipes-kernel/linux/linux-yocto-tiny-kexecboot-3.10/patches/patches-mtd/collie-match-cfi-qry.patch29
-rw-r--r--recipes-kernel/linux/linux-yocto-tiny-kexecboot_3.10.bbappend1
6 files changed, 90 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-yocto-3.10/collie/collie.scc b/recipes-kernel/linux/linux-yocto-3.10/collie/collie.scc
index cd28890..e81d887 100644
--- a/recipes-kernel/linux/linux-yocto-3.10/collie/collie.scc
+++ b/recipes-kernel/linux/linux-yocto-3.10/collie/collie.scc
@@ -13,6 +13,7 @@ patch ../patches/patches-mtd/collie-cfi-probe-again.patch
patch ../patches/patches-mtd/collie-mtd-resize.patch
patch ../patches/patches-mtd/collie-force-unlock.patch
patch ../patches/patches-mtd/collie-PCR.patch
+patch ../patches/patches-mtd/collie-match-cfi-qry.patch
patch ../patches/patches-mtd/collie-no-buf-write.patch
patch ../patches/patches-sa1100/collie-irda.patch
patch ../patches/patches-sa1100/collie-add-bootblock.patch
diff --git a/recipes-kernel/linux/linux-yocto-3.10/patches/patches-mtd/collie-match-cfi-qry.patch b/recipes-kernel/linux/linux-yocto-3.10/patches/patches-mtd/collie-match-cfi-qry.patch
new file mode 100644
index 0000000..1333f94
--- /dev/null
+++ b/recipes-kernel/linux/linux-yocto-3.10/patches/patches-mtd/collie-match-cfi-qry.patch
@@ -0,0 +1,29 @@
+diff --git a/drivers/mtd/chips/cfi_util.c b/drivers/mtd/chips/cfi_util.c
+index f992418..7139d028 100644
+--- a/drivers/mtd/chips/cfi_util.c
++++ b/drivers/mtd/chips/cfi_util.c
+@@ -38,6 +38,24 @@ int __xipram cfi_qry_present(struct map_info *map, __u32 base,
+ val[1] = map_read(map, base + osf*0x11);
+ val[2] = map_read(map, base + osf*0x12);
+
++ /* Apparently only one of the 2 interleaved LH28F640BFHE 16 bit chips on
++ * a 32 bit wide bus is answering to the CFI Query.
++ * Using the expected map bankwidth=4 and chip interleave=2 we get wrong
++ * readings like 0xffff0051 instead of 0x00510051 etc.
++ * We take the valid bytes and recreate the expected answer as workaround.
++ */
++ unsigned long mask;
++ mask = (1 << (cfi->device_type * 8)) - 1;
++
++ if (((val[0].x[0] >> (cfi->device_type * 8)) == mask) &&
++ ((val[1].x[0] >> (cfi->device_type * 8)) == mask) &&
++ ((val[2].x[0] >> (cfi->device_type * 8)) == mask))
++ {
++ val[0].x[0] = (val[0].x[0] & mask) + ((val[0].x[0] & mask) << (cfi->device_type * 8));
++ val[1].x[0] = (val[1].x[0] & mask) + ((val[1].x[0] & mask) << (cfi->device_type * 8));
++ val[2].x[0] = (val[2].x[0] & mask) + ((val[2].x[0] & mask) << (cfi->device_type * 8));
++ }
++
+ if (!map_word_equal(map, qry[0], val[0]))
+ return 0;
+
diff --git a/recipes-kernel/linux/linux-yocto-dev/collie/collie.scc b/recipes-kernel/linux/linux-yocto-dev/collie/collie.scc
index afdc808..f7b5f11 100644
--- a/recipes-kernel/linux/linux-yocto-dev/collie/collie.scc
+++ b/recipes-kernel/linux/linux-yocto-dev/collie/collie.scc
@@ -7,6 +7,7 @@ patch ../patches/patches-mtd/collie-cfi-probe-again.patch
patch ../patches/patches-mtd/collie-mtd-resize.patch
patch ../patches/patches-mtd/collie-force-unlock.patch
patch ../patches/patches-mtd/collie-PCR.patch
+patch ../patches/patches-mtd/collie-match-cfi-qry.patch
patch ../patches/patches-mtd/collie-no-buf-write.patch
patch ../patches/patches-sa1100/collie-irda.patch
patch ../patches/patches-sa1100/collie-add-bootblock.patch
diff --git a/recipes-kernel/linux/linux-yocto-dev/patches/patches-mtd/collie-match-cfi-qry.patch b/recipes-kernel/linux/linux-yocto-dev/patches/patches-mtd/collie-match-cfi-qry.patch
new file mode 100644
index 0000000..1333f94
--- /dev/null
+++ b/recipes-kernel/linux/linux-yocto-dev/patches/patches-mtd/collie-match-cfi-qry.patch
@@ -0,0 +1,29 @@
+diff --git a/drivers/mtd/chips/cfi_util.c b/drivers/mtd/chips/cfi_util.c
+index f992418..7139d028 100644
+--- a/drivers/mtd/chips/cfi_util.c
++++ b/drivers/mtd/chips/cfi_util.c
+@@ -38,6 +38,24 @@ int __xipram cfi_qry_present(struct map_info *map, __u32 base,
+ val[1] = map_read(map, base + osf*0x11);
+ val[2] = map_read(map, base + osf*0x12);
+
++ /* Apparently only one of the 2 interleaved LH28F640BFHE 16 bit chips on
++ * a 32 bit wide bus is answering to the CFI Query.
++ * Using the expected map bankwidth=4 and chip interleave=2 we get wrong
++ * readings like 0xffff0051 instead of 0x00510051 etc.
++ * We take the valid bytes and recreate the expected answer as workaround.
++ */
++ unsigned long mask;
++ mask = (1 << (cfi->device_type * 8)) - 1;
++
++ if (((val[0].x[0] >> (cfi->device_type * 8)) == mask) &&
++ ((val[1].x[0] >> (cfi->device_type * 8)) == mask) &&
++ ((val[2].x[0] >> (cfi->device_type * 8)) == mask))
++ {
++ val[0].x[0] = (val[0].x[0] & mask) + ((val[0].x[0] & mask) << (cfi->device_type * 8));
++ val[1].x[0] = (val[1].x[0] & mask) + ((val[1].x[0] & mask) << (cfi->device_type * 8));
++ val[2].x[0] = (val[2].x[0] & mask) + ((val[2].x[0] & mask) << (cfi->device_type * 8));
++ }
++
+ if (!map_word_equal(map, qry[0], val[0]))
+ return 0;
+
diff --git a/recipes-kernel/linux/linux-yocto-tiny-kexecboot-3.10/patches/patches-mtd/collie-match-cfi-qry.patch b/recipes-kernel/linux/linux-yocto-tiny-kexecboot-3.10/patches/patches-mtd/collie-match-cfi-qry.patch
new file mode 100644
index 0000000..1333f94
--- /dev/null
+++ b/recipes-kernel/linux/linux-yocto-tiny-kexecboot-3.10/patches/patches-mtd/collie-match-cfi-qry.patch
@@ -0,0 +1,29 @@
+diff --git a/drivers/mtd/chips/cfi_util.c b/drivers/mtd/chips/cfi_util.c
+index f992418..7139d028 100644
+--- a/drivers/mtd/chips/cfi_util.c
++++ b/drivers/mtd/chips/cfi_util.c
+@@ -38,6 +38,24 @@ int __xipram cfi_qry_present(struct map_info *map, __u32 base,
+ val[1] = map_read(map, base + osf*0x11);
+ val[2] = map_read(map, base + osf*0x12);
+
++ /* Apparently only one of the 2 interleaved LH28F640BFHE 16 bit chips on
++ * a 32 bit wide bus is answering to the CFI Query.
++ * Using the expected map bankwidth=4 and chip interleave=2 we get wrong
++ * readings like 0xffff0051 instead of 0x00510051 etc.
++ * We take the valid bytes and recreate the expected answer as workaround.
++ */
++ unsigned long mask;
++ mask = (1 << (cfi->device_type * 8)) - 1;
++
++ if (((val[0].x[0] >> (cfi->device_type * 8)) == mask) &&
++ ((val[1].x[0] >> (cfi->device_type * 8)) == mask) &&
++ ((val[2].x[0] >> (cfi->device_type * 8)) == mask))
++ {
++ val[0].x[0] = (val[0].x[0] & mask) + ((val[0].x[0] & mask) << (cfi->device_type * 8));
++ val[1].x[0] = (val[1].x[0] & mask) + ((val[1].x[0] & mask) << (cfi->device_type * 8));
++ val[2].x[0] = (val[2].x[0] & mask) + ((val[2].x[0] & mask) << (cfi->device_type * 8));
++ }
++
+ if (!map_word_equal(map, qry[0], val[0]))
+ return 0;
+
diff --git a/recipes-kernel/linux/linux-yocto-tiny-kexecboot_3.10.bbappend b/recipes-kernel/linux/linux-yocto-tiny-kexecboot_3.10.bbappend
index b729841..1706ccf 100644
--- a/recipes-kernel/linux/linux-yocto-tiny-kexecboot_3.10.bbappend
+++ b/recipes-kernel/linux/linux-yocto-tiny-kexecboot_3.10.bbappend
@@ -46,6 +46,7 @@ SRC_URI_append_collie = " \
file://patches/patches-mtd/collie-mtd-resize.patch \
file://patches/patches-mtd/collie-force-unlock.patch \
file://patches/patches-mtd/collie-PCR.patch \
+ file://patches/patches-mtd/collie-match-cfi-qry.patch \
file://patches/patches-mtd/collie-no-buf-write.patch \
file://patches/patches-sa1100/collie-irda.patch \
file://patches/patches-sa1100/collie-add-bootblock.patch \