blob: 16ec262dfcc804a567910dad83bb3edbe72bdc74 [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 {
Roger Quadros7d5929c2014-08-25 16:15:32 -070024 /*
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 Guptaac65caf2013-10-24 18:20:17 +053035 /* 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 gupta27c9fd62014-05-19 13:24:39 +053043 /* 16-bit ECC calculation by GPMC, Error detection by ELM */
44 OMAP_ECC_BCH16_CODE_HW,
Afzal Mohammedbc3668e2012-09-29 12:26:13 +053045};
46
47struct 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 Mohammed2fdf0c92012-10-04 15:49:04 +053060 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 gupta27c9fd62014-05-19 13:24:39 +053064 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 Mohammedbc3668e2012-09-29 12:26:13 +053067};
68
Russell Kinga09e64f2008-08-05 16:14:15 +010069struct omap_nand_platform_data {
Russell Kinga09e64f2008-08-05 16:14:15 +010070 int cs;
Russell Kinga09e64f2008-08-05 16:14:15 +010071 struct mtd_partition *parts;
72 int nr_parts;
Grazvydas Ignotas7a559c72011-06-03 19:56:33 +000073 bool dev_ready;
Sukumar Ghorai1b0b323c2011-01-28 15:42:04 +053074 enum nand_io xfer_type;
Vimal Singh2f70a1e2010-02-15 10:03:33 -080075 int devsize;
Sukumar Ghoraif3d73f32011-01-28 15:42:08 +053076 enum omap_ecc ecc_opt;
Afzal Mohammedd126d012012-08-30 12:53:22 -070077 struct gpmc_nand_regs reg;
Vimal Singh2f70a1e2010-02-15 10:03:33 -080078
Daniel Mackccf04c52012-12-14 11:36:41 +010079 /* for passing the partitions */
80 struct device_node *of_node;
Pekon Guptaac65caf2013-10-24 18:20:17 +053081 struct device_node *elm_of_node;
Daniel Mackccf04c52012-12-14 11:36:41 +010082};
stanley.miao562468b2010-04-20 06:33:26 +000083#endif