xref: /linux/include/linux/mtd/jedec.h (revision 0ea5c948cb64bab5bc7a5516774eb8536f05aa0d)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright © 2000-2010 David Woodhouse <dwmw2@infradead.org>
4  *			 Steven J. Hill <sjhill@realitydiluted.com>
5  *			 Thomas Gleixner <tglx@linutronix.de>
6  *
7  * Contains all JEDEC related definitions
8  */
9 
10 #ifndef __LINUX_MTD_JEDEC_H
11 #define __LINUX_MTD_JEDEC_H
12 
13 struct jedec_ecc_info {
14 	u8 ecc_bits;
15 	u8 codeword_size;
16 	__le16 bb_per_lun;
17 	__le16 block_endurance;
18 	u8 reserved[2];
19 } __packed;
20 
21 /* JEDEC features */
22 #define JEDEC_FEATURE_16_BIT_BUS	(1 << 0)
23 
24 /* JEDEC Optional Commands */
25 #define JEDEC_OPT_CMD_READ_CACHE	BIT(1)
26 
27 struct nand_jedec_params {
28 	/* rev info and features block */
29 	/* 'J' 'E' 'S' 'D'  */
30 	u8 sig[4];
31 	__le16 revision;
32 	__le16 features;
33 	u8 opt_cmd[3];
34 	__le16 sec_cmd;
35 	u8 num_of_param_pages;
36 	u8 reserved0[18];
37 
38 	/* manufacturer information block */
39 	char manufacturer[12];
40 	char model[20];
41 	u8 jedec_id[6];
42 	u8 reserved1[10];
43 
44 	/* memory organization block */
45 	__le32 byte_per_page;
46 	__le16 spare_bytes_per_page;
47 	u8 reserved2[6];
48 	__le32 pages_per_block;
49 	__le32 blocks_per_lun;
50 	u8 lun_count;
51 	u8 addr_cycles;
52 	u8 bits_per_cell;
53 	u8 programs_per_page;
54 	u8 multi_plane_addr;
55 	u8 multi_plane_op_attr;
56 	u8 reserved3[38];
57 
58 	/* electrical parameter block */
59 	__le16 async_sdr_speed_grade;
60 	__le16 toggle_ddr_speed_grade;
61 	__le16 sync_ddr_speed_grade;
62 	u8 async_sdr_features;
63 	u8 toggle_ddr_features;
64 	u8 sync_ddr_features;
65 	__le16 t_prog;
66 	__le16 t_bers;
67 	__le16 t_r;
68 	__le16 t_r_multi_plane;
69 	__le16 t_ccs;
70 	__le16 io_pin_capacitance_typ;
71 	__le16 input_pin_capacitance_typ;
72 	__le16 clk_pin_capacitance_typ;
73 	u8 driver_strength_support;
74 	__le16 t_adl;
75 	u8 reserved4[36];
76 
77 	/* ECC and endurance block */
78 	u8 guaranteed_good_blocks;
79 	__le16 guaranteed_block_endurance;
80 	struct jedec_ecc_info ecc_info[4];
81 	u8 reserved5[29];
82 
83 	/* reserved */
84 	u8 reserved6[148];
85 
86 	/* vendor */
87 	__le16 vendor_rev_num;
88 	u8 reserved7[88];
89 
90 	/* CRC for Parameter Page */
91 	__le16 crc;
92 } __packed;
93 
94 #endif /* __LINUX_MTD_JEDEC_H */
95