]> git.karo-electronics.de Git - karo-tx-uboot.git/blob - include/asm-arm/arch-davinci/nand_defs.h
8450b8c69034c60de465314f670dbb73e42e17e5
[karo-tx-uboot.git] / include / asm-arm / arch-davinci / nand_defs.h
1 /*
2  * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net>
3  *
4  * Parts shamelesly stolen from Linux Kernel source tree.
5  *
6  * ------------------------------------------------------------
7  *
8  * See file CREDITS for list of people who contributed to this
9  * project.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License as
13  * published by the Free Software Foundation; either version 2 of
14  * the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24  * MA 02111-1307 USA
25  */
26 #ifndef _NAND_DEFS_H_
27 #define _NAND_DEFS_H_
28
29 #include <asm/arch/hardware.h>
30
31 #define MASK_CLE        0x10
32 #define MASK_ALE        0x0a
33
34 #define NAND_READ_START         0x00
35 #define NAND_READ_END           0x30
36 #define NAND_STATUS             0x70
37
38 #ifdef CONFIG_SYS_NAND_HW_ECC
39 #define NAND_Ecc_P1e            (1 << 0)
40 #define NAND_Ecc_P2e            (1 << 1)
41 #define NAND_Ecc_P4e            (1 << 2)
42 #define NAND_Ecc_P8e            (1 << 3)
43 #define NAND_Ecc_P16e           (1 << 4)
44 #define NAND_Ecc_P32e           (1 << 5)
45 #define NAND_Ecc_P64e           (1 << 6)
46 #define NAND_Ecc_P128e          (1 << 7)
47 #define NAND_Ecc_P256e          (1 << 8)
48 #define NAND_Ecc_P512e          (1 << 9)
49 #define NAND_Ecc_P1024e         (1 << 10)
50 #define NAND_Ecc_P2048e         (1 << 11)
51
52 #define NAND_Ecc_P1o            (1 << 16)
53 #define NAND_Ecc_P2o            (1 << 17)
54 #define NAND_Ecc_P4o            (1 << 18)
55 #define NAND_Ecc_P8o            (1 << 19)
56 #define NAND_Ecc_P16o           (1 << 20)
57 #define NAND_Ecc_P32o           (1 << 21)
58 #define NAND_Ecc_P64o           (1 << 22)
59 #define NAND_Ecc_P128o          (1 << 23)
60 #define NAND_Ecc_P256o          (1 << 24)
61 #define NAND_Ecc_P512o          (1 << 25)
62 #define NAND_Ecc_P1024o         (1 << 26)
63 #define NAND_Ecc_P2048o         (1 << 27)
64
65 #define TF(v)                   (v ? 1 : 0)
66
67 #define P2048e(a)               (TF(a & NAND_Ecc_P2048e) << 0)
68 #define P2048o(a)               (TF(a & NAND_Ecc_P2048o) << 1)
69 #define P1e(a)                  (TF(a & NAND_Ecc_P1e) << 2)
70 #define P1o(a)                  (TF(a & NAND_Ecc_P1o) << 3)
71 #define P2e(a)                  (TF(a & NAND_Ecc_P2e) << 4)
72 #define P2o(a)                  (TF(a & NAND_Ecc_P2o) << 5)
73 #define P4e(a)                  (TF(a & NAND_Ecc_P4e) << 6)
74 #define P4o(a)                  (TF(a & NAND_Ecc_P4o) << 7)
75
76 #define P8e(a)                  (TF(a & NAND_Ecc_P8e) << 0)
77 #define P8o(a)                  (TF(a & NAND_Ecc_P8o) << 1)
78 #define P16e(a)                 (TF(a & NAND_Ecc_P16e) << 2)
79 #define P16o(a)                 (TF(a & NAND_Ecc_P16o) << 3)
80 #define P32e(a)                 (TF(a & NAND_Ecc_P32e) << 4)
81 #define P32o(a)                 (TF(a & NAND_Ecc_P32o) << 5)
82 #define P64e(a)                 (TF(a & NAND_Ecc_P64e) << 6)
83 #define P64o(a)                 (TF(a & NAND_Ecc_P64o) << 7)
84
85 #define P128e(a)                (TF(a & NAND_Ecc_P128e) << 0)
86 #define P128o(a)                (TF(a & NAND_Ecc_P128o) << 1)
87 #define P256e(a)                (TF(a & NAND_Ecc_P256e) << 2)
88 #define P256o(a)                (TF(a & NAND_Ecc_P256o) << 3)
89 #define P512e(a)                (TF(a & NAND_Ecc_P512e) << 4)
90 #define P512o(a)                (TF(a & NAND_Ecc_P512o) << 5)
91 #define P1024e(a)               (TF(a & NAND_Ecc_P1024e) << 6)
92 #define P1024o(a)               (TF(a & NAND_Ecc_P1024o) << 7)
93
94 #define P8e_s(a)                (TF(a & NAND_Ecc_P8e) << 0)
95 #define P8o_s(a)                (TF(a & NAND_Ecc_P8o) << 1)
96 #define P16e_s(a)               (TF(a & NAND_Ecc_P16e) << 2)
97 #define P16o_s(a)               (TF(a & NAND_Ecc_P16o) << 3)
98 #define P1e_s(a)                (TF(a & NAND_Ecc_P1e) << 4)
99 #define P1o_s(a)                (TF(a & NAND_Ecc_P1o) << 5)
100 #define P2e_s(a)                (TF(a & NAND_Ecc_P2e) << 6)
101 #define P2o_s(a)                (TF(a & NAND_Ecc_P2o) << 7)
102
103 #define P4e_s(a)                (TF(a & NAND_Ecc_P4e) << 0)
104 #define P4o_s(a)                (TF(a & NAND_Ecc_P4o) << 1)
105 #endif
106
107 #endif