AM6442: How does EMMC warm reset take effect

Part Number: AM6442
Other Parts Discussed in Thread: SYSCONFIG

Hi, TI experts,

I'm implementing a warm reset booting from eMMC. However, after calling SOC_generateSwWarmResetMainDomain(), the eMMC fails to reset properly.

 In my understanding, a normal reset should print the following messages to indicate a restart right after I call this function:

[BOOTLOADER_PROFILE] Boot Media       : undefined
[BOOTLOADER_PROFILE] Boot Image Size  : 175 KB
[BOOTLOADER_PROFILE] Cores present    :
m4f0-0
r5f1-0
r5f1-1
a530-0
r5f0-0
r5f0-1
[BOOTLOADER PROFILE] SYSFW init                       :      12483us
[BOOTLOADER PROFILE] System_init                      :    5368613us
[BOOTLOADER PROFILE] Drivers_open                     :      39467us
[BOOTLOADER PROFILE] Board_driversOpen                :          0us
[BOOTLOADER PROFILE] Sciclient Get Version            :       9892us
[BOOTLOADER PROFILE] CPU Load                         :    2311966us
[BOOTLOADER_PROFILE] SBL Total Time Taken             :    2373714us
 
Image loading done, switching to application ...

However, there is no print info. And I would like to ask if there are any other operations that need to be performed to complete the warm reset of EMMC booting.

Thanks,

xue.

  • Hi Xue,

    I assume, you end goal is to perform a software warm reset of the SoC, please confirm the same.

    Could you let me know when the SOC_generateSwWarmResetMainDomain is called in your system? Is it called from the application running on one of the cores?

    Best Regards,

    Meet.

  • I assume, you end goal is to perform a software warm reset of the SoC, please confirm the same.

    Yes, this is my end goal.

    I will call this function after booting and the timer I set is triggered. And for now it is only running on R5F00 core.

    Best Regards,

    xue.

  • I referred to this approach and tried performing the reset using Sciclient_pmDeviceReset, but the behavior was the same as before.

    I also reviewed this post ((+) AM62A7: EMMC boot mode cannot reboot the board but SD card boot mode can reboot - Processors forum - Processors - TI E2E support forums), which mentions that resetting the eMMC requires setting the RST_N bit. Is this also applicable to AM6442? If so, which register do I need to set?

    Thank you,

    xue.

  • which mentions that resetting the eMMC requires setting the RST_N bit. Is this also applicable to AM6442?

    Yes, this will be applicable for AM64 as well, as mentioned in the shared FAQ, you have to set ECSD register byte 162, bits[1:0] to 0x1 to enable this functionality.

  • Does SDK provide any API to access ECSD registers?

    Sorry but I couldn't find ECSD register in AM6442 TRM, and I'd like to ask how to set the specific byte in ECSD register.

  • Does SDK provide any API to access ECSD registers?

    I am assigning this thread to our eMMC expert to answer this query, please wait for his response.

  • In fact, I don't have a Linux development environment, so I can't use U-Boot command-line operations to modify the register. Is there any way to integrate this into the application code directly?

  • Is there any way to integrate this into the application code directly?

    Please allow me a day to integrate this in the MCU+ SDK and share the code with you.

  • Sure. Thanks a lot.

  • Hello,

    The following patch on top of the latest SDK (v11.2) exposes the API "MMCSD_enableRstN" to enable the hardware reset functionality.

    diff --git a/source/drivers/mmcsd/v0/lld/mmcsd_lld.h b/source/drivers/mmcsd/v0/lld/mmcsd_lld.h
    index 068cbc97c30..d0bac37c925 100644
    --- a/source/drivers/mmcsd/v0/lld/mmcsd_lld.h
    +++ b/source/drivers/mmcsd/v0/lld/mmcsd_lld.h
    @@ -647,6 +647,19 @@ int32_t MMCSD_lld_enableBootPartition(MMCSDLLD_Handle handle,
      */
     int32_t MMCSD_lld_disableBootPartition(MMCSDLLD_Handle handle);
     
    +/**
    + *  \brief  This function enables the RST_N signal for eMMC device.
    + *
    + *  \pre    MMCSD controller has been initialized using #MMCSD_lld_init().
    + *
    + *  \param  handle         [IN] Handle to the MMCSD instance used.
    + *
    + *  \return #MMCSD_STS_SUCCESS on success; else error on failure.
    + *
    + *  \sa     #MMCSD_lld_init()
    + */
    +int32_t MMCSD_lld_enableRstN(MMCSDLLD_Handle handle);
    +
     /* ========================================================================== */
     /*                        ISR Function Declarations                           */
     /* ========================================================================== */
    diff --git a/source/drivers/mmcsd/v0/lld/mmcsd_v0_lld.c b/source/drivers/mmcsd/v0/lld/mmcsd_v0_lld.c
    index b50bf9adcc6..d5b9f6bb9d7 100644
    --- a/source/drivers/mmcsd/v0/lld/mmcsd_v0_lld.c
    +++ b/source/drivers/mmcsd/v0/lld/mmcsd_v0_lld.c
    @@ -173,6 +173,14 @@ Bit     Device Type
     /** \brief Macros for ECSD Register Indexes */
     #define MMCSD_ECSD_BUS_WIDTH_INDEX                      ((uint32_t) 183U)
     #define MMCSD_ECSD_HS_TIMING_INDEX                      ((uint32_t) 185U)
    +#define MMCSD_ECSD_RST_N_FUNCTION_INDEX                 ((uint32_t) 162U)
    +
    +/** \brief Macros for RST_n_FUNCTION values (7.4.42 RST_n_FUNCTION [162])
    + *  JEDEC Standard No. 84-B51
    + */
    +#define MMCSD_ECSD_RST_N_FUNCTION_TEMP_DISABLED         ((uint32_t) 0x00U)
    +#define MMCSD_ECSD_RST_N_FUNCTION_PERMANENTLY_ENABLED   ((uint32_t) 0x01U)
    +#define MMCSD_ECSD_RST_N_FUNCTION_PERMANENTLY_DISABLED  ((uint32_t) 0x02U)
     
     /** \brief Macros for States Used during the Initialization of SD Device */
     #define MMCSD_SD_INIT_STATE_CONTROLLER_INIT                 ((uint32_t) 0U)
    @@ -1496,6 +1504,50 @@ int32_t MMCSD_lld_disableBootPartition(MMCSDLLD_Handle handle)
         return status;
     }
     
    +int32_t MMCSD_lld_enableRstN(MMCSDLLD_Handle handle)
    +{
    +    int32_t status = MMCSD_STS_SUCCESS;
    +    MMCSDLLD_Object *object = (MMCSDLLD_Object *)handle;
    +    MMCSDLLD_Transaction trans;
    +
    +    if(object != NULL_PTR)
    +    {
    +        /* Check if card type is eMMC */
    +        if(object->initHandle->cardType == MMCSD_CARD_TYPE_EMMC)
    +        {
    +            uint32_t arg;
    +
    +            /* Configure the ECSD register RST_n_FUNCTION to permanently enable
    +             * using CMD6 (SWITCH command)
    +             * Argument format: [31:26]=0 [25:24]=Access [23:16]=Index [15:8]=Value [7:0]=CmdSet
    +             */
    +            arg = (uint32_t)((MMCSD_CMD6_ACCESS_MASK_WRITE_BYTE << 24U)        |
    +                            (MMCSD_ECSD_RST_N_FUNCTION_INDEX << 16U)           |
    +                            (MMCSD_ECSD_RST_N_FUNCTION_PERMANENTLY_ENABLED << 8U));
    +
    +            /* Send CMD6 to enable RST_N */
    +            MMCSD_lld_initTransaction(&trans);
    +            trans.cmd = MMCSD_MMC_CMD(6U);
    +            trans.arg = arg;
    +            status = MMCSD_lld_transferPoll(handle, &trans);
    +
    +            /* Delay for 5 ms for the change to take effect in the device */
    +            ClockP_usleep(5000);
    +        }
    +        else
    +        {
    +            /* RST_N is only applicable for eMMC devices */
    +            status = MMCSD_STS_ERR;
    +        }
    +    }
    +    else
    +    {
    +        status = MMCSD_STS_ERR_INVALID_PARAM;
    +    }
    +
    +    return status;
    +}
    +
     /* ========================================================================== */
     /*                     API ISR Function Definitions                           */
     /* ========================================================================== */
    diff --git a/source/drivers/mmcsd/v0/mmcsd.h b/source/drivers/mmcsd/v0/mmcsd.h
    index 4314ed06fc6..c543a184425 100644
    --- a/source/drivers/mmcsd/v0/mmcsd.h
    +++ b/source/drivers/mmcsd/v0/mmcsd.h
    @@ -418,6 +418,20 @@ int32_t MMCSD_enableBootPartition(MMCSD_Handle handle, uint32_t partitionNum);
      */
     int32_t MMCSD_disableBootPartition(MMCSD_Handle handle);
     
    +/**
    + *  \brief  This function enables the RST_N signal for eMMC device
    + *
    + *  \pre    MMCSD controller has been opened using #MMCSD_open()
    + *
    + *  \param  handle         #MMCSD_Handle returned from #MMCSD_open()
    + *
    + *  \return #SystemP_SUCCESS on successful enable; else error on failure
    + *
    + *  \sa     #MMCSD_init()
    + *  \sa     #MMCSD_open()
    + */
    +int32_t MMCSD_enableRstN(MMCSD_Handle handle);
    +
     /** @} */
     
     #ifdef __cplusplus
    diff --git a/source/drivers/mmcsd/v0/mmcsd_v0.c b/source/drivers/mmcsd/v0/mmcsd_v0.c
    index 40a98a821ff..cc43073d832 100644
    --- a/source/drivers/mmcsd/v0/mmcsd_v0.c
    +++ b/source/drivers/mmcsd/v0/mmcsd_v0.c
    @@ -658,6 +658,28 @@ int32_t MMCSD_disableBootPartition(MMCSD_Handle handle)
         return status;
     }
     
    +int32_t MMCSD_enableRstN(MMCSD_Handle handle)
    +{
    +    int32_t status = SystemP_SUCCESS;
    +    MMCSD_Object *object = ((MMCSD_Config *)handle)->object;
    +    MMCSDLLD_Handle mmcsdLldHandle = object->mmcsdLldHandle;
    +
    +    status = SemaphoreP_pend(&object->mutex, SystemP_WAIT_FOREVER);
    +
    +    if(status == SystemP_SUCCESS)
    +    {
    +        /* Call LLD function to enable RST_N */
    +        status = MMCSD_lld_enableRstN(mmcsdLldHandle);
    +        (void)SemaphoreP_post(&object->mutex);
    +    }
    +    else
    +    {
    +        /* Mutex not Available */
    +    }
    +
    +    return status;
    +}
    +
     /* ========================================================================== */
     /*                       ISR Function Definitions                             */
     /* ========================================================================== */

    This API can be called from any application that has eMMC enabled in the Sysconfig like MMCSD_RAW_IO example. Please note this is a one time operation only. Once the functionality is enabled successfully, it does not need to be done again.

    I only had an EVM with this already enabled so I did not have a way to test the implemented code. Hopefully, it works.

  • This patch can successfully make EMMC reset. Thank you very much.