blob: e4128f1510bf4cafa2293a9fa4c1ff36195be0b4 [file] [log] [blame]
Russell Kinga09e64f2008-08-05 16:14:15 +01001/*
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 Mohammedbc3668e2012-09-29 12:26:13 +053011#ifndef _MTD_NAND_OMAP2_H
12#define _MTD_NAND_OMAP2_H
13
Russell Kinga09e64f2008-08-05 16:14:15 +010014#include <linux/mtd/partitions.h>
15
Afzal Mohammed2fdf0c92012-10-04 15:49:04 +053016#define GPMC_BCH_NUM_REMAINDER 8
17
Sukumar Ghorai1b0b323c2011-01-28 15:42:04 +053018enum nand_io {
19 NAND_OMAP_PREFETCH_POLLED = 0, /* prefetch polled mode, default */
20 NAND_OMAP_POLLED, /* polled mode, without prefetch */
Sukumar Ghorai4e070372011-01-28 15:42:06 +053021 NAND_OMAP_PREFETCH_DMA, /* prefetch enabled sDMA mode */
22 NAND_OMAP_PREFETCH_IRQ /* prefetch enabled irq mode */
Sukumar Ghorai1b0b323c2011-01-28 15:42:04 +053023};
24
Afzal Mohammedbc3668e2012-09-29 12:26:13 +053025enum omap_ecc {
26 /* 1-bit ecc: stored at end of spare area */
27 OMAP_ECC_HAMMING_CODE_DEFAULT = 0, /* Default, s/w method */
28 OMAP_ECC_HAMMING_CODE_HW, /* gpmc to detect the error */
29 /* 1-bit ecc: stored at beginning of spare area as romcode */
30 OMAP_ECC_HAMMING_CODE_HW_ROMCODE, /* gpmc method & romcode layout */
Pekon Guptaac65caf52013-10-24 18:20:17 +053031 /* 1-bit ECC calculation by GPMC, Error detection by Software */
32 OMAP_ECC_HAM1_CODE_HW,
33 /* 4-bit ECC calculation by GPMC, Error detection by Software */
34 OMAP_ECC_BCH4_CODE_HW_DETECTION_SW,
35 /* 4-bit ECC calculation by GPMC, Error detection by ELM */
36 OMAP_ECC_BCH4_CODE_HW,
37 /* 8-bit ECC calculation by GPMC, Error detection by Software */
38 OMAP_ECC_BCH8_CODE_HW_DETECTION_SW,
39 /* 8-bit ECC calculation by GPMC, Error detection by ELM */
40 OMAP_ECC_BCH8_CODE_HW,
Afzal Mohammedbc3668e2012-09-29 12:26:13 +053041};
42
43struct gpmc_nand_regs {
44 void __iomem *gpmc_status;
45 void __iomem *gpmc_nand_command;
46 void __iomem *gpmc_nand_address;
47 void __iomem *gpmc_nand_data;
48 void __iomem *gpmc_prefetch_config1;
49 void __iomem *gpmc_prefetch_config2;
50 void __iomem *gpmc_prefetch_control;
51 void __iomem *gpmc_prefetch_status;
52 void __iomem *gpmc_ecc_config;
53 void __iomem *gpmc_ecc_control;
54 void __iomem *gpmc_ecc_size_config;
55 void __iomem *gpmc_ecc1_result;
Afzal Mohammed2fdf0c92012-10-04 15:49:04 +053056 void __iomem *gpmc_bch_result0[GPMC_BCH_NUM_REMAINDER];
57 void __iomem *gpmc_bch_result1[GPMC_BCH_NUM_REMAINDER];
58 void __iomem *gpmc_bch_result2[GPMC_BCH_NUM_REMAINDER];
59 void __iomem *gpmc_bch_result3[GPMC_BCH_NUM_REMAINDER];
Afzal Mohammedbc3668e2012-09-29 12:26:13 +053060};
61
Russell Kinga09e64f2008-08-05 16:14:15 +010062struct omap_nand_platform_data {
Russell Kinga09e64f2008-08-05 16:14:15 +010063 int cs;
Russell Kinga09e64f2008-08-05 16:14:15 +010064 struct mtd_partition *parts;
65 int nr_parts;
Grazvydas Ignotas7a559c72011-06-03 19:56:33 +000066 bool dev_ready;
Sukumar Ghorai1b0b323c2011-01-28 15:42:04 +053067 enum nand_io xfer_type;
Vimal Singh2f70a1e2010-02-15 10:03:33 -080068 int devsize;
Sukumar Ghoraif3d73f32011-01-28 15:42:08 +053069 enum omap_ecc ecc_opt;
Afzal Mohammedd126d012012-08-30 12:53:22 -070070 struct gpmc_nand_regs reg;
Vimal Singh2f70a1e2010-02-15 10:03:33 -080071
Daniel Mackccf04c52012-12-14 11:36:41 +010072 /* for passing the partitions */
73 struct device_node *of_node;
Pekon Guptaac65caf52013-10-24 18:20:17 +053074 struct device_node *elm_of_node;
Daniel Mackccf04c52012-12-14 11:36:41 +010075};
stanley.miao562468b2010-04-20 06:33:26 +000076#endif