AnsweredAssumed Answered

ONFI SET FEATURES / GET FEATURES FCM implementation

Question asked by Magnus Nilsson on Jun 2, 2016
Latest reply on Jun 16, 2016 by Magnus Nilsson

I need to implement ONFI commands SET FEATURES / GET FEATURES in order to enable on-die ECC for a Micron NAND (MT29F4G08ABADA) and custom P2020 board running linux.

However, I'm having a hard time implementing that using the FCM.

I'm hoping that I simply haven't understood some feature of FCM programming, and that you will be able to spot my mistake.

 

The sequence to enable internal ECC with SET FEATURES is EFh(cmd)-90h(addr)-08h(data)-00h(data)-00h(data)-00h(data)-wait(tFEAT).

The GET FEATURES command is EEh.

 

Does the following implementation look reasonable?:

 

fsl_elbc_nand.c, fsl_elbc_cmdfunc():

...

        case NAND_CMD_SET_FEATURES: // 0xEF

                out_be32(&lbc->fir, (FIR_OP_CW0 << FIR_OP0_SHIFT) |

                                    (FIR_OP_UA  << FIR_OP1_SHIFT) |

                                    (FIR_OP_WB << FIR_OP2_SHIFT));

                out_be32(&lbc->fcr, NAND_CMD_SET_FEATURES << FCR_CMD0_SHIFT);

                out_be32(&lbc->fbcr, 4);

                ctrl->read_bytes = 0;

                ctrl->use_mdr = 1;

                ctrl->mdr = column; // 0x90

                set_addr(mtd, 0, 0, 0);

                fsl_elbc_run_command(mtd);

                //after this, 4 bytes [0x08,0x00,0x00,0x00] are written with fsl_elbc_write_buf()

                break;

 

  case NAND_CMD_GET_FEATURES: // 0xEE

                out_be32(&lbc->fir, (FIR_OP_CW0 << FIR_OP0_SHIFT) |

                                    (FIR_OP_UA  << FIR_OP1_SHIFT) |

                                    (FIR_OP_RBW << FIR_OP2_SHIFT));

                out_be32(&lbc->fcr, NAND_CMD_GET_FEATURES << FCR_CMD0_SHIFT);

                out_be32(&lbc->fbcr, 4);

                ctrl->read_bytes = 4;

                ctrl->use_mdr = 1;

                ctrl->mdr = column; // 0x90

                set_addr(mtd, 0, 0, 0);

                fsl_elbc_run_command(mtd);

                 //after this, 4 bytes are read with fsl_elbc_read_buf()

                break;

...

Outcomes