]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - drivers/mtd/nand/nand_device_info.h
applied patches from Freescale and Ka-Ro
[karo-tx-uboot.git] / drivers / mtd / nand / nand_device_info.h
1 /*
2  * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved.
3  */
4
5 /*
6  * The code contained herein is licensed under the GNU General Public
7  * License. You may obtain a copy of the GNU General Public License
8  * Version 2 or later at the following locations:
9  *
10  * http://www.opensource.org/licenses/gpl-license.html
11  * http://www.gnu.org/copyleft/gpl.html
12  */
13 #ifndef __DRIVERS_NAND_DEVICE_INFO_H
14 #define __DRIVERS_NAND_DEVICE_INFO_H
15
16  /*
17   * The number of ID bytes to read from the NAND Flash device and hand over to
18   * the identification system.
19   */
20
21 #define NAND_DEVICE_ID_BYTE_COUNT  (6)
22
23 #define bool int
24 #define false 0
25 #define true  1
26
27  /*
28   * The number of ID bytes to read from the NAND Flash device and hand over to
29   * the identification system.
30   */
31
32 enum nand_device_cell_technology {
33         NAND_DEVICE_CELL_TECH_SLC = 0,
34         NAND_DEVICE_CELL_TECH_MLC = 1,
35 };
36
37 /**
38  * struct nand_device_info - Information about a single NAND Flash device.
39  *
40  * This structure contains all the *essential* information about a NAND Flash
41  * device, derived from the device's data sheet. For each manufacturer, we have
42  * an array of these structures.
43  *
44  * @end_of_table:              If true, marks the end of a table of device
45  *                             information.
46  * @manufacturer_code:         The manufacturer code (1st ID byte) reported by
47  *                             the device.
48  * @device_code:               The device code (2nd ID byte) reported by the
49  *                             device.
50  * @cell_technology:           The storage cell technology.
51  * @chip_size_in_bytes:        The total size of the storage behind a single
52  *                             chip select, in bytes. Notice that this is *not*
53  *                             necessarily the total size of the storage in a
54  *                             *package*, which may contain several chips.
55  * @block_size_in_pages:       The number of pages in a block.
56  * @page_total_size_in_bytes:  The total size of a page, in bytes, including
57  *                             both the data and the OOB.
58  * @ecc_strength_in_bits:      The strength of the ECC called for by the
59  *                             manufacturer, in number of correctable bits.
60  * @ecc_size_in_bytes:         The size of the data block over which the
61  *                             manufacturer calls for the given ECC algorithm
62  *                             and strength.
63  * @data_setup_in_ns:          The data setup time, in nanoseconds. Usually the
64  *                             maximum of tDS and tWP. A negative value
65  *                             indicates this characteristic isn't known.
66  * @data_hold_in_ns:           The data hold time, in nanoseconds. Usually the
67  *                             maximum of tDH, tWH and tREH. A negative value
68  *                             indicates this characteristic isn't known.
69  * @address_setup_in_ns:       The address setup time, in nanoseconds. Usually
70  *                             the maximum of tCLS, tCS and tALS. A negative
71  *                             value indicates this characteristic isn't known.
72  * @gpmi_sample_delay_in_ns:   A GPMI-specific timing parameter. A negative
73  *                             value indicates this characteristic isn't known.
74  * @tREA_in_ns:                tREA, in nanoseconds, from the data sheet. A
75  *                             negative value indicates this characteristic
76  *                             isn't known.
77  * @tRLOH_in_ns:               tRLOH, in nanoseconds, from the data sheet. A
78  *                             negative value indicates this characteristic
79  *                             isn't known.
80  * @tRHOH_in_ns:               tRHOH, in nanoseconds, from the data sheet. A
81  *                             negative value indicates this characteristic
82  *                             isn't known.
83  */
84
85 struct nand_device_info {
86
87         /* End of table marker */
88
89         bool      end_of_table;
90
91         /* Manufacturer and Device codes */
92
93         uint8_t   manufacturer_code;
94         uint8_t   device_code;
95
96         /* Technology */
97
98         enum nand_device_cell_technology  cell_technology;
99
100         /* Geometry */
101
102         uint64_t  chip_size_in_bytes;
103         uint32_t  block_size_in_pages;
104         uint16_t  page_total_size_in_bytes;
105
106         /* ECC */
107
108         uint8_t   ecc_strength_in_bits;
109         uint16_t  ecc_size_in_bytes;
110
111         /* Timing */
112
113         int8_t    data_setup_in_ns;
114         int8_t    data_hold_in_ns;
115         int8_t    address_setup_in_ns;
116         int8_t    gpmi_sample_delay_in_ns;
117         int8_t    tREA_in_ns;
118         int8_t    tRLOH_in_ns;
119         int8_t    tRHOH_in_ns;
120
121         /* Description */
122
123         const char  *description;
124
125 };
126
127 /**
128  * nand_device_get_info - Get info about a device based on ID bytes.
129  *
130  * @id_bytes:  An array of NAND_DEVICE_ID_BYTE_COUNT ID bytes retrieved from the
131  *             NAND Flash device.
132  */
133
134 struct nand_device_info *nand_device_get_info(const uint8_t id_bytes[]);
135
136 /**
137  * nand_device_print_info - Prints information about a NAND Flash device.
138  *
139  * @info  A pointer to a NAND Flash device information structure.
140  */
141
142 void nand_device_print_info(struct nand_device_info *info);
143
144 #endif