Commit | Line | Data |
---|---|---|
78be6325 | 1 | /* |
78be6325 TL |
2 | * Copyright (C) 2006 Micron Technology Inc. |
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 | ||
bc3668ea AM |
9 | #ifndef _MTD_NAND_OMAP2_H |
10 | #define _MTD_NAND_OMAP2_H | |
11 | ||
78be6325 TL |
12 | #include <linux/mtd/partitions.h> |
13 | ||
2fdf0c98 AM |
14 | #define GPMC_BCH_NUM_REMAINDER 8 |
15 | ||
1b0b323c SG |
16 | enum nand_io { |
17 | NAND_OMAP_PREFETCH_POLLED = 0, /* prefetch polled mode, default */ | |
18 | NAND_OMAP_POLLED, /* polled mode, without prefetch */ | |
4e070376 SG |
19 | NAND_OMAP_PREFETCH_DMA, /* prefetch enabled sDMA mode */ |
20 | NAND_OMAP_PREFETCH_IRQ /* prefetch enabled irq mode */ | |
1b0b323c SG |
21 | }; |
22 | ||
bc3668ea | 23 | enum omap_ecc { |
7d5929c1 RQ |
24 | /* |
25 | * 1-bit ECC: calculation and correction by SW | |
26 | * ECC stored at end of spare area | |
27 | */ | |
28 | OMAP_ECC_HAM1_CODE_SW = 0, | |
29 | ||
30 | /* | |
31 | * 1-bit ECC: calculation by GPMC, Error detection by Software | |
32 | * ECC layout compatible with ROM code layout | |
33 | */ | |
34 | OMAP_ECC_HAM1_CODE_HW, | |
ac65caf5 PG |
35 | /* 4-bit ECC calculation by GPMC, Error detection by Software */ |
36 | OMAP_ECC_BCH4_CODE_HW_DETECTION_SW, | |
37 | /* 4-bit ECC calculation by GPMC, Error detection by ELM */ | |
38 | OMAP_ECC_BCH4_CODE_HW, | |
39 | /* 8-bit ECC calculation by GPMC, Error detection by Software */ | |
40 | OMAP_ECC_BCH8_CODE_HW_DETECTION_SW, | |
41 | /* 8-bit ECC calculation by GPMC, Error detection by ELM */ | |
42 | OMAP_ECC_BCH8_CODE_HW, | |
27c9fd60 | 43 | /* 16-bit ECC calculation by GPMC, Error detection by ELM */ |
44 | OMAP_ECC_BCH16_CODE_HW, | |
bc3668ea AM |
45 | }; |
46 | ||
47 | struct gpmc_nand_regs { | |
48 | void __iomem *gpmc_status; | |
49 | void __iomem *gpmc_nand_command; | |
50 | void __iomem *gpmc_nand_address; | |
51 | void __iomem *gpmc_nand_data; | |
52 | void __iomem *gpmc_prefetch_config1; | |
53 | void __iomem *gpmc_prefetch_config2; | |
54 | void __iomem *gpmc_prefetch_control; | |
55 | void __iomem *gpmc_prefetch_status; | |
56 | void __iomem *gpmc_ecc_config; | |
57 | void __iomem *gpmc_ecc_control; | |
58 | void __iomem *gpmc_ecc_size_config; | |
59 | void __iomem *gpmc_ecc1_result; | |
2fdf0c98 AM |
60 | void __iomem *gpmc_bch_result0[GPMC_BCH_NUM_REMAINDER]; |
61 | void __iomem *gpmc_bch_result1[GPMC_BCH_NUM_REMAINDER]; | |
62 | void __iomem *gpmc_bch_result2[GPMC_BCH_NUM_REMAINDER]; | |
63 | void __iomem *gpmc_bch_result3[GPMC_BCH_NUM_REMAINDER]; | |
27c9fd60 | 64 | void __iomem *gpmc_bch_result4[GPMC_BCH_NUM_REMAINDER]; |
65 | void __iomem *gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER]; | |
66 | void __iomem *gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER]; | |
bc3668ea AM |
67 | }; |
68 | ||
78be6325 | 69 | struct omap_nand_platform_data { |
78be6325 | 70 | int cs; |
78be6325 TL |
71 | struct mtd_partition *parts; |
72 | int nr_parts; | |
7a559c78 | 73 | bool dev_ready; |
fef775ca | 74 | bool flash_bbt; |
1b0b323c | 75 | enum nand_io xfer_type; |
2f70a1e9 | 76 | int devsize; |
f3d73f36 | 77 | enum omap_ecc ecc_opt; |
d126d015 | 78 | struct gpmc_nand_regs reg; |
2f70a1e9 | 79 | |
ccf04c51 DM |
80 | /* for passing the partitions */ |
81 | struct device_node *of_node; | |
ac65caf5 | 82 | struct device_node *elm_of_node; |
ccf04c51 | 83 | }; |
562468bd | 84 | #endif |