Skip to content

Commit 27c9fd6

Browse files
pekonguptacomputersforpeace
authored andcommitted
mtd: nand: omap: add support for BCH16_ECC - GPMC driver updates
This patch add support for BCH16_ECC in GPMC (controller) driver: - extends configuration space to include BCH16 registers - extends parsing of DT binding for selecting BCH16 ecc-scheme Signed-off-by: Pekon Gupta <pekon@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
1 parent 4007e2d commit 27c9fd6

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

arch/arm/mach-omap2/gpmc.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@
6868
#define GPMC_ECC_BCH_RESULT_1 0x244 /* not available on OMAP2 */
6969
#define GPMC_ECC_BCH_RESULT_2 0x248 /* not available on OMAP2 */
7070
#define GPMC_ECC_BCH_RESULT_3 0x24c /* not available on OMAP2 */
71+
#define GPMC_ECC_BCH_RESULT_4 0x300 /* not available on OMAP2 */
72+
#define GPMC_ECC_BCH_RESULT_5 0x304 /* not available on OMAP2 */
73+
#define GPMC_ECC_BCH_RESULT_6 0x308 /* not available on OMAP2 */
7174

7275
/* GPMC ECC control settings */
7376
#define GPMC_ECC_CTRL_ECCCLEAR 0x100
@@ -666,6 +669,12 @@ void gpmc_update_nand_reg(struct gpmc_nand_regs *reg, int cs)
666669
GPMC_BCH_SIZE * i;
667670
reg->gpmc_bch_result3[i] = gpmc_base + GPMC_ECC_BCH_RESULT_3 +
668671
GPMC_BCH_SIZE * i;
672+
reg->gpmc_bch_result4[i] = gpmc_base + GPMC_ECC_BCH_RESULT_4 +
673+
i * GPMC_BCH_SIZE;
674+
reg->gpmc_bch_result5[i] = gpmc_base + GPMC_ECC_BCH_RESULT_5 +
675+
i * GPMC_BCH_SIZE;
676+
reg->gpmc_bch_result6[i] = gpmc_base + GPMC_ECC_BCH_RESULT_6 +
677+
i * GPMC_BCH_SIZE;
669678
}
670679
}
671680

@@ -1401,6 +1410,12 @@ static int gpmc_probe_nand_child(struct platform_device *pdev,
14011410
else
14021411
gpmc_nand_data->ecc_opt =
14031412
OMAP_ECC_BCH8_CODE_HW_DETECTION_SW;
1413+
else if (!strcmp(s, "bch16"))
1414+
if (gpmc_nand_data->elm_of_node)
1415+
gpmc_nand_data->ecc_opt =
1416+
OMAP_ECC_BCH16_CODE_HW;
1417+
else
1418+
pr_err("%s: BCH16 requires ELM support\n", __func__);
14041419
else
14051420
pr_err("%s: ti,nand-ecc-opt invalid value\n", __func__);
14061421

include/linux/platform_data/mtd-nand-omap2.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ enum omap_ecc {
3131
OMAP_ECC_BCH8_CODE_HW_DETECTION_SW,
3232
/* 8-bit ECC calculation by GPMC, Error detection by ELM */
3333
OMAP_ECC_BCH8_CODE_HW,
34+
/* 16-bit ECC calculation by GPMC, Error detection by ELM */
35+
OMAP_ECC_BCH16_CODE_HW,
3436
};
3537

3638
struct gpmc_nand_regs {
@@ -50,6 +52,9 @@ struct gpmc_nand_regs {
5052
void __iomem *gpmc_bch_result1[GPMC_BCH_NUM_REMAINDER];
5153
void __iomem *gpmc_bch_result2[GPMC_BCH_NUM_REMAINDER];
5254
void __iomem *gpmc_bch_result3[GPMC_BCH_NUM_REMAINDER];
55+
void __iomem *gpmc_bch_result4[GPMC_BCH_NUM_REMAINDER];
56+
void __iomem *gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER];
57+
void __iomem *gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER];
5358
};
5459

5560
struct omap_nand_platform_data {

0 commit comments

Comments
 (0)