aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorPekon Gupta <pekon@ti.com>2014-02-05 08:28:30 -0500
committerTony Lindgren <tony@atomide.com>2014-03-02 13:15:52 -0500
commit0611c41934ab35ce84dea34ab291897ad3cbc7be (patch)
tree2183257d9f406f1f15e402a622b8a0aa2b9882c2 /arch/arm
parent24d0bb8861f3d97af7e56b6615516872e9e61abf (diff)
ARM: OMAP2+: gpmc: update gpmc_hwecc_bch_capable() for new platforms and ECC schemes
This patch - refactors gpmc_hwecc_bch_capable() - add checks for new platforms like dra7xx, am43xx - add checks for OMAP3 SoC, w.r.t. new ECC schemes spawned in following commit: commit ac65caf514ec3e55e8d3d510ee37f80dd97418fe ARM: OMAP2+: cleaned-up DT support of various ECC schemes Signed-off-by: Pekon Gupta <pekon@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-omap2/gpmc-nand.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c
index 174caecc3186..4349e82debfe 100644
--- a/arch/arm/mach-omap2/gpmc-nand.c
+++ b/arch/arm/mach-omap2/gpmc-nand.c
@@ -45,24 +45,31 @@ static struct platform_device gpmc_nand_device = {
45 45
46static bool gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt) 46static bool gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt)
47{ 47{
48 /* support only OMAP3 class */ 48 /* platforms which support all ECC schemes */
49 if (!cpu_is_omap34xx() && !soc_is_am33xx()) { 49 if (soc_is_am33xx() || cpu_is_omap44xx() ||
50 pr_err("BCH ecc is not supported on this CPU\n"); 50 soc_is_omap54xx() || soc_is_dra7xx())
51 return 1;
52
53 /* OMAP3xxx do not have ELM engine, so cannot support ECC schemes
54 * which require H/W based ECC error detection */
55 if ((cpu_is_omap34xx() || cpu_is_omap3630()) &&
56 ((ecc_opt == OMAP_ECC_BCH4_CODE_HW) ||
57 (ecc_opt == OMAP_ECC_BCH8_CODE_HW)))
51 return 0; 58 return 0;
52 }
53 59
54 /* 60 /*
55 * For now, assume 4-bit mode is only supported on OMAP3630 ES1.x, x>=1 61 * For now, assume 4-bit mode is only supported on OMAP3630 ES1.x, x>=1
56 * and AM33xx derivates. Other chips may be added if confirmed to work. 62 * and AM33xx derivates. Other chips may be added if confirmed to work.
57 */ 63 */
58 if ((ecc_opt == OMAP_ECC_BCH4_CODE_HW) && 64 if ((ecc_opt == OMAP_ECC_BCH4_CODE_HW_DETECTION_SW) &&
59 (!cpu_is_omap3630() || (GET_OMAP_REVISION() == 0)) && 65 (!cpu_is_omap3630() || (GET_OMAP_REVISION() == 0)))
60 (!soc_is_am33xx())) {
61 pr_err("BCH 4-bit mode is not supported on this CPU\n");
62 return 0; 66 return 0;
63 }
64 67
65 return 1; 68 /* legacy platforms support only HAM1 (1-bit Hamming) ECC scheme */
69 if (ecc_opt == OMAP_ECC_HAM1_CODE_HW)
70 return 1;
71 else
72 return 0;
66} 73}
67 74
68/* This function will go away once the device-tree convertion is complete */ 75/* This function will go away once the device-tree convertion is complete */
@@ -133,8 +140,10 @@ int gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
133 140
134 gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs); 141 gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs);
135 142
136 if (!gpmc_hwecc_bch_capable(gpmc_nand_data->ecc_opt)) 143 if (!gpmc_hwecc_bch_capable(gpmc_nand_data->ecc_opt)) {
144 dev_err(dev, "Unsupported NAND ECC scheme selected\n");
137 return -EINVAL; 145 return -EINVAL;
146 }
138 147
139 err = platform_device_register(&gpmc_nand_device); 148 err = platform_device_register(&gpmc_nand_device);
140 if (err < 0) { 149 if (err < 0) {