aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHuang Shijie <b32955@freescale.com>2013-05-16 23:17:27 -0400
committerNitin Garg <nitin.garg@freescale.com>2014-04-16 09:06:05 -0400
commit7e3f3a42b1b9d4585592d325d1cfe52a92f9ae19 (patch)
tree06fd013d744b17c15a3f005067324e501bb81f51
parentf8b6cd50aae1bd7baf84827c87588f9580acd4d0 (diff)
mtd: add data structures for Extended Parameter Page
Since the ONFI 2.1, the onfi spec adds the Extended Parameter Page to store the ECC info. The onfi spec tells us that if the nand chip's recommended ECC codeword size is not 512 bytes, then the @ecc_bits is 0xff. The host _SHOULD_ then read the Extended ECC information that is part of the extended parameter page to retrieve the ECC requirements for this device. This patch adds [1] the neccessary fields for nand_onfi_params{}, [2] and adds the onfi_ext_ecc_info{} for Extended ECC information, [3] adds onfi_ext_section{} for extended sections, [4] and adds onfi_ext_param_page{} for the Extended Parameter Page. Acked-by: Pekon Gupta <pekon@ti.com> Signed-off-by: Huang Shijie <b32955@freescale.com> Reviewed-and-tested-by: Brian Norris <computersforpeace@gmail.com> [Brian: amended for checkpatch.pl] Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r--include/linux/mtd/nand.h39
1 files changed, 38 insertions, 1 deletions
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 8646589b3fe8..9e6c8f9f306e 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -232,7 +232,10 @@ struct nand_onfi_params {
232 __le16 revision; 232 __le16 revision;
233 __le16 features; 233 __le16 features;
234 __le16 opt_cmd; 234 __le16 opt_cmd;
235 u8 reserved[22]; 235 u8 reserved0[2];
236 __le16 ext_param_page_length; /* since ONFI 2.1 */
237 u8 num_of_param_pages; /* since ONFI 2.1 */
238 u8 reserved1[17];
236 239
237 /* manufacturer information block */ 240 /* manufacturer information block */
238 char manufacturer[12]; 241 char manufacturer[12];
@@ -289,6 +292,40 @@ struct nand_onfi_params {
289 292
290#define ONFI_CRC_BASE 0x4F4E 293#define ONFI_CRC_BASE 0x4F4E
291 294
295/* Extended ECC information Block Definition (since ONFI 2.1) */
296struct onfi_ext_ecc_info {
297 u8 ecc_bits;
298 u8 codeword_size;
299 __le16 bb_per_lun;
300 __le16 block_endurance;
301 u8 reserved[2];
302} __packed;
303
304#define ONFI_SECTION_TYPE_0 0 /* Unused section. */
305#define ONFI_SECTION_TYPE_1 1 /* for additional sections. */
306#define ONFI_SECTION_TYPE_2 2 /* for ECC information. */
307struct onfi_ext_section {
308 u8 type;
309 u8 length;
310} __packed;
311
312#define ONFI_EXT_SECTION_MAX 8
313
314/* Extended Parameter Page Definition (since ONFI 2.1) */
315struct onfi_ext_param_page {
316 __le16 crc;
317 u8 sig[4]; /* 'E' 'P' 'P' 'S' */
318 u8 reserved0[10];
319 struct onfi_ext_section sections[ONFI_EXT_SECTION_MAX];
320
321 /*
322 * The actual size of the Extended Parameter Page is in
323 * @ext_param_page_length of nand_onfi_params{}.
324 * The following are the variable length sections.
325 * So we do not add any fields below. Please see the ONFI spec.
326 */
327} __packed;
328
292/** 329/**
293 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices 330 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices
294 * @lock: protection lock 331 * @lock: protection lock