Micron MT29F NAND driver

This function is used to set the device in OTP mode. When the device is in this mode, please use only the dedicated OTP functions set:

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 normal mode (ADDR_FEATURE_ARRAY_OPMODE)
  2. Set the device in OTP mode using set_feature
  3. Check if the device is now in OTP mode (FEATURE_ARRAY_OTP_OPERATION)

Definition at line 1470 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 OTP status */
   ret = NAND_Get_Feature(ADDR_FEATURE_ARRAY_OPMODE, &subfeature);

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

   /* set OTP status */
   ret = NAND_Set_Feature(ADDR_FEATURE_ARRAY_OPMODE, FEATURE_ARRAY_OTP_OPERATION);

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

   /* check if device is in OTP 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_OTP_OPERATION != subfeature)
      return NAND_GENERIC_FAIL;

   return NAND_SUCCESS;
}