aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAfzal Mohammed <afzal@ti.com>2012-09-30 17:17:28 -0400
committerAfzal Mohammed <afzal@ti.com>2012-10-15 05:12:08 -0400
commit3852ccd66a9bcb2aa6f46bce5442b6d8d08e5b5d (patch)
tree194b7067ba84e37560631fb85f7e0f3a0f3080d6
parent47f88af4ed80ac9ca593543e21ebf86a31d7e8ba (diff)
ARM: OMAP2+: nand: bch capability check
Capability of bch schemes could be discovered using soc revision checks. If soc revision indicates that selected ecc scheme is not supported bail out. Signed-off-by: Afzal Mohammed <afzal@ti.com>
-rw-r--r--arch/arm/mach-omap2/gpmc-nand.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c
index abdb78a95a94..e89a36c8143b 100644
--- a/arch/arm/mach-omap2/gpmc-nand.c
+++ b/arch/arm/mach-omap2/gpmc-nand.c
@@ -90,6 +90,27 @@ static int omap2_nand_gpmc_retime(
90 return 0; 90 return 0;
91} 91}
92 92
93static bool __init gpmc_hwecc_bch_capable(enum omap_ecc ecc_opt)
94{
95 /* support only OMAP3 class */
96 if (!cpu_is_omap34xx()) {
97 pr_err("BCH ecc is not supported on this CPU\n");
98 return 0;
99 }
100
101 /*
102 * For now, assume 4-bit mode is only supported on OMAP3630 ES1.x, x>=1.
103 * Other chips may be added if confirmed to work.
104 */
105 if ((ecc_opt == OMAP_ECC_BCH4_CODE_HW) &&
106 (!cpu_is_omap3630() || (GET_OMAP_REVISION() == 0))) {
107 pr_err("BCH 4-bit mode is not supported on this CPU\n");
108 return 0;
109 }
110
111 return 1;
112}
113
93int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data, 114int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
94 struct gpmc_timings *gpmc_t) 115 struct gpmc_timings *gpmc_t)
95{ 116{
@@ -128,6 +149,9 @@ int __init gpmc_nand_init(struct omap_nand_platform_data *gpmc_nand_data,
128 149
129 gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs); 150 gpmc_update_nand_reg(&gpmc_nand_data->reg, gpmc_nand_data->cs);
130 151
152 if (!gpmc_hwecc_bch_capable(gpmc_nand_data->ecc_opt))
153 return -EINVAL;
154
131 err = platform_device_register(&gpmc_nand_device); 155 err = platform_device_register(&gpmc_nand_device);
132 if (err < 0) { 156 if (err < 0) {
133 dev_err(dev, "Unable to register NAND device\n"); 157 dev_err(dev, "Unable to register NAND device\n");