summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-11-06 15:43:13 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2008-11-06 15:43:13 -0800
commitc36194871293100bd4b2ecb54ac9774d6e627aa2 (patch)
tree9fd6894103918f439d0e7ec35620e18018ccfa76 /include
parentc3302931db090d87e9015c3a7ce5c97a7dd90f78 (diff)
parentdc8a0843a435b2c0891e7eaea64faaf1ebec9b11 (diff)
downloadop-kernel-dev-c36194871293100bd4b2ecb54ac9774d6e627aa2.zip
op-kernel-dev-c36194871293100bd4b2ecb54ac9774d6e627aa2.tar.gz
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: [JFFS2] fix race condition in jffs2_lzo_compress() [MTD] [NOR] Fix cfi_send_gen_cmd handling of x16 devices in x8 mode (v4) [JFFS2] Fix lack of locking in thread_should_wake() [JFFS2] Fix build failure with !CONFIG_JFFS2_FS_WRITEBUFFER [MTD] [NAND] OMAP2: remove duplicated #include
Diffstat (limited to 'include')
-rw-r--r--include/linux/mtd/cfi.h22
1 files changed, 19 insertions, 3 deletions
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h
index ee5124ec..00e2b57 100644
--- a/include/linux/mtd/cfi.h
+++ b/include/linux/mtd/cfi.h
@@ -282,9 +282,25 @@ struct cfi_private {
/*
* Returns the command address according to the given geometry.
*/
-static inline uint32_t cfi_build_cmd_addr(uint32_t cmd_ofs, int interleave, int type)
+static inline uint32_t cfi_build_cmd_addr(uint32_t cmd_ofs,
+ struct map_info *map, struct cfi_private *cfi)
{
- return (cmd_ofs * type) * interleave;
+ unsigned bankwidth = map_bankwidth(map);
+ unsigned interleave = cfi_interleave(cfi);
+ unsigned type = cfi->device_type;
+ uint32_t addr;
+
+ addr = (cmd_ofs * type) * interleave;
+
+ /* Modify the unlock address if we are in compatiblity mode.
+ * For 16bit devices on 8 bit busses
+ * and 32bit devices on 16 bit busses
+ * set the low bit of the alternating bit sequence of the address.
+ */
+ if (((type * interleave) > bankwidth) && ((uint8_t)cmd_ofs == 0xaa))
+ addr |= (type >> 1)*interleave;
+
+ return addr;
}
/*
@@ -430,7 +446,7 @@ static inline uint32_t cfi_send_gen_cmd(u_char cmd, uint32_t cmd_addr, uint32_t
int type, map_word *prev_val)
{
map_word val;
- uint32_t addr = base + cfi_build_cmd_addr(cmd_addr, cfi_interleave(cfi), type);
+ uint32_t addr = base + cfi_build_cmd_addr(cmd_addr, map, cfi);
val = cfi_build_cmd(cmd, map, cfi);
if (prev_val)
OpenPOWER on IntegriCloud