Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 1 | /* |
| 2 | * arch/arm/plat-omap/include/mach/nand.h |
| 3 | * |
| 4 | * Copyright (C) 2006 Micron Technology Inc. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | |
Afzal Mohammed | bc3668e | 2012-09-29 12:26:13 +0530 | [diff] [blame] | 11 | #ifndef _MTD_NAND_OMAP2_H |
| 12 | #define _MTD_NAND_OMAP2_H |
| 13 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 14 | #include <linux/mtd/partitions.h> |
| 15 | |
Afzal Mohammed | 2fdf0c9 | 2012-10-04 15:49:04 +0530 | [diff] [blame] | 16 | #define GPMC_BCH_NUM_REMAINDER 8 |
| 17 | |
Sukumar Ghorai | 1b0b323c | 2011-01-28 15:42:04 +0530 | [diff] [blame] | 18 | enum nand_io { |
| 19 | NAND_OMAP_PREFETCH_POLLED = 0, /* prefetch polled mode, default */ |
| 20 | NAND_OMAP_POLLED, /* polled mode, without prefetch */ |
Sukumar Ghorai | 4e07037 | 2011-01-28 15:42:06 +0530 | [diff] [blame] | 21 | NAND_OMAP_PREFETCH_DMA, /* prefetch enabled sDMA mode */ |
| 22 | NAND_OMAP_PREFETCH_IRQ /* prefetch enabled irq mode */ |
Sukumar Ghorai | 1b0b323c | 2011-01-28 15:42:04 +0530 | [diff] [blame] | 23 | }; |
| 24 | |
Afzal Mohammed | bc3668e | 2012-09-29 12:26:13 +0530 | [diff] [blame] | 25 | enum omap_ecc { |
Pekon Gupta | ac65caf | 2013-10-24 18:20:17 +0530 | [diff] [blame] | 26 | /* 1-bit ECC calculation by GPMC, Error detection by Software */ |
Pekon Gupta | c66d039 | 2013-10-24 18:20:18 +0530 | [diff] [blame^] | 27 | OMAP_ECC_HAM1_CODE_HW = 0, |
Pekon Gupta | ac65caf | 2013-10-24 18:20:17 +0530 | [diff] [blame] | 28 | /* 4-bit ECC calculation by GPMC, Error detection by Software */ |
| 29 | OMAP_ECC_BCH4_CODE_HW_DETECTION_SW, |
| 30 | /* 4-bit ECC calculation by GPMC, Error detection by ELM */ |
| 31 | OMAP_ECC_BCH4_CODE_HW, |
| 32 | /* 8-bit ECC calculation by GPMC, Error detection by Software */ |
| 33 | OMAP_ECC_BCH8_CODE_HW_DETECTION_SW, |
| 34 | /* 8-bit ECC calculation by GPMC, Error detection by ELM */ |
| 35 | OMAP_ECC_BCH8_CODE_HW, |
Afzal Mohammed | bc3668e | 2012-09-29 12:26:13 +0530 | [diff] [blame] | 36 | }; |
| 37 | |
| 38 | struct gpmc_nand_regs { |
| 39 | void __iomem *gpmc_status; |
| 40 | void __iomem *gpmc_nand_command; |
| 41 | void __iomem *gpmc_nand_address; |
| 42 | void __iomem *gpmc_nand_data; |
| 43 | void __iomem *gpmc_prefetch_config1; |
| 44 | void __iomem *gpmc_prefetch_config2; |
| 45 | void __iomem *gpmc_prefetch_control; |
| 46 | void __iomem *gpmc_prefetch_status; |
| 47 | void __iomem *gpmc_ecc_config; |
| 48 | void __iomem *gpmc_ecc_control; |
| 49 | void __iomem *gpmc_ecc_size_config; |
| 50 | void __iomem *gpmc_ecc1_result; |
Afzal Mohammed | 2fdf0c9 | 2012-10-04 15:49:04 +0530 | [diff] [blame] | 51 | void __iomem *gpmc_bch_result0[GPMC_BCH_NUM_REMAINDER]; |
| 52 | void __iomem *gpmc_bch_result1[GPMC_BCH_NUM_REMAINDER]; |
| 53 | void __iomem *gpmc_bch_result2[GPMC_BCH_NUM_REMAINDER]; |
| 54 | void __iomem *gpmc_bch_result3[GPMC_BCH_NUM_REMAINDER]; |
Afzal Mohammed | bc3668e | 2012-09-29 12:26:13 +0530 | [diff] [blame] | 55 | }; |
| 56 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 57 | struct omap_nand_platform_data { |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 58 | int cs; |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 59 | struct mtd_partition *parts; |
| 60 | int nr_parts; |
Grazvydas Ignotas | 7a559c7 | 2011-06-03 19:56:33 +0000 | [diff] [blame] | 61 | bool dev_ready; |
Sukumar Ghorai | 1b0b323c | 2011-01-28 15:42:04 +0530 | [diff] [blame] | 62 | enum nand_io xfer_type; |
Vimal Singh | 2f70a1e | 2010-02-15 10:03:33 -0800 | [diff] [blame] | 63 | int devsize; |
Sukumar Ghorai | f3d73f3 | 2011-01-28 15:42:08 +0530 | [diff] [blame] | 64 | enum omap_ecc ecc_opt; |
Afzal Mohammed | d126d01 | 2012-08-30 12:53:22 -0700 | [diff] [blame] | 65 | struct gpmc_nand_regs reg; |
Vimal Singh | 2f70a1e | 2010-02-15 10:03:33 -0800 | [diff] [blame] | 66 | |
Daniel Mack | ccf04c5 | 2012-12-14 11:36:41 +0100 | [diff] [blame] | 67 | /* for passing the partitions */ |
| 68 | struct device_node *of_node; |
Pekon Gupta | ac65caf | 2013-10-24 18:20:17 +0530 | [diff] [blame] | 69 | struct device_node *elm_of_node; |
Daniel Mack | ccf04c5 | 2012-12-14 11:36:41 +0100 | [diff] [blame] | 70 | }; |
stanley.miao | 562468b | 2010-04-20 06:33:26 +0000 | [diff] [blame] | 71 | #endif |