This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM4376: Suspend/resume issue with DDR settings

Part Number: AM4376

Hi Sir 

we used AM4376 with DDR3 H5TC4G63EFR for development. 

We found the issue that system cannot go to suspend and resume successfully. 

1. we do the DDR test and power on/off test. in the end , the DDR timing is ok for this customized board.

const struct emif_regs ddr3_emif_regs_400Mhz_xxboard = {
.sdram_config = 0x61A01332,
.ref_ctrl = 0x00000C30,
.sdram_tim1 = 0xE88AE523,
.sdram_tim2 = 0x266B7FDA,
.sdram_tim3 = 0x5F7F867F,
.read_idle_ctrl = 0x00050000,
.zq_config = 0x50077D33,
.temp_alert_config = 0x0,
.emif_ddr_phy_ctlr_1 = 0x00048008,
.emif_ddr_ext_phy_ctrl_1 = 0x00040100,
.emif_ddr_ext_phy_ctrl_2 = 0x0,
.emif_ddr_ext_phy_ctrl_3 = 0x0,
.emif_ddr_ext_phy_ctrl_4 = 0x0,
.emif_ddr_ext_phy_ctrl_5 = 0x0,
.emif_rd_wr_exec_thresh = 0x80000405,
.emif_prio_class_serv_map = 0x80000001,
.emif_connect_id_serv_1_map = 0x80000094,
.emif_connect_id_serv_2_map = 0x00000000,
.emif_cos_config = 0x000FFFFF
};

2. we use GPEVM DDR parameter and customized board can bringup. BTW it can do suspend and resume successfully. 

const struct emif_regs ddr3_emif_regs_400Mhz = {
.sdram_config = 0x638413B2,
.ref_ctrl = 0x00000C30,
.sdram_tim1 = 0xEAAAD4DB,
.sdram_tim2 = 0x266B7FDA,
.sdram_tim3 = 0x107F8678,
.read_idle_ctrl = 0x00050000,
.zq_config = 0x50074BE4,
.temp_alert_config = 0x0,
.emif_ddr_phy_ctlr_1 = 0x0E004008,
.emif_ddr_ext_phy_ctrl_1 = 0x08020080,
.emif_ddr_ext_phy_ctrl_2 = 0x00400040,
.emif_ddr_ext_phy_ctrl_3 = 0x00400040,
.emif_ddr_ext_phy_ctrl_4 = 0x00400040,
.emif_ddr_ext_phy_ctrl_5 = 0x00400040,
.emif_rd_wr_lvl_rmp_win = 0x0,
.emif_rd_wr_lvl_rmp_ctl = 0x0,
.emif_rd_wr_lvl_ctl = 0x0,
.emif_rd_wr_exec_thresh = 0x80000405,
.emif_prio_class_serv_map = 0x80000001,
.emif_connect_id_serv_1_map = 0x80000094,
.emif_connect_id_serv_2_map = 0x00000000,
.emif_cos_config = 0x000FFFFF
};

3. we start to use GP-EVM DDR parameters and replace some parameters we adjusted for DDR3 H5TC4G63EFR

    we found the MB can do suspend/resume successfully until we change emif_ddr_phy_ctlr_1 parameters from 0x0E004008 to 0x00048008.

    in GP-EVM DDR parameter ->.emif_ddr_phy_ctlr_1 = 0x0E004008,

    in Our adjsutmernt paramter -> .emif_ddr_phy_ctlr_1            = 0x00048008,

It is strange that we cannot adjust the  parameter in excel file to be the same with GP-EVM setting for emif_ddr_phy_ctlr_1 = 0x0E004008,

Does TI have any suggestion why this register will cause suspend/resume function failed ?

BR

Yimin

  • The factory team have been notified. They will respond here.
  • Hi Sir

    Do you have any update

    BR
    Yimin
  • Hi Sir

    we did some experiemnts in AM437x GP-EVM.

    we modified the DDR parameter  emif_ddr_phy_ctlr_1 from 0x0E004008 to 0x00048008.

    and then execute echo mem > /sys/power/state ->  system cannot wakeup

    we are also checking the emif_ddr_phy_ctlr_1 setting in excel file and found there is something wrong.

    if we want to adjust the register value of  emif_ddr_phy_ctlr_1 to be 0x0E004008 , the DDR setting must be DDR2.

    please advise why this register will cause system wake up failed. 

    BR

    Yimin

  • Hi Sir 

    we found the root cause why the system cannot go into suspend mode and wake up well.

    In GP-EVM DDR Setting, the RDLVL_MASK,RDLVLGATE_MASK,WRLVL_MASK these masks are enabled in order not to perform h/w leveling training.

    In AM437x_EMIF_Configuration_Tool and wiki , TI advises to disable RDLVL_MASK,RDLVLGATE_MASK,WRLVL_MASK  in order to perform h/w leveling training.

    But it will cause our MB cannot go into suspend mode and wake up well.

    if we follow GP-EVM's setting to enable RDLVL_MASK,RDLVLGATE_MASK,WRLVL_MASK in order not to perform h/w leveling training. the system can do suspend mode and wake up well.

    please advise 

    BR

    Yimin

  • Hi Biser

    Do you have any update ?

    BR
    Yimin
  • Hi Sir

    Do you have any update? 

    in GP-EVM, the HW leveling is disabled and can do suspend/resume well.

    if we enable HW leveling, the suspend/resume function would fail. 

    In Wiki, TI advises enabling HW leveling.

    please advise.

    BR

    Yimin

  • Hi Sir

    It's been almost a month and no update from TI.

    Do we need to create another thread to discuss this issue which can duplicate in EVM ? 

    BR

    Yimin

  • Hi Yimin
    I apologize for the extreme delay in getting back on this thread. The key experts were tied on a production stop issue for last 2 weeks.
    I will discuss with them and see what guidance we can provide some time this week.

    I personally do not think the EMIF tool register settings has any bearing on suspend/resume - but will double check with the software and hardware expert


    Sorry for the delay and appreciate your patience.

    Regards
    Mukul
  • Hi Yimin

    Apologize for our late response - thanks for doing a detailed debug of the issue. In order to isolate this better:
    - what low power mode is the system mapped to? DeepSleep0?
    - what is the refresh rate set to for the external DDR device?

    EMIF tool is primarily an enabler for programming all the relevant EMIF registers. Any specific low power mode handling should be part of the Linux SW. In this regard, enabling HW leveling is the correct setting for AM437x. Can you also provide us specific details on the Processor Linux SDK version you are using?

    Regards, Siva
  • Hi SIr

    We duplicated this issue in GP-EVM with latest SDK.

    - what low power mode is the system mapped to? DeepSleep0?
    echo mem > /sys/power/state => enter DeepSleep0

    - what is the refresh rate set to for the external DDR device?
    could you tell us what refresh rare TI set for the external DDR device in GP-EVM

    if we enable HW leveling, the suspend/resume function would fail.

    Why does TI enable RDLVL_MASK,RDLVLGATE_MASK,WRLVL_MASK these mask in order not to perform h/w leveling training for DDR Setting ?

    BR
    Yimin
  • Hi SIr

    Do you have any update ?

    thanks


    BR
    Yimin

  • Hi Yimin

    We are working with our SW team to resolve the issue you are seeing. I'll update you within this week after my discussion with the SW team. We apologize for the delay in the response here.

    Regards, Siva
  • Yimin,

    I've reproduced your issue on the EVM. I've started an internal thread to figure it out. We may need a few days.

    Best regards,
    Brad
  • Yimin,

    By playing around with CCS, I found that all the memory values were “jumping around” while I was in this failed resume state.  By writing EMIF4D_READ_WRITE_LEVELING_CTRL = 0x80000000 (i.e. initiating leveling), everything suddenly stabilized.  I've been looking at the function am43xx_resume_from_deep_sleep which is in the file arch/arm/mach-omap2/sleep43xx.S.  It doesn't look like we re-run the leveling when we resume from deep-sleep.  I believe that's the fundamental issue.

    So it's not fully resolved yet, but we're getting closer.  I wanted to share this information with you in case you are able to perform any experiments of your own along these lines.

    Best regards,
    Brad

  • Hi Sir

    thanks for the reply .

    Waiting for the solution ASAP.

    BR
    Yimin
  • We have an internal meeting scheduled for tomorrow afternoon to discuss further.  We will get this figured out soon.

  • Yimin,

    As I mentioned, we have a call on this topic tomorrow.  However, I've been looking into it and I have a prelim patch available.  Note that this has not been rigorously tested, nor has it even been reviewed for that matter!  However, I'd like for you to try it out and verify that it's working for you too.

    Here's Rev 1 of the patch:

    • https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/0001_2D00_AM4_2D00_Fix_2D00_resume_2D00_code_2D00_to_2D00_support_2D00_hw_2D00_leveling.patch

    Please let me know how it goes.  I used Processor SDK Linux 4.03 as the baseline for my patch.

    Best regards,
    Brad

  • Yimin,

    After reviewing with others, we determined we also needed a wait loop to allow the leveling to complete before the code runs.

    Here's Rev 2 of the patch:

    • https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/5756.0001_2D00_AM4_2D00_Fix_2D00_resume_2D00_code_2D00_to_2D00_support_2D00_hw_2D00_leveling.patch

    Furthermore, in u-boot there were a couple other changes (besides unmasking the leveling).

    1. To bring proper support for PHY_INVERT_CLKOUT=1, you would need the patch shown here.
    2. One other recommended change relates to the value of ext_phy_ctrl_36:

    diff --git a/arch/arm/mach-omap2/am33xx/ddr.c b/arch/arm/mach-omap2/am33xx/ddr.c
    index 2949d1d..5c9f108 100644
    --- a/arch/arm/mach-omap2/am33xx/ddr.c
    +++ b/arch/arm/mach-omap2/am33xx/ddr.c
    @@ -285,8 +285,8 @@ static void ext_phy_settings_hwlvl(const struct emif_regs *regs, int nr)
    writel(0x00000000, &emif_reg[nr]->emif_ddr_ext_phy_ctrl_34_shdw);
    writel(0x00000000, &emif_reg[nr]->emif_ddr_ext_phy_ctrl_35);
    writel(0x00000000, &emif_reg[nr]->emif_ddr_ext_phy_ctrl_35_shdw);
    - writel(0x000000FF, &emif_reg[nr]->emif_ddr_ext_phy_ctrl_36);
    - writel(0x000000FF, &emif_reg[nr]->emif_ddr_ext_phy_ctrl_36_shdw);
    + writel(0x00000077, &emif_reg[nr]->emif_ddr_ext_phy_ctrl_36);
    + writel(0x00000077, &emif_reg[nr]->emif_ddr_ext_phy_ctrl_36_shdw);

    /*
    * Sequence to ensure that the PHY is again in a known state after

    TI's software team is working on integrating these changes into future versions of u-boot and the kernel.

    Have you had a chance to try out any of the patches yet?  Please let us know what you're observing.

    Best regards,
    Brad

  • Hi Sir 

    thanks for your help. it works in the customized board.

    BTW, we saw below issue in log message. Is it the same issue or side effect ?

    root@rd:~# dmesg | grep err

    [    0.191913] omap_l3_noc 44000000.ocp: L3 debug error: target 8 mod:0 (unclearable)

    [    0.191972] omap_l3_noc 44000000.ocp: L3 application error: target 8 mod:0 (unclearable)

    BR

    Yimin

  • Yimin

    Did you see the L3 Error with the patch or even without the patch? Is this error occurring during the resume sequence?

    Regards, Siva
  • Hi Sir

    If we set emif_ddr_phy_ctlr_1 = 0x0e008008 in our customed board, both suspend/resume issue and omap L3 error disappear.
    BTW, TI EVM ddr configuration can also make both suspend/resume issue and omap L3 error disappear.

    FYR
    BR
    Yimin
  • Yimin

    Thanks for the feedback. We will review and get back on this. Please use the patch for now and we will work on resolving the L3 error. Disabling the HW leveling is not the right solution, therefore, please use the patch that Brad provided.

    Regards, Siva
  • Hi Sir

    Do you have any update for the L3 error issue?

    please advise if there is any side effect and solution.

    BR
    Yimin
  • Hi Sir

    do you have any update for L3 error issue ?

    thanks for reply.

    BR
    Yimin
  • Yimin

    We're looking into the error - are you able to proceed with the error or have issues with resume?

    Regards, Siva
  • Hi Sir

    we used GP-EVM to do patch.


    /* EMIF DDR3 Configurations are different for production AM43X GP EVMs */
    const struct emif_regs ddr3_emif_regs_400Mhz_production = {
    //.emif_ddr_phy_ctlr_1 = 0x0E004008,
    .emif_ddr_phy_ctlr_1 = 0x00004008,

    Update sleep43xx.S files

    the error message can show up.
    [ 0.211875] omap_l3_noc 44000000.ocp: L3 debug error: target 8 mod:0 (unclearable)
    [ 0.211934] omap_l3_noc 44000000.ocp: L3 application error: target 8 mod:0 (unclearable)

    if we do suspend/resume. it seems there is no error message and no abnormal behaviors.

    root@am437x-evm:~# echo mem > /sys/power/state
    [ 306.184372] PM: Syncing filesystems ... done.
    [ 306.192048] Freezing user space processes ... (elapsed 0.002 seconds) done.
    [ 306.206374] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
    [ 306.215681] Suspending console(s) (use no_console_suspend to debug)
    [ 306.252262] PM: suspend of devices complete after 28.041 msecs
    [ 306.256404] PM: late suspend of devices complete after 4.108 msecs
    [ 306.260757] PM: noirq suspend of devices complete after 4.320 msecs
    [ 306.260768] PM: Successfully put all powerdomains to target state
    [ 306.260768] PM: Wakeup source UART
    [ 306.280324] PM: noirq resume of devices complete after 19.436 msecs
    [ 306.283965] PM: early resume of devices complete after 3.151 msecs
    [ 306.285199] net eth0: initializing cpsw version 1.15 (0)
    [ 306.285223] cpsw 4a100000.ethernet: initialized cpsw ale version 1.4
    [ 306.285238] cpsw 4a100000.ethernet: ALE Table size 1024
    [ 306.386017] Micrel KSZ9031 Gigabit PHY 4a101000.mdio:00: attached PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=4a101000.mdio:00, irq=-1)
    [ 306.390059] cpts ptp bc clkid 0
    [ 306.412910] Suspended for 10.894 seconds
    [ 306.413534] usb usb1: root hub lost power or was reset
    [ 306.413553] usb usb2: root hub lost power or was reset
    [ 306.533744] PM: resume of devices complete after 249.744 msecs
    [ 306.632370] Restarting tasks ... done.

    BR
    Yimin

  • Yimin,

    We have observed your issue related to the startup error.  We've been working on that issue and also a corresponding issue in suspend/resume (i.e. once you resolve the startup error then the error "moves" to the first time suspend/resume occurs).  Tomorrow is a holiday in the US, and we have a meeting on Thursday to discuss further.  I have some experimental code that looks to be working properly, but we need to discuss further internally before I post it.  So perhaps at the end of this week we will have something or maybe early next week.

    Best regards,
    Brad

  • Yimin,

    First, I want to note that the L3 error you mentioned is not known to cause any specific issues.  So in that regard, I can't say it's even necessary to workaround this L3 error.  However, since I can't tell you definitively that there's not any possible negative consequence of the L3 error from the EMIF, I have found a solution to avoid it.  In short, after initiating leveling there's a period of around 300-400us where you cannot access any EMIF registers or else the EMIF will generate one of these L3 errors.  As a result, this needs to be patched in the u-boot initialization code, as well as the resume code.

    Here are my patches:

    • U-Boot:

    u-boot-patches.zip

    • Kernel: https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/0001_2D00_AM43xx_2D00_Fix_2D00_resume_2D00_code_2D00_to_2D00_support_2D00_hw_2D00_leveling.patch

    Best regards,

    Brad

  • Yimin

    Can you check the latest patch and let us know if this resolves the errors and the suspend/resume works fine?

    Regards, Siva
  • Hi Sir

    After using the latest patch, it can fix L3 error issue and suspend/resume seems fine.

    if there is any risk , please let us know.

    thanks

    BR
    Yimin