Micron MT29F NAND driver

This function is used to exit the OTP mode. Only after the issue of this command user can use the standard functions to read/program/erase the NAND.

Parameters:
[in]none
Returns:
Function returns DRIVER_STATUS_NOT_INITIALIZED, NAND_SUCCESS or NAND_GENERIC_FAIL
Pseudo Code Steps
  1. Check if the device is in OTP mode (FEATURE_ARRAY_OTP_OPERATION)
  2. Set the device in normal mode (FEATURE_ARRAY_NORMAL) using set_feature
  3. Check if the device is now in normal mode (FEATURE_ARRAY_NORMAL)

Definition at line 1518 of file nand_MT29F_lld.c.

References ADDR_FEATURE_ARRAY_OPMODE, driver_status, DRIVER_STATUS_INITIALIZED, DRIVER_STATUS_NOT_INITIALIZED, FEATURE_ARRAY_NORMAL, FEATURE_ARRAY_OTP_OPERATION, FEATURE_ARRAY_OTP_PROTECTION, NAND_GENERIC_FAIL, NAND_Get_Feature(), NAND_Set_Feature(), and NAND_SUCCESS.

                                  {
   MT_uint8 ret;
   flash_width subfeature;

   /* check if driver is in a valid state */
   if(DRIVER_STATUS_INITIALIZED != driver_status)
      return DRIVER_STATUS_NOT_INITIALIZED;

   /* check if device is NOT in normal status */
   ret = NAND_Get_Feature(ADDR_FEATURE_ARRAY_OPMODE, &subfeature);

   if((FEATURE_ARRAY_OTP_OPERATION != subfeature) && (FEATURE_ARRAY_OTP_PROTECTION != subfeature))
      return NAND_GENERIC_FAIL;

   /* exit OTP status */
   ret = NAND_Set_Feature(ADDR_FEATURE_ARRAY_OPMODE, FEATURE_ARRAY_NORMAL);

   /* return with error if a fail occurs */
   if(NAND_SUCCESS != ret)
      return ret;

   /* check if device is in normal status */
   ret = NAND_Get_Feature(ADDR_FEATURE_ARRAY_OPMODE, &subfeature);

   /* return with error if a fail occurs */
   if(NAND_SUCCESS != ret)
      return ret;

   if(FEATURE_ARRAY_NORMAL != subfeature)
      return NAND_GENERIC_FAIL;

   return NAND_SUCCESS;
}