Commit b01b7e1d591de90be780449b26ff7e542dd545e9

Authored by Alice Guo
Committed by Ye Li
1 parent 0e90d90944

MLK-22582-1: nand: enable the Randomizer module for mx7 and mx8 when call

the function named mxs_nand_ecc_read_page

To enable the Randomizer module, set GPMI_ECCCTRL[RANDOMIZER_ENABLE] to
1, then set GPMI_ECCCOUNT[RANDOMIZER_PAGE] to select randomizer page
number needed to be randomized.

Signed-off-by: Alice Guo <alice.guo@nxp.com>
(cherry picked from commit e8271a1c7621cc3607d3e9c7b0a872342b5f4c95)

Showing 1 changed file with 8 additions and 2 deletions Side-by-side Diff

drivers/mtd/nand/raw/mxs_nand.c
... ... @@ -708,6 +708,12 @@
708 708 d->cmd.pio_words[4] = (dma_addr_t)nand_info->data_buf;
709 709 d->cmd.pio_words[5] = (dma_addr_t)nand_info->oob_buf;
710 710  
  711 + if ((is_mx7() || is_imx8m()) && nand_info->en_randomizer) {
  712 + d->cmd.pio_words[2] |= GPMI_ECCCTRL_RANDOMIZER_ENABLE |
  713 + GPMI_ECCCTRL_RANDOMIZER_TYPE2;
  714 + d->cmd.pio_words[3] |= (page % 256) << 16;
  715 + }
  716 +
711 717 mxs_dma_desc_append(channel, d);
712 718  
713 719 /* Compile the DMA descriptor - disable the BCH block. */
... ... @@ -859,7 +865,7 @@
859 865 d->cmd.pio_words[4] = (dma_addr_t)nand_info->data_buf;
860 866 d->cmd.pio_words[5] = (dma_addr_t)nand_info->oob_buf;
861 867  
862   - if ((is_mx7() && nand_info->en_randomizer) || (is_imx8m() && nand_info->en_randomizer)) {
  868 + if ((is_mx7() || is_imx8m()) && nand_info->en_randomizer) {
863 869 d->cmd.pio_words[2] |= GPMI_ECCCTRL_RANDOMIZER_ENABLE |
864 870 GPMI_ECCCTRL_RANDOMIZER_TYPE2;
865 871 /*
... ... @@ -869,7 +875,7 @@
869 875 * The value is between 0-255. For additional details
870 876 * check 9.6.6.4 of i.MX7D Applications Processor reference
871 877 */
872   - d->cmd.pio_words[3] |= (page % 255) << 16;
  878 + d->cmd.pio_words[3] |= (page % 256) << 16;
873 879 }
874 880  
875 881 mxs_dma_desc_append(channel, d);