blob: 3e9dd6676b9799aba4999d422a624f9a3a991b44 [file] [log] [blame]
Russell Kinga09e64f2008-08-05 16:14:15 +01001/*
Russell Kinga09e64f2008-08-05 16:14:15 +01002 * 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 Mohammedbc3668e2012-09-29 12:26:13 +05309#ifndef _MTD_NAND_OMAP2_H
10#define _MTD_NAND_OMAP2_H
11
Russell Kinga09e64f2008-08-05 16:14:15 +010012#include <linux/mtd/partitions.h>
13
Afzal Mohammed2fdf0c92012-10-04 15:49:04 +053014#define GPMC_BCH_NUM_REMAINDER 8
15
Sukumar Ghorai1b0b323c2011-01-28 15:42:04 +053016enum nand_io {
17 NAND_OMAP_PREFETCH_POLLED = 0, /* prefetch polled mode, default */
18 NAND_OMAP_POLLED, /* polled mode, without prefetch */
Sukumar Ghorai4e070372011-01-28 15:42:06 +053019 NAND_OMAP_PREFETCH_DMA, /* prefetch enabled sDMA mode */
20 NAND_OMAP_PREFETCH_IRQ /* prefetch enabled irq mode */
Sukumar Ghorai1b0b323c2011-01-28 15:42:04 +053021};
22
Afzal Mohammedbc3668e2012-09-29 12:26:13 +053023enum omap_ecc {
Pekon Guptaac65caf52013-10-24 18:20:17 +053024 /* 1-bit ECC calculation by GPMC, Error detection by Software */
Pekon Guptac66d0392013-10-24 18:20:18 +053025 OMAP_ECC_HAM1_CODE_HW = 0,
Pekon Guptaac65caf52013-10-24 18:20:17 +053026 /* 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,
Afzal Mohammedbc3668e2012-09-29 12:26:13 +053034};
35
36struct gpmc_nand_regs {
37 void __iomem *gpmc_status;
38 void __iomem *gpmc_nand_command;
39 void __iomem *gpmc_nand_address;
40 void __iomem *gpmc_nand_data;
41 void __iomem *gpmc_prefetch_config1;
42 void __iomem *gpmc_prefetch_config2;
43 void __iomem *gpmc_prefetch_control;
44 void __iomem *gpmc_prefetch_status;
45 void __iomem *gpmc_ecc_config;
46 void __iomem *gpmc_ecc_control;
47 void __iomem *gpmc_ecc_size_config;
48 void __iomem *gpmc_ecc1_result;
Afzal Mohammed2fdf0c92012-10-04 15:49:04 +053049 void __iomem *gpmc_bch_result0[GPMC_BCH_NUM_REMAINDER];
50 void __iomem *gpmc_bch_result1[GPMC_BCH_NUM_REMAINDER];
51 void __iomem *gpmc_bch_result2[GPMC_BCH_NUM_REMAINDER];
52 void __iomem *gpmc_bch_result3[GPMC_BCH_NUM_REMAINDER];
Afzal Mohammedbc3668e2012-09-29 12:26:13 +053053};
54
Russell Kinga09e64f2008-08-05 16:14:15 +010055struct omap_nand_platform_data {
Russell Kinga09e64f2008-08-05 16:14:15 +010056 int cs;
Russell Kinga09e64f2008-08-05 16:14:15 +010057 struct mtd_partition *parts;
58 int nr_parts;
Grazvydas Ignotas7a559c72011-06-03 19:56:33 +000059 bool dev_ready;
Sukumar Ghorai1b0b323c2011-01-28 15:42:04 +053060 enum nand_io xfer_type;
Vimal Singh2f70a1e2010-02-15 10:03:33 -080061 int devsize;
Sukumar Ghoraif3d73f32011-01-28 15:42:08 +053062 enum omap_ecc ecc_opt;
Afzal Mohammedd126d012012-08-30 12:53:22 -070063 struct gpmc_nand_regs reg;
Vimal Singh2f70a1e2010-02-15 10:03:33 -080064
Daniel Mackccf04c52012-12-14 11:36:41 +010065 /* for passing the partitions */
66 struct device_node *of_node;
Pekon Guptaac65caf52013-10-24 18:20:17 +053067 struct device_node *elm_of_node;
Daniel Mackccf04c52012-12-14 11:36:41 +010068};
stanley.miao562468b2010-04-20 06:33:26 +000069#endif