2007-12-12 05:50:17 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2006 Micron Technology Inc.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
2012-09-29 14:56:13 +08:00
|
|
|
#ifndef _MTD_NAND_OMAP2_H
|
|
|
|
#define _MTD_NAND_OMAP2_H
|
|
|
|
|
2007-12-12 05:50:17 +08:00
|
|
|
#include <linux/mtd/partitions.h>
|
|
|
|
|
2012-10-04 18:19:04 +08:00
|
|
|
#define GPMC_BCH_NUM_REMAINDER 8
|
|
|
|
|
2011-01-28 18:12:04 +08:00
|
|
|
enum nand_io {
|
|
|
|
NAND_OMAP_PREFETCH_POLLED = 0, /* prefetch polled mode, default */
|
|
|
|
NAND_OMAP_POLLED, /* polled mode, without prefetch */
|
2011-01-28 18:12:06 +08:00
|
|
|
NAND_OMAP_PREFETCH_DMA, /* prefetch enabled sDMA mode */
|
|
|
|
NAND_OMAP_PREFETCH_IRQ /* prefetch enabled irq mode */
|
2011-01-28 18:12:04 +08:00
|
|
|
};
|
|
|
|
|
2012-09-29 14:56:13 +08:00
|
|
|
enum omap_ecc {
|
ARM: OMAP2+: cleaned-up DT support of various ECC schemes
OMAP NAND driver support multiple ECC scheme, which can used in different
flavours, depending on in-build Hardware engines present on SoC.
This patch updates following in DT bindings related to sectionion of ecc-schemes
- ti,elm-id: replaces elm_id (maintains backward compatibility)
- ti,nand-ecc-opts: selection of h/w or s/w implementation of an ecc-scheme
depends on ti,elm-id. (supported values ham1, bch4, and bch8)
- maintain backward compatibility to deprecated DT bindings (sw, hw, hw-romcode)
Below table shows different flavours of ecc-schemes supported by OMAP devices
+---------------------------------------+---------------+---------------+
| ECC scheme |ECC calculation|Error detection|
+---------------------------------------+---------------+---------------+
|OMAP_ECC_HAM1_CODE_HW |H/W (GPMC) |S/W |
+---------------------------------------+---------------+---------------+
|OMAP_ECC_BCH8_CODE_HW_DETECTION_SW |H/W (GPMC) |S/W |
|(requires CONFIG_MTD_NAND_ECC_BCH) | | |
+---------------------------------------+---------------+---------------+
|OMAP_ECC_BCH8_CODE_HW |H/W (GPMC) |H/W (ELM) |
|(requires CONFIG_MTD_NAND_OMAP_BCH && | | |
| ti,elm-id in DT) | | |
+---------------------------------------+---------------+---------------+
To optimize footprint of omap2-nand driver, selection of some ECC schemes
also require enabling following Kconfigs, in addition to setting appropriate
DT bindings
- Kconfig:CONFIG_MTD_NAND_ECC_BCH error detection done in software
- Kconfig:CONFIG_MTD_NAND_OMAP_BCH error detection done by h/w engine
Signed-off-by: Pekon Gupta <pekon@ti.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-24 20:50:17 +08:00
|
|
|
/* 1-bit ECC calculation by GPMC, Error detection by Software */
|
2013-10-24 20:50:18 +08:00
|
|
|
OMAP_ECC_HAM1_CODE_HW = 0,
|
ARM: OMAP2+: cleaned-up DT support of various ECC schemes
OMAP NAND driver support multiple ECC scheme, which can used in different
flavours, depending on in-build Hardware engines present on SoC.
This patch updates following in DT bindings related to sectionion of ecc-schemes
- ti,elm-id: replaces elm_id (maintains backward compatibility)
- ti,nand-ecc-opts: selection of h/w or s/w implementation of an ecc-scheme
depends on ti,elm-id. (supported values ham1, bch4, and bch8)
- maintain backward compatibility to deprecated DT bindings (sw, hw, hw-romcode)
Below table shows different flavours of ecc-schemes supported by OMAP devices
+---------------------------------------+---------------+---------------+
| ECC scheme |ECC calculation|Error detection|
+---------------------------------------+---------------+---------------+
|OMAP_ECC_HAM1_CODE_HW |H/W (GPMC) |S/W |
+---------------------------------------+---------------+---------------+
|OMAP_ECC_BCH8_CODE_HW_DETECTION_SW |H/W (GPMC) |S/W |
|(requires CONFIG_MTD_NAND_ECC_BCH) | | |
+---------------------------------------+---------------+---------------+
|OMAP_ECC_BCH8_CODE_HW |H/W (GPMC) |H/W (ELM) |
|(requires CONFIG_MTD_NAND_OMAP_BCH && | | |
| ti,elm-id in DT) | | |
+---------------------------------------+---------------+---------------+
To optimize footprint of omap2-nand driver, selection of some ECC schemes
also require enabling following Kconfigs, in addition to setting appropriate
DT bindings
- Kconfig:CONFIG_MTD_NAND_ECC_BCH error detection done in software
- Kconfig:CONFIG_MTD_NAND_OMAP_BCH error detection done by h/w engine
Signed-off-by: Pekon Gupta <pekon@ti.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-24 20:50:17 +08:00
|
|
|
/* 4-bit ECC calculation by GPMC, Error detection by Software */
|
|
|
|
OMAP_ECC_BCH4_CODE_HW_DETECTION_SW,
|
|
|
|
/* 4-bit ECC calculation by GPMC, Error detection by ELM */
|
|
|
|
OMAP_ECC_BCH4_CODE_HW,
|
|
|
|
/* 8-bit ECC calculation by GPMC, Error detection by Software */
|
|
|
|
OMAP_ECC_BCH8_CODE_HW_DETECTION_SW,
|
|
|
|
/* 8-bit ECC calculation by GPMC, Error detection by ELM */
|
|
|
|
OMAP_ECC_BCH8_CODE_HW,
|
2014-05-19 15:54:39 +08:00
|
|
|
/* 16-bit ECC calculation by GPMC, Error detection by ELM */
|
|
|
|
OMAP_ECC_BCH16_CODE_HW,
|
2012-09-29 14:56:13 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct gpmc_nand_regs {
|
|
|
|
void __iomem *gpmc_status;
|
|
|
|
void __iomem *gpmc_nand_command;
|
|
|
|
void __iomem *gpmc_nand_address;
|
|
|
|
void __iomem *gpmc_nand_data;
|
|
|
|
void __iomem *gpmc_prefetch_config1;
|
|
|
|
void __iomem *gpmc_prefetch_config2;
|
|
|
|
void __iomem *gpmc_prefetch_control;
|
|
|
|
void __iomem *gpmc_prefetch_status;
|
|
|
|
void __iomem *gpmc_ecc_config;
|
|
|
|
void __iomem *gpmc_ecc_control;
|
|
|
|
void __iomem *gpmc_ecc_size_config;
|
|
|
|
void __iomem *gpmc_ecc1_result;
|
2012-10-04 18:19:04 +08:00
|
|
|
void __iomem *gpmc_bch_result0[GPMC_BCH_NUM_REMAINDER];
|
|
|
|
void __iomem *gpmc_bch_result1[GPMC_BCH_NUM_REMAINDER];
|
|
|
|
void __iomem *gpmc_bch_result2[GPMC_BCH_NUM_REMAINDER];
|
|
|
|
void __iomem *gpmc_bch_result3[GPMC_BCH_NUM_REMAINDER];
|
2014-05-19 15:54:39 +08:00
|
|
|
void __iomem *gpmc_bch_result4[GPMC_BCH_NUM_REMAINDER];
|
|
|
|
void __iomem *gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER];
|
|
|
|
void __iomem *gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER];
|
2012-09-29 14:56:13 +08:00
|
|
|
};
|
|
|
|
|
2007-12-12 05:50:17 +08:00
|
|
|
struct omap_nand_platform_data {
|
|
|
|
int cs;
|
|
|
|
struct mtd_partition *parts;
|
|
|
|
int nr_parts;
|
2011-06-04 03:56:33 +08:00
|
|
|
bool dev_ready;
|
2011-01-28 18:12:04 +08:00
|
|
|
enum nand_io xfer_type;
|
2010-02-16 02:03:33 +08:00
|
|
|
int devsize;
|
2011-01-28 18:12:08 +08:00
|
|
|
enum omap_ecc ecc_opt;
|
2012-08-31 03:53:22 +08:00
|
|
|
struct gpmc_nand_regs reg;
|
2010-02-16 02:03:33 +08:00
|
|
|
|
2012-12-14 18:36:41 +08:00
|
|
|
/* for passing the partitions */
|
|
|
|
struct device_node *of_node;
|
ARM: OMAP2+: cleaned-up DT support of various ECC schemes
OMAP NAND driver support multiple ECC scheme, which can used in different
flavours, depending on in-build Hardware engines present on SoC.
This patch updates following in DT bindings related to sectionion of ecc-schemes
- ti,elm-id: replaces elm_id (maintains backward compatibility)
- ti,nand-ecc-opts: selection of h/w or s/w implementation of an ecc-scheme
depends on ti,elm-id. (supported values ham1, bch4, and bch8)
- maintain backward compatibility to deprecated DT bindings (sw, hw, hw-romcode)
Below table shows different flavours of ecc-schemes supported by OMAP devices
+---------------------------------------+---------------+---------------+
| ECC scheme |ECC calculation|Error detection|
+---------------------------------------+---------------+---------------+
|OMAP_ECC_HAM1_CODE_HW |H/W (GPMC) |S/W |
+---------------------------------------+---------------+---------------+
|OMAP_ECC_BCH8_CODE_HW_DETECTION_SW |H/W (GPMC) |S/W |
|(requires CONFIG_MTD_NAND_ECC_BCH) | | |
+---------------------------------------+---------------+---------------+
|OMAP_ECC_BCH8_CODE_HW |H/W (GPMC) |H/W (ELM) |
|(requires CONFIG_MTD_NAND_OMAP_BCH && | | |
| ti,elm-id in DT) | | |
+---------------------------------------+---------------+---------------+
To optimize footprint of omap2-nand driver, selection of some ECC schemes
also require enabling following Kconfigs, in addition to setting appropriate
DT bindings
- Kconfig:CONFIG_MTD_NAND_ECC_BCH error detection done in software
- Kconfig:CONFIG_MTD_NAND_OMAP_BCH error detection done by h/w engine
Signed-off-by: Pekon Gupta <pekon@ti.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-10-24 20:50:17 +08:00
|
|
|
struct device_node *elm_of_node;
|
2012-12-14 18:36:41 +08:00
|
|
|
};
|
2010-04-20 14:33:26 +08:00
|
|
|
#endif
|