Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 1 | /* |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 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 | |
Afzal Mohammed | bc3668e | 2012-09-29 12:26:13 +0530 | [diff] [blame] | 9 | #ifndef _MTD_NAND_OMAP2_H |
| 10 | #define _MTD_NAND_OMAP2_H |
| 11 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 12 | #include <linux/mtd/partitions.h> |
| 13 | |
Afzal Mohammed | 2fdf0c9 | 2012-10-04 15:49:04 +0530 | [diff] [blame] | 14 | #define GPMC_BCH_NUM_REMAINDER 8 |
| 15 | |
Sukumar Ghorai | 1b0b323c | 2011-01-28 15:42:04 +0530 | [diff] [blame] | 16 | enum nand_io { |
| 17 | NAND_OMAP_PREFETCH_POLLED = 0, /* prefetch polled mode, default */ |
| 18 | NAND_OMAP_POLLED, /* polled mode, without prefetch */ |
Sukumar Ghorai | 4e07037 | 2011-01-28 15:42:06 +0530 | [diff] [blame] | 19 | NAND_OMAP_PREFETCH_DMA, /* prefetch enabled sDMA mode */ |
| 20 | NAND_OMAP_PREFETCH_IRQ /* prefetch enabled irq mode */ |
Sukumar Ghorai | 1b0b323c | 2011-01-28 15:42:04 +0530 | [diff] [blame] | 21 | }; |
| 22 | |
Afzal Mohammed | bc3668e | 2012-09-29 12:26:13 +0530 | [diff] [blame] | 23 | enum omap_ecc { |
Roger Quadros | 7d5929c | 2014-08-25 16:15:32 -0700 | [diff] [blame] | 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, |
Pekon Gupta | ac65caf | 2013-10-24 18:20:17 +0530 | [diff] [blame] | 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, |
pekon gupta | 27c9fd6 | 2014-05-19 13:24:39 +0530 | [diff] [blame] | 43 | /* 16-bit ECC calculation by GPMC, Error detection by ELM */ |
| 44 | OMAP_ECC_BCH16_CODE_HW, |
Afzal Mohammed | bc3668e | 2012-09-29 12:26:13 +0530 | [diff] [blame] | 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; |
Afzal Mohammed | 2fdf0c9 | 2012-10-04 15:49:04 +0530 | [diff] [blame] | 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]; |
pekon gupta | 27c9fd6 | 2014-05-19 13:24:39 +0530 | [diff] [blame] | 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]; |
Afzal Mohammed | bc3668e | 2012-09-29 12:26:13 +0530 | [diff] [blame] | 67 | }; |
| 68 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 69 | struct omap_nand_platform_data { |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 70 | int cs; |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 71 | struct mtd_partition *parts; |
| 72 | int nr_parts; |
Grazvydas Ignotas | 7a559c7 | 2011-06-03 19:56:33 +0000 | [diff] [blame] | 73 | bool dev_ready; |
Sukumar Ghorai | 1b0b323c | 2011-01-28 15:42:04 +0530 | [diff] [blame] | 74 | enum nand_io xfer_type; |
Vimal Singh | 2f70a1e | 2010-02-15 10:03:33 -0800 | [diff] [blame] | 75 | int devsize; |
Sukumar Ghorai | f3d73f3 | 2011-01-28 15:42:08 +0530 | [diff] [blame] | 76 | enum omap_ecc ecc_opt; |
Afzal Mohammed | d126d01 | 2012-08-30 12:53:22 -0700 | [diff] [blame] | 77 | struct gpmc_nand_regs reg; |
Vimal Singh | 2f70a1e | 2010-02-15 10:03:33 -0800 | [diff] [blame] | 78 | |
Daniel Mack | ccf04c5 | 2012-12-14 11:36:41 +0100 | [diff] [blame] | 79 | /* for passing the partitions */ |
| 80 | struct device_node *of_node; |
Pekon Gupta | ac65caf | 2013-10-24 18:20:17 +0530 | [diff] [blame] | 81 | struct device_node *elm_of_node; |
Daniel Mack | ccf04c5 | 2012-12-14 11:36:41 +0100 | [diff] [blame] | 82 | }; |
stanley.miao | 562468b | 2010-04-20 06:33:26 +0000 | [diff] [blame] | 83 | #endif |