Roger, >From: Quadros, Roger >Don't access the ECC/BCH engine registers directly as they belong >to the GPMC controller's register space. Use the relevant >GPMC APIs instead. > >Signed-off-by: Roger Quadros <rogerq@xxxxxx> >--- > drivers/mtd/nand/omap2.c | 191 +++++++++++++++++++---------------------------- > 1 file changed, 76 insertions(+), 115 deletions(-) > >diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c >index 420ef0b..6b0f953 100644 >--- a/drivers/mtd/nand/omap2.c >+++ b/drivers/mtd/nand/omap2.c >@@ -1123,71 +1088,67 @@ static int __maybe_unused omap_calculate_ecc_bch(struct mtd_info >*mtd, > switch (info->ecc_opt) { > case OMAP_ECC_BCH8_CODE_HW_DETECTION_SW: > case OMAP_ECC_BCH8_CODE_HW: >- bch_val1 = readl(gpmc_regs->gpmc_bch_result0[i]); >- bch_val2 = readl(gpmc_regs->gpmc_bch_result1[i]); >- bch_val3 = readl(gpmc_regs->gpmc_bch_result2[i]); >- bch_val4 = readl(gpmc_regs->gpmc_bch_result3[i]); >- *ecc_code++ = (bch_val4 & 0xFF); >- *ecc_code++ = ((bch_val3 >> 24) & 0xFF); >- *ecc_code++ = ((bch_val3 >> 16) & 0xFF); >- *ecc_code++ = ((bch_val3 >> 8) & 0xFF); >- *ecc_code++ = (bch_val3 & 0xFF); >- *ecc_code++ = ((bch_val2 >> 24) & 0xFF); >- *ecc_code++ = ((bch_val2 >> 16) & 0xFF); >- *ecc_code++ = ((bch_val2 >> 8) & 0xFF); >- *ecc_code++ = (bch_val2 & 0xFF); >- *ecc_code++ = ((bch_val1 >> 24) & 0xFF); >- *ecc_code++ = ((bch_val1 >> 16) & 0xFF); >- *ecc_code++ = ((bch_val1 >> 8) & 0xFF); >- *ecc_code++ = (bch_val1 & 0xFF); >+ omap_gpmc_ecc_get_bch_result(4, i, bch_val); >+ *ecc_code++ = (bch_val[3] & 0xFF); >+ *ecc_code++ = ((bch_val[2] >> 24) & 0xFF); >+ *ecc_code++ = ((bch_val[2] >> 16) & 0xFF); >+ *ecc_code++ = ((bch_val[2] >> 8) & 0xFF); >+ *ecc_code++ = (bch_val[2] & 0xFF); >+ *ecc_code++ = ((bch_val[1] >> 24) & 0xFF); >+ *ecc_code++ = ((bch_val[1] >> 16) & 0xFF); >+ *ecc_code++ = ((bch_val[1] >> 8) & 0xFF); >+ *ecc_code++ = (bch_val[1] & 0xFF); >+ *ecc_code++ = ((bch_val[0] >> 24) & 0xFF); >+ *ecc_code++ = ((bch_val[0] >> 16) & 0xFF); >+ *ecc_code++ = ((bch_val[0] >> 8) & 0xFF); >+ *ecc_code++ = (bch_val[0] & 0xFF); > break; > case OMAP_ECC_BCH4_CODE_HW_DETECTION_SW: > case OMAP_ECC_BCH4_CODE_HW: >- bch_val1 = readl(gpmc_regs->gpmc_bch_result0[i]); >- bch_val2 = readl(gpmc_regs->gpmc_bch_result1[i]); >- *ecc_code++ = ((bch_val2 >> 12) & 0xFF); >- *ecc_code++ = ((bch_val2 >> 4) & 0xFF); >- *ecc_code++ = ((bch_val2 & 0xF) << 4) | >- ((bch_val1 >> 28) & 0xF); >- *ecc_code++ = ((bch_val1 >> 20) & 0xFF); >- *ecc_code++ = ((bch_val1 >> 12) & 0xFF); >- *ecc_code++ = ((bch_val1 >> 4) & 0xFF); >- *ecc_code++ = ((bch_val1 & 0xF) << 4); >+ omap_gpmc_ecc_get_bch_result(2, i, bch_val); >+ *ecc_code++ = ((bch_val[1] >> 12) & 0xFF); >+ *ecc_code++ = ((bch_val[1] >> 4) & 0xFF); >+ *ecc_code++ = ((bch_val[1] & 0xF) << 4) | >+ ((bch_val[0] >> 28) & 0xF); >+ *ecc_code++ = ((bch_val[0] >> 20) & 0xFF); >+ *ecc_code++ = ((bch_val[0] >> 12) & 0xFF); >+ *ecc_code++ = ((bch_val[0] >> 4) & 0xFF); >+ *ecc_code++ = ((bch_val[0] & 0xF) << 4); > break; > case OMAP_ECC_BCH16_CODE_HW: >- val = readl(gpmc_regs->gpmc_bch_result6[i]); >- ecc_code[0] = ((val >> 8) & 0xFF); >- ecc_code[1] = ((val >> 0) & 0xFF); >- val = readl(gpmc_regs->gpmc_bch_result5[i]); >- ecc_code[2] = ((val >> 24) & 0xFF); >- ecc_code[3] = ((val >> 16) & 0xFF); >- ecc_code[4] = ((val >> 8) & 0xFF); >- ecc_code[5] = ((val >> 0) & 0xFF); >- val = readl(gpmc_regs->gpmc_bch_result4[i]); >- ecc_code[6] = ((val >> 24) & 0xFF); >- ecc_code[7] = ((val >> 16) & 0xFF); >- ecc_code[8] = ((val >> 8) & 0xFF); >- ecc_code[9] = ((val >> 0) & 0xFF); >- val = readl(gpmc_regs->gpmc_bch_result3[i]); >- ecc_code[10] = ((val >> 24) & 0xFF); >- ecc_code[11] = ((val >> 16) & 0xFF); >- ecc_code[12] = ((val >> 8) & 0xFF); >- ecc_code[13] = ((val >> 0) & 0xFF); >- val = readl(gpmc_regs->gpmc_bch_result2[i]); >- ecc_code[14] = ((val >> 24) & 0xFF); >- ecc_code[15] = ((val >> 16) & 0xFF); >- ecc_code[16] = ((val >> 8) & 0xFF); >- ecc_code[17] = ((val >> 0) & 0xFF); >- val = readl(gpmc_regs->gpmc_bch_result1[i]); >- ecc_code[18] = ((val >> 24) & 0xFF); >- ecc_code[19] = ((val >> 16) & 0xFF); >- ecc_code[20] = ((val >> 8) & 0xFF); >- ecc_code[21] = ((val >> 0) & 0xFF); >- val = readl(gpmc_regs->gpmc_bch_result0[i]); >- ecc_code[22] = ((val >> 24) & 0xFF); >- ecc_code[23] = ((val >> 16) & 0xFF); >- ecc_code[24] = ((val >> 8) & 0xFF); >- ecc_code[25] = ((val >> 0) & 0xFF); >+ omap_gpmc_ecc_get_bch_result(7, i, bch_val); >+ ecc_code[0] = ((bch_val[6] >> 8) & 0xFF); >+ ecc_code[1] = ((bch_val[6] >> 0) & 0xFF); >+ >+ ecc_code[2] = ((bch_val[5] >> 24) & 0xFF); >+ ecc_code[3] = ((bch_val[5] >> 16) & 0xFF); >+ ecc_code[4] = ((bch_val[5] >> 8) & 0xFF); >+ ecc_code[5] = ((bch_val[5] >> 0) & 0xFF); >+ >+ ecc_code[6] = ((bch_val[4] >> 24) & 0xFF); >+ ecc_code[7] = ((bch_val[4] >> 16) & 0xFF); >+ ecc_code[8] = ((bch_val[4] >> 8) & 0xFF); >+ ecc_code[9] = ((bch_val[4] >> 0) & 0xFF); >+ >+ ecc_code[10] = ((bch_val[3] >> 24) & 0xFF); >+ ecc_code[11] = ((bch_val[3] >> 16) & 0xFF); >+ ecc_code[12] = ((bch_val[3] >> 8) & 0xFF); >+ ecc_code[13] = ((bch_val[3] >> 0) & 0xFF); >+ >+ ecc_code[14] = ((bch_val[2] >> 24) & 0xFF); >+ ecc_code[15] = ((bch_val[2] >> 16) & 0xFF); >+ ecc_code[16] = ((bch_val[2] >> 8) & 0xFF); >+ ecc_code[17] = ((bch_val[2] >> 0) & 0xFF); >+ >+ ecc_code[18] = ((bch_val[1] >> 24) & 0xFF); >+ ecc_code[19] = ((bch_val[1] >> 16) & 0xFF); >+ ecc_code[20] = ((bch_val[1] >> 8) & 0xFF); >+ ecc_code[21] = ((bch_val[1] >> 0) & 0xFF); >+ >+ ecc_code[22] = ((bch_val[0] >> 24) & 0xFF); >+ ecc_code[23] = ((bch_val[0] >> 16) & 0xFF); >+ ecc_code[24] = ((bch_val[0] >> 8) & 0xFF); >+ ecc_code[25] = ((bch_val[0] >> 0) & 0xFF); > break; > default: > return -EINVAL; >-- >1.8.3.2 Again same feedback. You won't need all these changes, if you move this function completely into GPMC driver, leaving only the wrapper here which make the GPMC function compatible to chip->ecc.calculate. with regards, pekon -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html