diff options
Diffstat (limited to 'include/linux/mtd')
-rw-r--r-- | include/linux/mtd/blktrans.h | 3 | ||||
-rw-r--r-- | include/linux/mtd/cfi.h | 6 | ||||
-rw-r--r-- | include/linux/mtd/fsmc.h | 26 | ||||
-rw-r--r-- | include/linux/mtd/latch-addr-flash.h | 29 | ||||
-rw-r--r-- | include/linux/mtd/mtd.h | 11 | ||||
-rw-r--r-- | include/linux/mtd/nand.h | 11 | ||||
-rw-r--r-- | include/linux/mtd/nand_bch.h | 72 | ||||
-rw-r--r-- | include/linux/mtd/onenand.h | 15 | ||||
-rw-r--r-- | include/linux/mtd/onenand_regs.h | 1 | ||||
-rw-r--r-- | include/linux/mtd/partitions.h | 2 | ||||
-rw-r--r-- | include/linux/mtd/ubi.h | 22 | ||||
-rw-r--r-- | include/linux/mtd/xip.h | 2 |
12 files changed, 170 insertions, 30 deletions
diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h index 26529ebd59cc..1bbd9f289245 100644 --- a/include/linux/mtd/blktrans.h +++ b/include/linux/mtd/blktrans.h | |||
@@ -36,6 +36,7 @@ struct mtd_blktrans_dev { | |||
36 | struct mtd_info *mtd; | 36 | struct mtd_info *mtd; |
37 | struct mutex lock; | 37 | struct mutex lock; |
38 | int devnum; | 38 | int devnum; |
39 | bool bg_stop; | ||
39 | unsigned long size; | 40 | unsigned long size; |
40 | int readonly; | 41 | int readonly; |
41 | int open; | 42 | int open; |
@@ -62,6 +63,7 @@ struct mtd_blktrans_ops { | |||
62 | unsigned long block, char *buffer); | 63 | unsigned long block, char *buffer); |
63 | int (*discard)(struct mtd_blktrans_dev *dev, | 64 | int (*discard)(struct mtd_blktrans_dev *dev, |
64 | unsigned long block, unsigned nr_blocks); | 65 | unsigned long block, unsigned nr_blocks); |
66 | void (*background)(struct mtd_blktrans_dev *dev); | ||
65 | 67 | ||
66 | /* Block layer ioctls */ | 68 | /* Block layer ioctls */ |
67 | int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo); | 69 | int (*getgeo)(struct mtd_blktrans_dev *dev, struct hd_geometry *geo); |
@@ -85,6 +87,7 @@ extern int register_mtd_blktrans(struct mtd_blktrans_ops *tr); | |||
85 | extern int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr); | 87 | extern int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr); |
86 | extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev *dev); | 88 | extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev *dev); |
87 | extern int del_mtd_blktrans_dev(struct mtd_blktrans_dev *dev); | 89 | extern int del_mtd_blktrans_dev(struct mtd_blktrans_dev *dev); |
90 | extern int mtd_blktrans_cease_background(struct mtd_blktrans_dev *dev); | ||
88 | 91 | ||
89 | 92 | ||
90 | #endif /* __MTD_TRANS_H__ */ | 93 | #endif /* __MTD_TRANS_H__ */ |
diff --git a/include/linux/mtd/cfi.h b/include/linux/mtd/cfi.h index 4dd0c2cd7659..d24925492972 100644 --- a/include/linux/mtd/cfi.h +++ b/include/linux/mtd/cfi.h | |||
@@ -308,7 +308,7 @@ static inline uint32_t cfi_build_cmd_addr(uint32_t cmd_ofs, | |||
308 | 308 | ||
309 | addr = (cmd_ofs * type) * interleave; | 309 | addr = (cmd_ofs * type) * interleave; |
310 | 310 | ||
311 | /* Modify the unlock address if we are in compatiblity mode. | 311 | /* Modify the unlock address if we are in compatibility mode. |
312 | * For 16bit devices on 8 bit busses | 312 | * For 16bit devices on 8 bit busses |
313 | * and 32bit devices on 16 bit busses | 313 | * and 32bit devices on 16 bit busses |
314 | * set the low bit of the alternating bit sequence of the address. | 314 | * set the low bit of the alternating bit sequence of the address. |
@@ -527,8 +527,7 @@ struct cfi_extquery *cfi_read_pri(struct map_info *map, uint16_t adr, uint16_t s | |||
527 | struct cfi_fixup { | 527 | struct cfi_fixup { |
528 | uint16_t mfr; | 528 | uint16_t mfr; |
529 | uint16_t id; | 529 | uint16_t id; |
530 | void (*fixup)(struct mtd_info *mtd, void* param); | 530 | void (*fixup)(struct mtd_info *mtd); |
531 | void* param; | ||
532 | }; | 531 | }; |
533 | 532 | ||
534 | #define CFI_MFR_ANY 0xFFFF | 533 | #define CFI_MFR_ANY 0xFFFF |
@@ -536,6 +535,7 @@ struct cfi_fixup { | |||
536 | #define CFI_MFR_CONTINUATION 0x007F | 535 | #define CFI_MFR_CONTINUATION 0x007F |
537 | 536 | ||
538 | #define CFI_MFR_AMD 0x0001 | 537 | #define CFI_MFR_AMD 0x0001 |
538 | #define CFI_MFR_AMIC 0x0037 | ||
539 | #define CFI_MFR_ATMEL 0x001F | 539 | #define CFI_MFR_ATMEL 0x001F |
540 | #define CFI_MFR_EON 0x001C | 540 | #define CFI_MFR_EON 0x001C |
541 | #define CFI_MFR_FUJITSU 0x0004 | 541 | #define CFI_MFR_FUJITSU 0x0004 |
diff --git a/include/linux/mtd/fsmc.h b/include/linux/mtd/fsmc.h index 5d2556700ec2..6987995ad3cf 100644 --- a/include/linux/mtd/fsmc.h +++ b/include/linux/mtd/fsmc.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #ifndef __MTD_FSMC_H | 16 | #ifndef __MTD_FSMC_H |
17 | #define __MTD_FSMC_H | 17 | #define __MTD_FSMC_H |
18 | 18 | ||
19 | #include <linux/io.h> | ||
19 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
20 | #include <linux/mtd/physmap.h> | 21 | #include <linux/mtd/physmap.h> |
21 | #include <linux/types.h> | 22 | #include <linux/types.h> |
@@ -27,7 +28,7 @@ | |||
27 | 28 | ||
28 | /* | 29 | /* |
29 | * The placement of the Command Latch Enable (CLE) and | 30 | * The placement of the Command Latch Enable (CLE) and |
30 | * Address Latch Enable (ALE) is twised around in the | 31 | * Address Latch Enable (ALE) is twisted around in the |
31 | * SPEAR310 implementation. | 32 | * SPEAR310 implementation. |
32 | */ | 33 | */ |
33 | #if defined(CONFIG_MACH_SPEAR310) | 34 | #if defined(CONFIG_MACH_SPEAR310) |
@@ -62,7 +63,7 @@ struct fsmc_nor_bank_regs { | |||
62 | 63 | ||
63 | /* ctrl_tim register definitions */ | 64 | /* ctrl_tim register definitions */ |
64 | 65 | ||
65 | struct fsms_nand_bank_regs { | 66 | struct fsmc_nand_bank_regs { |
66 | uint32_t pc; | 67 | uint32_t pc; |
67 | uint32_t sts; | 68 | uint32_t sts; |
68 | uint32_t comm; | 69 | uint32_t comm; |
@@ -78,7 +79,7 @@ struct fsms_nand_bank_regs { | |||
78 | struct fsmc_regs { | 79 | struct fsmc_regs { |
79 | struct fsmc_nor_bank_regs nor_bank_regs[FSMC_MAX_NOR_BANKS]; | 80 | struct fsmc_nor_bank_regs nor_bank_regs[FSMC_MAX_NOR_BANKS]; |
80 | uint8_t reserved_1[0x40 - 0x20]; | 81 | uint8_t reserved_1[0x40 - 0x20]; |
81 | struct fsms_nand_bank_regs bank_regs[FSMC_MAX_NAND_BANKS]; | 82 | struct fsmc_nand_bank_regs bank_regs[FSMC_MAX_NAND_BANKS]; |
82 | uint8_t reserved_2[0xfe0 - 0xc0]; | 83 | uint8_t reserved_2[0xfe0 - 0xc0]; |
83 | uint32_t peripid0; /* 0xfe0 */ | 84 | uint32_t peripid0; /* 0xfe0 */ |
84 | uint32_t peripid1; /* 0xfe4 */ | 85 | uint32_t peripid1; /* 0xfe4 */ |
@@ -114,25 +115,6 @@ struct fsmc_regs { | |||
114 | #define FSMC_THOLD_4 (4 << 16) | 115 | #define FSMC_THOLD_4 (4 << 16) |
115 | #define FSMC_THIZ_1 (1 << 24) | 116 | #define FSMC_THIZ_1 (1 << 24) |
116 | 117 | ||
117 | /* peripid2 register definitions */ | ||
118 | #define FSMC_REVISION_MSK (0xf) | ||
119 | #define FSMC_REVISION_SHFT (0x4) | ||
120 | |||
121 | #define FSMC_VER1 1 | ||
122 | #define FSMC_VER2 2 | ||
123 | #define FSMC_VER3 3 | ||
124 | #define FSMC_VER4 4 | ||
125 | #define FSMC_VER5 5 | ||
126 | #define FSMC_VER6 6 | ||
127 | #define FSMC_VER7 7 | ||
128 | #define FSMC_VER8 8 | ||
129 | |||
130 | static inline uint32_t get_fsmc_version(struct fsmc_regs *regs) | ||
131 | { | ||
132 | return (readl(®s->peripid2) >> FSMC_REVISION_SHFT) & | ||
133 | FSMC_REVISION_MSK; | ||
134 | } | ||
135 | |||
136 | /* | 118 | /* |
137 | * There are 13 bytes of ecc for every 512 byte block in FSMC version 8 | 119 | * There are 13 bytes of ecc for every 512 byte block in FSMC version 8 |
138 | * and it has to be read consecutively and immediately after the 512 | 120 | * and it has to be read consecutively and immediately after the 512 |
diff --git a/include/linux/mtd/latch-addr-flash.h b/include/linux/mtd/latch-addr-flash.h new file mode 100644 index 000000000000..e94b8e128074 --- /dev/null +++ b/include/linux/mtd/latch-addr-flash.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * Interface for NOR flash driver whose high address lines are latched | ||
3 | * | ||
4 | * Copyright © 2008 MontaVista Software, Inc. <source@mvista.com> | ||
5 | * | ||
6 | * This file is licensed under the terms of the GNU General Public License | ||
7 | * version 2. This program is licensed "as is" without any warranty of any | ||
8 | * kind, whether express or implied. | ||
9 | */ | ||
10 | #ifndef __LATCH_ADDR_FLASH__ | ||
11 | #define __LATCH_ADDR_FLASH__ | ||
12 | |||
13 | struct map_info; | ||
14 | struct mtd_partition; | ||
15 | |||
16 | struct latch_addr_flash_data { | ||
17 | unsigned int width; | ||
18 | unsigned int size; | ||
19 | |||
20 | int (*init)(void *data, int cs); | ||
21 | void (*done)(void *data); | ||
22 | void (*set_window)(unsigned long offset, void *data); | ||
23 | void *data; | ||
24 | |||
25 | unsigned int nr_parts; | ||
26 | struct mtd_partition *parts; | ||
27 | }; | ||
28 | |||
29 | #endif | ||
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index fe8d77ebec13..9d5306bad117 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
@@ -144,6 +144,17 @@ struct mtd_info { | |||
144 | */ | 144 | */ |
145 | uint32_t writesize; | 145 | uint32_t writesize; |
146 | 146 | ||
147 | /* | ||
148 | * Size of the write buffer used by the MTD. MTD devices having a write | ||
149 | * buffer can write multiple writesize chunks at a time. E.g. while | ||
150 | * writing 4 * writesize bytes to a device with 2 * writesize bytes | ||
151 | * buffer the MTD driver can (but doesn't have to) do 2 writesize | ||
152 | * operations, but not 4. Currently, all NANDs have writebufsize | ||
153 | * equivalent to writesize (NAND page size). Some NOR flashes do have | ||
154 | * writebufsize greater than writesize. | ||
155 | */ | ||
156 | uint32_t writebufsize; | ||
157 | |||
147 | uint32_t oobsize; // Amount of OOB data per block (e.g. 16) | 158 | uint32_t oobsize; // Amount of OOB data per block (e.g. 16) |
148 | uint32_t oobavail; // Available OOB bytes per block | 159 | uint32_t oobavail; // Available OOB bytes per block |
149 | 160 | ||
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 63e17d01fde9..d44192740f6f 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -140,6 +140,7 @@ typedef enum { | |||
140 | NAND_ECC_HW, | 140 | NAND_ECC_HW, |
141 | NAND_ECC_HW_SYNDROME, | 141 | NAND_ECC_HW_SYNDROME, |
142 | NAND_ECC_HW_OOB_FIRST, | 142 | NAND_ECC_HW_OOB_FIRST, |
143 | NAND_ECC_SOFT_BCH, | ||
143 | } nand_ecc_modes_t; | 144 | } nand_ecc_modes_t; |
144 | 145 | ||
145 | /* | 146 | /* |
@@ -339,6 +340,7 @@ struct nand_hw_control { | |||
339 | * @prepad: padding information for syndrome based ecc generators | 340 | * @prepad: padding information for syndrome based ecc generators |
340 | * @postpad: padding information for syndrome based ecc generators | 341 | * @postpad: padding information for syndrome based ecc generators |
341 | * @layout: ECC layout control struct pointer | 342 | * @layout: ECC layout control struct pointer |
343 | * @priv: pointer to private ecc control data | ||
342 | * @hwctl: function to control hardware ecc generator. Must only | 344 | * @hwctl: function to control hardware ecc generator. Must only |
343 | * be provided if an hardware ECC is available | 345 | * be provided if an hardware ECC is available |
344 | * @calculate: function for ecc calculation or readback from ecc hardware | 346 | * @calculate: function for ecc calculation or readback from ecc hardware |
@@ -362,6 +364,7 @@ struct nand_ecc_ctrl { | |||
362 | int prepad; | 364 | int prepad; |
363 | int postpad; | 365 | int postpad; |
364 | struct nand_ecclayout *layout; | 366 | struct nand_ecclayout *layout; |
367 | void *priv; | ||
365 | void (*hwctl)(struct mtd_info *mtd, int mode); | 368 | void (*hwctl)(struct mtd_info *mtd, int mode); |
366 | int (*calculate)(struct mtd_info *mtd, const uint8_t *dat, | 369 | int (*calculate)(struct mtd_info *mtd, const uint8_t *dat, |
367 | uint8_t *ecc_code); | 370 | uint8_t *ecc_code); |
@@ -413,9 +416,9 @@ struct nand_buffers { | |||
413 | * @select_chip: [REPLACEABLE] select chip nr | 416 | * @select_chip: [REPLACEABLE] select chip nr |
414 | * @block_bad: [REPLACEABLE] check, if the block is bad | 417 | * @block_bad: [REPLACEABLE] check, if the block is bad |
415 | * @block_markbad: [REPLACEABLE] mark the block bad | 418 | * @block_markbad: [REPLACEABLE] mark the block bad |
416 | * @cmd_ctrl: [BOARDSPECIFIC] hardwarespecific funtion for controlling | 419 | * @cmd_ctrl: [BOARDSPECIFIC] hardwarespecific function for controlling |
417 | * ALE/CLE/nCE. Also used to write command and address | 420 | * ALE/CLE/nCE. Also used to write command and address |
418 | * @init_size: [BOARDSPECIFIC] hardwarespecific funtion for setting | 421 | * @init_size: [BOARDSPECIFIC] hardwarespecific function for setting |
419 | * mtd->oobsize, mtd->writesize and so on. | 422 | * mtd->oobsize, mtd->writesize and so on. |
420 | * @id_data contains the 8 bytes values of NAND_CMD_READID. | 423 | * @id_data contains the 8 bytes values of NAND_CMD_READID. |
421 | * Return with the bus width. | 424 | * Return with the bus width. |
@@ -434,7 +437,7 @@ struct nand_buffers { | |||
434 | * @erase_cmd: [INTERN] erase command write function, selectable due | 437 | * @erase_cmd: [INTERN] erase command write function, selectable due |
435 | * to AND support. | 438 | * to AND support. |
436 | * @scan_bbt: [REPLACEABLE] function to scan bad block table | 439 | * @scan_bbt: [REPLACEABLE] function to scan bad block table |
437 | * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering | 440 | * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transferring |
438 | * data from array to read regs (tR). | 441 | * data from array to read regs (tR). |
439 | * @state: [INTERN] the current state of the NAND device | 442 | * @state: [INTERN] the current state of the NAND device |
440 | * @oob_poi: poison value buffer | 443 | * @oob_poi: poison value buffer |
@@ -448,6 +451,8 @@ struct nand_buffers { | |||
448 | * See the defines for further explanation. | 451 | * See the defines for further explanation. |
449 | * @badblockpos: [INTERN] position of the bad block marker in the oob | 452 | * @badblockpos: [INTERN] position of the bad block marker in the oob |
450 | * area. | 453 | * area. |
454 | * @badblockbits: [INTERN] number of bits to left-shift the bad block | ||
455 | * number | ||
451 | * @cellinfo: [INTERN] MLC/multichip data from chip ident | 456 | * @cellinfo: [INTERN] MLC/multichip data from chip ident |
452 | * @numchips: [INTERN] number of physical chips | 457 | * @numchips: [INTERN] number of physical chips |
453 | * @chipsize: [INTERN] the size of one chip for multichip arrays | 458 | * @chipsize: [INTERN] the size of one chip for multichip arrays |
diff --git a/include/linux/mtd/nand_bch.h b/include/linux/mtd/nand_bch.h new file mode 100644 index 000000000000..74acf5367556 --- /dev/null +++ b/include/linux/mtd/nand_bch.h | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | * Copyright © 2011 Ivan Djelic <ivan.djelic@parrot.com> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | * | ||
8 | * This file is the header for the NAND BCH ECC implementation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __MTD_NAND_BCH_H__ | ||
12 | #define __MTD_NAND_BCH_H__ | ||
13 | |||
14 | struct mtd_info; | ||
15 | struct nand_bch_control; | ||
16 | |||
17 | #if defined(CONFIG_MTD_NAND_ECC_BCH) | ||
18 | |||
19 | static inline int mtd_nand_has_bch(void) { return 1; } | ||
20 | |||
21 | /* | ||
22 | * Calculate BCH ecc code | ||
23 | */ | ||
24 | int nand_bch_calculate_ecc(struct mtd_info *mtd, const u_char *dat, | ||
25 | u_char *ecc_code); | ||
26 | |||
27 | /* | ||
28 | * Detect and correct bit errors | ||
29 | */ | ||
30 | int nand_bch_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc, | ||
31 | u_char *calc_ecc); | ||
32 | /* | ||
33 | * Initialize BCH encoder/decoder | ||
34 | */ | ||
35 | struct nand_bch_control * | ||
36 | nand_bch_init(struct mtd_info *mtd, unsigned int eccsize, | ||
37 | unsigned int eccbytes, struct nand_ecclayout **ecclayout); | ||
38 | /* | ||
39 | * Release BCH encoder/decoder resources | ||
40 | */ | ||
41 | void nand_bch_free(struct nand_bch_control *nbc); | ||
42 | |||
43 | #else /* !CONFIG_MTD_NAND_ECC_BCH */ | ||
44 | |||
45 | static inline int mtd_nand_has_bch(void) { return 0; } | ||
46 | |||
47 | static inline int | ||
48 | nand_bch_calculate_ecc(struct mtd_info *mtd, const u_char *dat, | ||
49 | u_char *ecc_code) | ||
50 | { | ||
51 | return -1; | ||
52 | } | ||
53 | |||
54 | static inline int | ||
55 | nand_bch_correct_data(struct mtd_info *mtd, unsigned char *buf, | ||
56 | unsigned char *read_ecc, unsigned char *calc_ecc) | ||
57 | { | ||
58 | return -1; | ||
59 | } | ||
60 | |||
61 | static inline struct nand_bch_control * | ||
62 | nand_bch_init(struct mtd_info *mtd, unsigned int eccsize, | ||
63 | unsigned int eccbytes, struct nand_ecclayout **ecclayout) | ||
64 | { | ||
65 | return NULL; | ||
66 | } | ||
67 | |||
68 | static inline void nand_bch_free(struct nand_bch_control *nbc) {} | ||
69 | |||
70 | #endif /* CONFIG_MTD_NAND_ECC_BCH */ | ||
71 | |||
72 | #endif /* __MTD_NAND_BCH_H__ */ | ||
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h index 0c8815bfae1c..52b6f187bf49 100644 --- a/include/linux/mtd/onenand.h +++ b/include/linux/mtd/onenand.h | |||
@@ -118,6 +118,8 @@ struct onenand_chip { | |||
118 | int (*chip_probe)(struct mtd_info *mtd); | 118 | int (*chip_probe)(struct mtd_info *mtd); |
119 | int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); | 119 | int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); |
120 | int (*scan_bbt)(struct mtd_info *mtd); | 120 | int (*scan_bbt)(struct mtd_info *mtd); |
121 | int (*enable)(struct mtd_info *mtd); | ||
122 | int (*disable)(struct mtd_info *mtd); | ||
121 | 123 | ||
122 | struct completion complete; | 124 | struct completion complete; |
123 | int irq; | 125 | int irq; |
@@ -137,6 +139,14 @@ struct onenand_chip { | |||
137 | void *bbm; | 139 | void *bbm; |
138 | 140 | ||
139 | void *priv; | 141 | void *priv; |
142 | |||
143 | /* | ||
144 | * Shows that the current operation is composed | ||
145 | * of sequence of commands. For example, cache program. | ||
146 | * Such command status OnGo bit is checked at the end of | ||
147 | * sequence. | ||
148 | */ | ||
149 | unsigned int ongoing; | ||
140 | }; | 150 | }; |
141 | 151 | ||
142 | /* | 152 | /* |
@@ -171,6 +181,9 @@ struct onenand_chip { | |||
171 | #define ONENAND_IS_2PLANE(this) (0) | 181 | #define ONENAND_IS_2PLANE(this) (0) |
172 | #endif | 182 | #endif |
173 | 183 | ||
184 | #define ONENAND_IS_CACHE_PROGRAM(this) \ | ||
185 | (this->options & ONENAND_HAS_CACHE_PROGRAM) | ||
186 | |||
174 | /* Check byte access in OneNAND */ | 187 | /* Check byte access in OneNAND */ |
175 | #define ONENAND_CHECK_BYTE_ACCESS(addr) (addr & 0x1) | 188 | #define ONENAND_CHECK_BYTE_ACCESS(addr) (addr & 0x1) |
176 | 189 | ||
@@ -181,9 +194,11 @@ struct onenand_chip { | |||
181 | #define ONENAND_HAS_UNLOCK_ALL (0x0002) | 194 | #define ONENAND_HAS_UNLOCK_ALL (0x0002) |
182 | #define ONENAND_HAS_2PLANE (0x0004) | 195 | #define ONENAND_HAS_2PLANE (0x0004) |
183 | #define ONENAND_HAS_4KB_PAGE (0x0008) | 196 | #define ONENAND_HAS_4KB_PAGE (0x0008) |
197 | #define ONENAND_HAS_CACHE_PROGRAM (0x0010) | ||
184 | #define ONENAND_SKIP_UNLOCK_CHECK (0x0100) | 198 | #define ONENAND_SKIP_UNLOCK_CHECK (0x0100) |
185 | #define ONENAND_PAGEBUF_ALLOC (0x1000) | 199 | #define ONENAND_PAGEBUF_ALLOC (0x1000) |
186 | #define ONENAND_OOBBUF_ALLOC (0x2000) | 200 | #define ONENAND_OOBBUF_ALLOC (0x2000) |
201 | #define ONENAND_SKIP_INITIAL_UNLOCKING (0x4000) | ||
187 | 202 | ||
188 | #define ONENAND_IS_4KB_PAGE(this) \ | 203 | #define ONENAND_IS_4KB_PAGE(this) \ |
189 | (this->options & ONENAND_HAS_4KB_PAGE) | 204 | (this->options & ONENAND_HAS_4KB_PAGE) |
diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h index cd6f3b431195..d60130f88eed 100644 --- a/include/linux/mtd/onenand_regs.h +++ b/include/linux/mtd/onenand_regs.h | |||
@@ -168,6 +168,7 @@ | |||
168 | #define ONENAND_SYS_CFG1_INT (1 << 6) | 168 | #define ONENAND_SYS_CFG1_INT (1 << 6) |
169 | #define ONENAND_SYS_CFG1_IOBE (1 << 5) | 169 | #define ONENAND_SYS_CFG1_IOBE (1 << 5) |
170 | #define ONENAND_SYS_CFG1_RDY_CONF (1 << 4) | 170 | #define ONENAND_SYS_CFG1_RDY_CONF (1 << 4) |
171 | #define ONENAND_SYS_CFG1_VHF (1 << 3) | ||
171 | #define ONENAND_SYS_CFG1_HF (1 << 2) | 172 | #define ONENAND_SYS_CFG1_HF (1 << 2) |
172 | #define ONENAND_SYS_CFG1_SYNC_WRITE (1 << 1) | 173 | #define ONENAND_SYS_CFG1_SYNC_WRITE (1 << 1) |
173 | 174 | ||
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h index 2b54316591d2..4a0a8ba90a72 100644 --- a/include/linux/mtd/partitions.h +++ b/include/linux/mtd/partitions.h | |||
@@ -89,7 +89,7 @@ static inline int mtd_has_cmdlinepart(void) { return 1; } | |||
89 | static inline int mtd_has_cmdlinepart(void) { return 0; } | 89 | static inline int mtd_has_cmdlinepart(void) { return 0; } |
90 | #endif | 90 | #endif |
91 | 91 | ||
92 | int mtd_is_master(struct mtd_info *mtd); | 92 | int mtd_is_partition(struct mtd_info *mtd); |
93 | int mtd_add_partition(struct mtd_info *master, char *name, | 93 | int mtd_add_partition(struct mtd_info *master, char *name, |
94 | long long offset, long long length); | 94 | long long offset, long long length); |
95 | int mtd_del_partition(struct mtd_info *master, int partno); | 95 | int mtd_del_partition(struct mtd_info *master, int partno); |
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h index b31bd9e9bca3..84854edf4436 100644 --- a/include/linux/mtd/ubi.h +++ b/include/linux/mtd/ubi.h | |||
@@ -116,18 +116,40 @@ struct ubi_volume_info { | |||
116 | * struct ubi_device_info - UBI device description data structure. | 116 | * struct ubi_device_info - UBI device description data structure. |
117 | * @ubi_num: ubi device number | 117 | * @ubi_num: ubi device number |
118 | * @leb_size: logical eraseblock size on this UBI device | 118 | * @leb_size: logical eraseblock size on this UBI device |
119 | * @leb_start: starting offset of logical eraseblocks within physical | ||
120 | * eraseblocks | ||
119 | * @min_io_size: minimal I/O unit size | 121 | * @min_io_size: minimal I/O unit size |
122 | * @max_write_size: maximum amount of bytes the underlying flash can write at a | ||
123 | * time (MTD write buffer size) | ||
120 | * @ro_mode: if this device is in read-only mode | 124 | * @ro_mode: if this device is in read-only mode |
121 | * @cdev: UBI character device major and minor numbers | 125 | * @cdev: UBI character device major and minor numbers |
122 | * | 126 | * |
123 | * Note, @leb_size is the logical eraseblock size offered by the UBI device. | 127 | * Note, @leb_size is the logical eraseblock size offered by the UBI device. |
124 | * Volumes of this UBI device may have smaller logical eraseblock size if their | 128 | * Volumes of this UBI device may have smaller logical eraseblock size if their |
125 | * alignment is not equivalent to %1. | 129 | * alignment is not equivalent to %1. |
130 | * | ||
131 | * The @max_write_size field describes flash write maximum write unit. For | ||
132 | * example, NOR flash allows for changing individual bytes, so @min_io_size is | ||
133 | * %1. However, it does not mean than NOR flash has to write data byte-by-byte. | ||
134 | * Instead, CFI NOR flashes have a write-buffer of, e.g., 64 bytes, and when | ||
135 | * writing large chunks of data, they write 64-bytes at a time. Obviously, this | ||
136 | * improves write throughput. | ||
137 | * | ||
138 | * Also, the MTD device may have N interleaved (striped) flash chips | ||
139 | * underneath, in which case @min_io_size can be physical min. I/O size of | ||
140 | * single flash chip, while @max_write_size can be N * @min_io_size. | ||
141 | * | ||
142 | * The @max_write_size field is always greater or equivalent to @min_io_size. | ||
143 | * E.g., some NOR flashes may have (@min_io_size = 1, @max_write_size = 64). In | ||
144 | * contrast, NAND flashes usually have @min_io_size = @max_write_size = NAND | ||
145 | * page size. | ||
126 | */ | 146 | */ |
127 | struct ubi_device_info { | 147 | struct ubi_device_info { |
128 | int ubi_num; | 148 | int ubi_num; |
129 | int leb_size; | 149 | int leb_size; |
150 | int leb_start; | ||
130 | int min_io_size; | 151 | int min_io_size; |
152 | int max_write_size; | ||
131 | int ro_mode; | 153 | int ro_mode; |
132 | dev_t cdev; | 154 | dev_t cdev; |
133 | }; | 155 | }; |
diff --git a/include/linux/mtd/xip.h b/include/linux/mtd/xip.h index 36efcba15ecd..abed4dec5c2f 100644 --- a/include/linux/mtd/xip.h +++ b/include/linux/mtd/xip.h | |||
@@ -51,7 +51,7 @@ | |||
51 | * return in usecs the elapsed timebetween now and the reference x as | 51 | * return in usecs the elapsed timebetween now and the reference x as |
52 | * returned by xip_currtime(). | 52 | * returned by xip_currtime(). |
53 | * | 53 | * |
54 | * note 1: convertion to usec can be approximated, as long as the | 54 | * note 1: conversion to usec can be approximated, as long as the |
55 | * returned value is <= the real elapsed time. | 55 | * returned value is <= the real elapsed time. |
56 | * note 2: this should be able to cope with a few seconds without | 56 | * note 2: this should be able to cope with a few seconds without |
57 | * overflowing. | 57 | * overflowing. |