aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mtd
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2010-08-30 12:32:24 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-10-24 18:46:34 -0400
commitd1e1f4e42b5df063712ca2926e50c07b95c96b96 (patch)
tree6dc4ab018397d5029690957b27d376e25d1c1f85 /include/linux/mtd
parent42af8b58fb5ec97214e85780db71bb9d60541fcc (diff)
mtd: nand: add support for reading ONFI parameters from NAND device
This patch adds support for reading NAND device ONFI parameters and use the ONFI informations to define its geometry. In case the device supports ONFI, the onfi_version field in struct nand_chip contains the version (BCD) and the onfi_params structure can be used by drivers to set up timings and such. We currently only support ONFI 1.0 parameters. Signed-off-by: Brian Norris <norris@broadcom.com> Signed-off-by: Matthieu Castet <matthieu.castet@parrot.com> Signed-off-by: Maxime Bizon <mbizon@freebox.fr> Signed-off-by: Florian Fainelli <ffainelli@freebox.fr> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'include/linux/mtd')
-rw-r--r--include/linux/mtd/nand.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 29656a3f9331..7666c42235c7 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -228,6 +228,69 @@ typedef enum {
228/* Keep gcc happy */ 228/* Keep gcc happy */
229struct nand_chip; 229struct nand_chip;
230 230
231struct nand_onfi_params {
232 /* rev info and features block */
233 u8 sig[4]; /* 'O' 'N' 'F' 'I' */
234 __le16 revision;
235 __le16 features;
236 __le16 opt_cmd;
237 u8 reserved[22];
238
239 /* manufacturer information block */
240 char manufacturer[12];
241 char model[20];
242 u8 jedec_id;
243 __le16 date_code;
244 u8 reserved2[13];
245
246 /* memory organization block */
247 __le32 byte_per_page;
248 __le16 spare_bytes_per_page;
249 __le32 data_bytes_per_ppage;
250 __le16 spare_bytes_per_ppage;
251 __le32 pages_per_block;
252 __le32 blocks_per_lun;
253 u8 lun_count;
254 u8 addr_cycles;
255 u8 bits_per_cell;
256 __le16 bb_per_lun;
257 __le16 block_endurance;
258 u8 guaranteed_good_blocks;
259 __le16 guaranteed_block_endurance;
260 u8 programs_per_page;
261 u8 ppage_attr;
262 u8 ecc_bits;
263 u8 interleaved_bits;
264 u8 interleaved_ops;
265 u8 reserved3[13];
266
267 /* electrical parameter block */
268 u8 io_pin_capacitance_max;
269 __le16 async_timing_mode;
270 __le16 program_cache_timing_mode;
271 __le16 t_prog;
272 __le16 t_bers;
273 __le16 t_r;
274 __le16 t_ccs;
275 __le16 src_sync_timing_mode;
276 __le16 src_ssync_features;
277 __le16 clk_pin_capacitance_typ;
278 __le16 io_pin_capacitance_typ;
279 __le16 input_pin_capacitance_typ;
280 u8 input_pin_capacitance_max;
281 u8 driver_strenght_support;
282 __le16 t_int_r;
283 __le16 t_ald;
284 u8 reserved4[7];
285
286 /* vendor */
287 u8 reserved5[90];
288
289 __le16 crc;
290} __attribute__((packed));
291
292#define ONFI_CRC_BASE 0x4F4E
293
231/** 294/**
232 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices 295 * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices
233 * @lock: protection lock 296 * @lock: protection lock
@@ -360,6 +423,8 @@ struct nand_buffers {
360 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1 423 * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1
361 * @pagebuf: [INTERN] holds the pagenumber which is currently in data_buf 424 * @pagebuf: [INTERN] holds the pagenumber which is currently in data_buf
362 * @subpagesize: [INTERN] holds the subpagesize 425 * @subpagesize: [INTERN] holds the subpagesize
426 * @onfi_version: [INTERN] holds the chip ONFI version (BCD encoded), non 0 if ONFI supported
427 * @onfi_params: [INTERN] holds the ONFI page parameter when ONFI is supported, 0 otherwise
363 * @ecclayout: [REPLACEABLE] the default ecc placement scheme 428 * @ecclayout: [REPLACEABLE] the default ecc placement scheme
364 * @bbt: [INTERN] bad block table pointer 429 * @bbt: [INTERN] bad block table pointer
365 * @bbt_td: [REPLACEABLE] bad block table descriptor for flash lookup 430 * @bbt_td: [REPLACEABLE] bad block table descriptor for flash lookup
@@ -412,6 +477,9 @@ struct nand_chip {
412 int badblockpos; 477 int badblockpos;
413 int badblockbits; 478 int badblockbits;
414 479
480 int onfi_version;
481 struct nand_onfi_params onfi_params;
482
415 flstate_t state; 483 flstate_t state;
416 484
417 uint8_t *oob_poi; 485 uint8_t *oob_poi;