1 /* 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 9 #ifndef _MTD_NAND_OMAP2_H 10 #define _MTD_NAND_OMAP2_H 11 12 #include <linux/mtd/partitions.h> 13 14 #define GPMC_BCH_NUM_REMAINDER 8 15 16 enum nand_io { 17 NAND_OMAP_PREFETCH_POLLED = 0, /* prefetch polled mode, default */ 18 NAND_OMAP_POLLED, /* polled mode, without prefetch */ 19 NAND_OMAP_PREFETCH_DMA, /* prefetch enabled sDMA mode */ 20 NAND_OMAP_PREFETCH_IRQ /* prefetch enabled irq mode */ 21 }; 22 23 enum omap_ecc { 24 /* 1-bit ECC calculation by GPMC, Error detection by Software */ 25 OMAP_ECC_HAM1_CODE_HW = 0, 26 /* 4-bit ECC calculation by GPMC, Error detection by Software */ 27 OMAP_ECC_BCH4_CODE_HW_DETECTION_SW, 28 /* 4-bit ECC calculation by GPMC, Error detection by ELM */ 29 OMAP_ECC_BCH4_CODE_HW, 30 /* 8-bit ECC calculation by GPMC, Error detection by Software */ 31 OMAP_ECC_BCH8_CODE_HW_DETECTION_SW, 32 /* 8-bit ECC calculation by GPMC, Error detection by ELM */ 33 OMAP_ECC_BCH8_CODE_HW, 34 /* 16-bit ECC calculation by GPMC, Error detection by ELM */ 35 OMAP_ECC_BCH16_CODE_HW, 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; 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]; 55 void __iomem *gpmc_bch_result4[GPMC_BCH_NUM_REMAINDER]; 56 void __iomem *gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER]; 57 void __iomem *gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER]; 58 }; 59 60 struct omap_nand_platform_data { 61 int cs; 62 struct mtd_partition *parts; 63 int nr_parts; 64 bool dev_ready; 65 enum nand_io xfer_type; 66 int devsize; 67 enum omap_ecc ecc_opt; 68 struct gpmc_nand_regs reg; 69 70 /* for passing the partitions */ 71 struct device_node *of_node; 72 struct device_node *elm_of_node; 73 }; 74 #endif 75