From 8ca9ed5db3aea8d27989c239e8a2f79b839f1e99 Mon Sep 17 00:00:00 2001 From: Joern Engel Date: Mon, 22 May 2006 23:17:23 +0200 Subject: [MTD] Use single flag to mark writeable devices. Two flags exist to decide whether a device is writeable or not. None of those two flags is checked for independently, so they are clearly redundant, if not an invitation to bugs. This patch removed both of them, replacing them with a single new flag. Signed-off-by: Joern Engel --- include/mtd/mtd-abi.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h index fa252415784..e4d61f33d5b 100644 --- a/include/mtd/mtd-abi.h +++ b/include/mtd/mtd-abi.h @@ -30,17 +30,15 @@ struct mtd_oob_buf { #define MTD_NANDFLASH 4 #define MTD_DATAFLASH 6 -#define MTD_CLEAR_BITS 1 // Bits can be cleared (flash) -#define MTD_SET_BITS 2 // Bits can be set #define MTD_ECC 128 // Device capable of automatic ECC #define MTD_PROGRAM_REGIONS 512 // Configurable Programming Regions +#define MTD_WRITEABLE 0x400 /* Device is writeable */ // Some common devices / combinations of capabilities #define MTD_CAP_ROM 0 -#define MTD_CAP_RAM (MTD_CLEAR_BITS|MTD_SET_BITS) -#define MTD_CAP_NORFLASH (MTD_CLEAR_BITS) -#define MTD_CAP_NANDFLASH (MTD_CLEAR_BITS) -#define MTD_WRITEABLE (MTD_CLEAR_BITS|MTD_SET_BITS) +#define MTD_CAP_RAM (MTD_WRITEABLE) +#define MTD_CAP_NORFLASH (MTD_WRITEABLE) +#define MTD_CAP_NANDFLASH (MTD_WRITEABLE) // Types of automatic ECC/Checksum available -- cgit v1.2.3 From 28318776a80bc3261f9af91ef79e6e38bb9f5bec Mon Sep 17 00:00:00 2001 From: Joern Engel Date: Mon, 22 May 2006 23:18:05 +0200 Subject: [MTD] Introduce writesize At least two flashes exists that have the concept of a minimum write unit, similar to NAND pages, but no other NAND characteristics. Therefore, rename the minimum write unit to "writesize" for all flashes, including NAND. Signed-off-by: Joern Engel --- include/linux/mtd/mtd.h | 7 +++++-- include/mtd/mtd-abi.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 73620ef8336..d48c7492392 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -66,8 +66,12 @@ struct mtd_info { * information below if they desire */ u_int32_t erasesize; + /* Smallest availlable size for writing to the device. For NAND, + * this is the page size, for some NOR chips, the size of ECC + * covered blocks. + */ + u_int32_t writesize; - u_int32_t oobblock; // Size of OOB blocks (e.g. 512) u_int32_t oobsize; // Amount of OOB data per block (e.g. 16) u_int32_t ecctype; u_int32_t eccsize; @@ -79,7 +83,6 @@ struct mtd_info { * MTD_PROGRAM_REGIONS flag is set. * (Maybe we should have an union for those?) */ -#define MTD_PROGREGION_SIZE(mtd) (mtd)->oobblock #define MTD_PROGREGION_CTRLMODE_VALID(mtd) (mtd)->oobsize #define MTD_PROGREGION_CTRLMODE_INVALID(mtd) (mtd)->ecctype diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h index e4d61f33d5b..520a3b48310 100644 --- a/include/mtd/mtd-abi.h +++ b/include/mtd/mtd-abi.h @@ -63,7 +63,7 @@ struct mtd_info_user { uint32_t flags; uint32_t size; // Total size of the MTD uint32_t erasesize; - uint32_t oobblock; // Size of OOB blocks (e.g. 512) + uint32_t writesize; uint32_t oobsize; // Amount of OOB data per block (e.g. 16) uint32_t ecctype; uint32_t eccsize; -- cgit v1.2.3 From 5fa433942ba4e399f7e28764c9db4ade89e91d40 Mon Sep 17 00:00:00 2001 From: Joern Engel Date: Mon, 22 May 2006 23:18:29 +0200 Subject: [MTD] Introduce MTD_BIT_WRITEABLE o Add a flag MTD_BIT_WRITEABLE for devices that allow single bits to be cleared. o Replace MTD_PROGRAM_REGIONS with a cleared MTD_BIT_WRITEABLE flag for STMicro and Intel Sibley flashes with internal ECC. Those flashes disallow clearing of single bits, unlike regular NOR flashes, so the new flag models their behaviour better. o Remove MTD_ECC. After the STMicro/Sibley merge, this flag is only set and never checked. Signed-off-by: Joern Engel --- include/mtd/mtd-abi.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h index 520a3b48310..1e09e4c8f48 100644 --- a/include/mtd/mtd-abi.h +++ b/include/mtd/mtd-abi.h @@ -30,14 +30,13 @@ struct mtd_oob_buf { #define MTD_NANDFLASH 4 #define MTD_DATAFLASH 6 -#define MTD_ECC 128 // Device capable of automatic ECC -#define MTD_PROGRAM_REGIONS 512 // Configurable Programming Regions #define MTD_WRITEABLE 0x400 /* Device is writeable */ +#define MTD_BIT_WRITEABLE 0x800 /* Single bits can be flipped */ // Some common devices / combinations of capabilities #define MTD_CAP_ROM 0 -#define MTD_CAP_RAM (MTD_WRITEABLE) -#define MTD_CAP_NORFLASH (MTD_WRITEABLE) +#define MTD_CAP_RAM (MTD_WRITEABLE | MTD_BIT_WRITEABLE) +#define MTD_CAP_NORFLASH (MTD_WRITEABLE | MTD_BIT_WRITEABLE) #define MTD_CAP_NANDFLASH (MTD_WRITEABLE) -- cgit v1.2.3