MTK platform DDR down (frequency adjustment) method

Copyright notice: reproduced please specify blog address https://blog.csdn.net/jinron10/article/details/88823738

Often see when the system is running

<4>[ 4758.075985] (2)[195:[email protected]]Normal free:15012kB min:3352kB low:9492kB high:10332kB active_anon:78804kB inactive_anon:102432kB active_file:104580kB inactive_file:85616kB unevictable:256kB isolated(anon):1116kB isolated(file):0kB present:734208kB managed:706936kB mlocked:256kB dirty:1156kB writeback:20kB mapped:132460kB shmem:4888kB slab_reclaimable:23304kB slab_unreclaimable:41824kB kernel_stack:16072kB pagetables:36232kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:772 all_unreclaimable? no
<4>[ 4758.081783] (2)[195:[email protected]]lowmem_reserve[]: 0 2072 2072
<4>[ 4758.082367] (2)[195:[email protected]]HighMem free:112kB min:256kB low:2556kB high:2872kB active_anon:40160kB inactive_anon:64336kB active_file:50052kB inactive_file:40808kB unevictable:1676kB isolated(anon):0kB isolated(file):0kB present:265216kB managed:265216kB mlocked:0kB dirty:480kB writeback:0kB mapped:71488kB shmem:2156kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:432 all_unreclaimable? no
<4>[ 4758.087847] (2)[195:[email protected]]lowmem_reserve[]: 0 0 0
<4>[ 4758.088281] (2)[195:[email protected]]Normal: 1930*4kB (UEM) 429*8kB (UEM) 237*16kB (UEM) 8*32kB (UEMR) 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 15200kB
<4>[ 4758.089908] (2)[195:[email protected]]HighMem: 20*4kB (R) 4*8kB (R) 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 112kB
<4>[ 4758.091280] (2)[195:[email protected]]85259 total pagecache pages
<4>[ 4758.092339] (2)[195:[email protected]]12825 pages in swap cache
<4>[ 4758.093087] (2)[195:[email protected]]Swap cache stats: add 2445683, delete 2432859, find 14033/1361885
<4>[ 4758.094260] (2)[195:[email protected]]Free swap  = 376248kB
<4>[ 4758.094953] (2)[195:[email protected]]Total swap = 726036kB
<1>[ 4758.099018] (2)[195:[email protected]]Unable to handle kernel paging request at virtual address aefb700c
<1>[ 4758.100206] (2)[195:[email protected]]pgd = ed164000
<1>[ 4758.100813] (2)[195:[email protected]][aefb700c] *pgd=acaac835, *pte=00000000, *ppte=00000000
<0>[ 4758.101601]-(2)[195:[email protected]]Internal error: Oops: 817 [#1] PREEMPT SMP ARM
<4>[ 4758.102555]-(2)[195:[email protected]]Modules linked in: wlan_drv_gen2 bf13a000   (null) 1002990 0 (O) wmt_chrdev_wifi bf135000   (null) 6008 0 (O) gps_drv bf12b000   (null) 21954 0 (O) fmradio_drv bf102000   (null) 132230 0 (O) bt_drv bf0fb000   (null) 12055 0 (O) wmt_drv bf000000   (null) 853192 0 (O)
<5>[ 4758.105624]-(2)[195:[email protected]]disable aee kernel api
<4>[ 4759.106120]-(2)[195:[email protected]]Non-crashing CPUs did not react to IPI
<4>[ 4759.107015]-(2)[195:[email protected]]CPU: 2 PID: 195 Comm: [email protected] Tainted: G           O   3.18.79+ #5
<4>[ 4759.108279]-(2)[195:[email protected]]task: ed5c7500 ti: ed158000 task.ti: ed158000
<4>[ 4759.109227]-(2)[195:[email protected]]PC is at 0xaed03b0c
<4>[ 4759.109892]-(2)[195:[email protected]]LR is at 0xaf19d133
<4>[ 4759.110559]-(2)[195:[email protected]]pc : [<aed03b0c>]    lr : [<af19d133>]    psr: a0070030
<4>[ 4759.110559]sp : bee953e0  ip : af1d263c  fp : 00000001
<4>[ 4759.112268]-(2)[195:[email protected]]r10: 00264000  r9 : bee954fc  r8 : ae5b6000
<4>[ 4759.113193]-(2)[195:[email protected]]r7 : aefb7000  r6 : 00000f02  r5 : 00000004  r4 : 00000000
<4>[ 4759.114281]-(2)[195:[email protected]]r3 : 00000000  r2 : 17ca855a  r1 : 00000000  r0 : ffffffff
<4>[ 4759.115371]-(2)[195:[email protected]]Flags: NzCv  IRQs on  FIQs on  Mode USER_32  ISA Thumb  Segment user
<4>[ 4759.116567]-(2)[195:[email protected]]Control: 10c5387d  Table: ad16406a  DAC: 00000051
<4>[ 4759.117562]-(2)[195:[email protected]]CPU: 2 PID: 195 Comm: [email protected] Tainted: G           O   3.18.79+ #5
<4>[ 4759.118816]-(2)[195:[email protected]]Backtrace: 
<4>[ 4759.119146]-(2)[195:[email protected]][<c010b940>] (dump_backtrace) from [<c010bb60>] (show_stack+0x18/0x1c)
<4>[ 4759.120359]-(2)[195:[email protected]] r7:00000080 r6:00000000 r5:20070193 r4:c0e2a4e0
<4>[ 4759.121084]-(2)[195:[email protected]][<c010bb48>] (show_stack) from [<c09843ec>] (dump_stack+0x90/0xa4)
<4>[ 4759.122272]-(2)[195:[email protected]][<c098435c>] (dump_stack) from [<c05c4730>] (ipanic_die+0x58/0x13c)
<4>[ 4759.123451]-(2)[195:[email protected]] r7:00000000 r6:00000000 r5:fffffffd r4:ed159ddc
<4>[ 4759.124173]-(2)[195:[email protected]][<c05c46d8>] (ipanic_die) from [<c0145af8>] (notifier_call_chain+0x9c/0x338)
<4>[ 4759.125451]-(2)[195:[email protected]] r4:00000001
<4>[ 4759.125780]-(2)[195:[email protected]][<c0145a5c>] (notifier_call_chain) from [<c0145e70>] (atomic_notifier_call_chain+0x3c/0x50)
<4>[ 4759.127220]-(2)[195:[email protected]] r10:ed5c7500 r9:c0e12ea4 r8:ffffe000 r7:c0b4ab68
<4>[ 4759.127951]-(2)[195:[email protected]][<c0145e34>] (atomic_notifier_call_chain) from [<c0146458>] (notify_die+0x40/0x48)
<4>[ 4759.129293]-(2)[195:[email protected]] r6:ed159fb0 r5:00000817 r4:c0e7b29c
<4>[ 4759.129882]-(2)[195:[email protected]][<c0146418>] (notify_die) from [<c010bc74>] (die+0x110/0x458)
<4>[ 4759.131014]-(2)[195:[email protected]][<c010bb64>] (die) from [<c0982f08>] (__do_kernel_fault.part.1+0x6c/0x7c)
<4>[ 4759.132258]-(2)[195:[email protected]] r10:c0e13c2c r9:aefb700c r8:aefb700c r7:ed535180
<4>[ 4759.132990]-(2)[195:[email protected]][<c0982e9c>] (__do_kernel_fault.part.1) from [<c01152c0>] (do_page_fault+0x3b0/0x3c4)
<4>[ 4759.134365]-(2)[195:[email protected]] r7:00000817 r4:ed159fb0
<4>[ 4759.134822]-(2)[195:[email protected]][<c0114f10>] (do_page_fault) from [<c01003ac>] (do_DataAbort+0x80/0x114)
<4>[ 4759.136056]-(2)[195:[email protected]] r10:c0e13c2c r9:aefb700c r8:00000817 r7:ed159fb0
<4>[ 4759.136784]-(2)[195:[email protected]][<c010032c>] (do_DataAbort) from [<c010ca00>] (__dabt_usr+0x40/0x60)
<4>[ 4759.137980]-(2)[195:[email protected]]Exception stack(0xed159fb0 to 0xed159ff8)
<4>[ 4759.138888]-(2)[195:[email protected]]9fa0:                                     ffffffff 00000000 17ca855a 00000000
<4>[ 4759.140189]-(2)[195:[email protected]]9fc0: 00000000 00000004 00000f02 aefb7000 ae5b6000 bee954fc 00264000 00000001
<4>[ 4759.141489]-(2)[195:[email protected]]9fe0: af1d263c bee953e0 af19d133 aed03b0c a0070030 ffffffff
<4>[ 4759.142581]-(2)[195:[email protected]] r10:00264000 r9:bee954fc r8:10c5387d r7:10c5387d
<5>[ 4759.143366]-(2)[195:[email protected]]mrdump: cpu[2] tsk:ed5c7500 ti:ed158000
<5>[ 4759.146200]-(2)[195:[email protected]]has_mt_dump_support: no mt_dump support!
<4>[ 4762.257137]-(2)[195:[email protected]]SMP: failed to stop secondary CPUs
<0>[ 4762.258124]-(2)[195:[email protected]]machine_restart, arm_pm_restart(  (null))
<1>[ 4762.259179]-(2)[195:[email protected]]ARCH_RESET happen!!!
<1>[ 4762.260009]-(2)[195:[email protected]]arch_reset: cmd = NULL
<4>[ 4762.260924]-(2)[195:[email protected]]CPU: 2 PID: 195 Comm: [email protected] Tainted: G           O   3.18.79+ #5
<4>[ 4762.262301]-(2)[195:[email protected]]Backtrace: 
<4>[ 4762.262967]-(2)[195:[email protected]][<c010b940>] (dump_backtrace) from [<c010bb60>] (show_stack+0x18/0x1c)
<4>[ 4762.264321]-(2)[195:[email protected]] r7:00000080 r6:00000000 r5:a0070193 r4:c0e2a4e0
<4>[ 4762.265583]-(2)[195:[email protected]][<c010bb48>] (show_stack) from [<c09843ec>] (dump_stack+0x90/0xa4)
<4>[ 4762.267066]-(2)[195:[email protected]][<c098435c>] (dump_stack) from [<c06ecef4>] (arch_reset+0xc8/0xfc)
<4>[ 4762.268370]-(2)[195:[email protected]] r7:00000000 r6:00000000 r5:00000000 r4:c0e56950
<4>[ 4762.269625]-(2)[195:[email protected]][<c06ece2c>] (arch_reset) from [<c06ecf54>] (mtk_arch_reset_handle+0x2c/0x40)
<4>[ 4762.271048]-(2)[195:[email protected]] r7:00000000 r6:00000000 r5:00000000 r4:00000000
<4>[ 4762.272294]-(2)[195:[email protected]][<c06ecf28>] (mtk_arch_reset_handle) from [<c0145af8>] (notifier_call_chain+0x9c/0x338)
<4>[ 4762.273832]-(2)[195:[email protected]] r5:ffffffff r4:00000000
<4>[ 4762.274676]-(2)[195:[email protected]][<c0145a5c>] (notifier_call_chain) from [<c0145e70>] (atomic_notifier_call_chain+0x3c/0x50)
<4>[ 4762.276258]-(2)[195:[email protected]] r10:c0e7b948 r9:c0e7bf0c r8:c05c46d8 r7:00000000
<4>[ 4762.277511]-(2)[195:[email protected]][<c0145e34>] (atomic_notifier_call_chain) from [<c0147168>] (do_kernel_restart+0x28/0x2c)
<4>[ 4762.279069]-(2)[195:[email protected]] r6:00000000 r5:00000000 r4:c0e7b088
<4>[ 4762.280118]-(2)[195:[email protected]][<c0147140>] (do_kernel_restart) from [<c0107a84>] (machine_restart+0x94/0x98)
<4>[ 4762.281720]-(2)[195:[email protected]][<c01079f0>] (machine_restart) from [<c0146ff4>] (emergency_restart+0x1c/0x20)
<4>[ 4762.283156]-(2)[195:[email protected]] r7:00000000 r6:00000000 r5:fffffffd r4:ed159ddc
<4>[ 4762.284400]-(2)[195:[email protected]][<c0146fd8>] (emergency_restart) from [<c05c475c>] (ipanic_die+0x84/0x13c)
<4>[ 4762.285957]-(2)[195:[email protected]][<c05c46d8>] (ipanic_die) from [<c0145af8>] (notifier_call_chain+0x9c/0x338)
<4>[ 4762.287371]-(2)[195:[email protected]] r4:00000001
<4>[ 4762.288022]-(2)[195:[email protected]][<c0145a5c>] (notifier_call_chain) from [<c0145e70>] (atomic_notifier_call_chain+0x3c/0x50)
<4>[ 4762.289606]-(2)[195:[email protected]] r10:ed5c7500 r9:c0e12ea4 r8:ffffe000 r7:c0b4ab68
<4>[ 4762.290853]-(2)[195:[email protected]][<c0145e34>] (atomic_notifier_call_chain) from [<c0146458>] (notify_die+0x40/0x48)
<4>[ 4762.292338]-(2)[195:[email protected]] r6:ed159fb0 r5:00000817 r4:c0e7b29c
<4>[ 4762.293386]-(2)[195:[email protected]][<c0146418>] (notify_die) from [<c010bc74>] (die+0x110/0x458)
<4>[ 4762.294820]-(2)[195:[email protected]][<c010bb64>] (die) from [<c0982f08>] (__do_kernel_fault.part.1+0x6c/0x7c)
<4>[ 4762.296204]-(2)[195:[email protected]] r10:c0e13c2c r9:aefb700c r8:aefb700c r7:ed535180
<4>[ 4762.297462]-(2)[195:[email protected]][<c0982e9c>] (__do_kernel_fault.part.1) from [<c01152c0>] (do_page_fault+0x3b0/0x3c4)
<4>[ 4762.298976]-(2)[195:[email protected]] r7:00000817 r4:ed159fb0
<4>[ 4762.299787]-(2)[195:[email protected]][<c0114f10>] (do_page_fault) from [<c01003ac>] (do_DataAbort+0x80/0x114)
<4>[ 4762.301160]-(2)[195:[email protected]] r10:c0e13c2c r9:aefb700c r8:00000817 r7:ed159fb0
<4>[ 4762.302369]-(2)[195:[email protected]][<c010032c>] (do_DataAbort) from [<c010ca00>] (__dabt_usr+0x40/0x60)
<4>[ 4762.303751]-(2)[195:[email protected]]Exception stack(0xed159fb0 to 0xed159ff8)
<4>[ 4762.304889]-(2)[195:[email protected]]9fa0:                                     ffffffff 00000000 17ca855a 00000000
<4>[ 4762.306465]-(2)[195:[email protected]]9fc0: 00000000 00000004 00000f02 aefb7000 ae5b6000 bee954fc 00264000 00000001
<4>[ 4762.308022]-(2)[195:[email protected]]9fe0: af1d263c bee953e0 af19d133 aed03b0c a0070030 ffffffff
<4>[ 4762.309251]-(2)[195:[email protected]] r10:00264000 r9:bee954fc r8:10c5387d r7:10c5387d
<31>[ 4573.560242] (3)[9113:logd.reader.per]logd: logd.reader.per thread stop.

Or when new upper memory, the kernel directly reported Internal error: Oops: 817 [# 1] PREEMPT SMP ARM error information when the allocated memory allocation is generally not, because the wiring and hardware Artboards multilayer circuit board ground and power are not properly handled reason, DDR generally run less than the highest frequency. This time you can try to reduce the frequency of DDR spot test analysis, to see whether it is the cause of DDR itself.

Methods as below:

modify:

vendor\mediatek\proprietary\bootable\bootloader\preloader\platform\ac8227l\src\drivers\emi.c

vendor\mediatek\proprietary\bootable\bootloader\preloader\platform\ac8227l\src\drivers\emi.c
/*
* mt_set_emi: Set up EMI/DRAMC.
*/
#if CFG_FPGA_PLATFORM
void mt_set_emi (void)
{
}
#else
void mt_set_emi (void)
{
    int index = 0;
    unsigned int val1,val2/*, temp1, temp2*/;
    EMI_SETTINGS *emi_set;
    unsigned int manu_id;
    *EMI_CONF = 0x004210000; // Enable EMI Address Scramble
   ....................................
  #if COMBO_LPDDR2 > 0

   #ifdef VCORE_VMEM_ADJUST_IN_PRELOADER
    #if VcHV_VmHV
		pmic_Vcore_adjust(Vcore_HV_LPDDR2);
		pmic_Vmem_adjust(Vmem_HV_LPDDR2);
    #elif VcLV_VmLV
		pmic_Vcore_adjust(Vcore_LV_LPDDR2);
		pmic_Vmem_adjust(Vmem_LV_LPDDR2);
    #else
		pmic_Vcore_adjust(Vcore_NV_LPDDR2);
		pmic_Vmem_adjust(Vmem_NV_LPDDR2);
    #endif
		emi_pmic_voltage_read(0);
    #endif //#ifdef VCORE_VMEM_ADJUST_IN_PRELOADER

    #ifdef MEMPLL_INIT_V1_0
		mt_mempll_init(DDR800, DDR_PLL_MODE); //DDR2的数据传输速率配置为DDR800
		//mt_mempll_init(DDR1066, DDR_PLL_MODE); //DDR2的数据传输速率配置为DDR1033 DDR2最高只能到DDR1033
		print("[EMI] LPDDR2 DRAM Clock = %d KHz, MEMPLL MODE = %d \r\n",     4*mt_get_mem_freq(), DDR_PLL_MODE);
    #else
		print("[EMI] LPDDR2 DRAM Clock = %d MHz, MEMPLL MODE = %d \r\n", DDR_MEMPLL, DDR_PLL_MODE);
    #endif
  .........................
  #if COMBO_LPDDR3 > 0
    #ifdef VCORE_VMEM_ADJUST_IN_PRELOADER
    #if VcHV_VmHV
		pmic_Vcore_adjust(Vcore_HV_LPDDR3);
		pmic_Vmem_adjust(Vmem_HV_LPDDR3);
    #elif VcLV_VmLV
		pmic_Vcore_adjust(Vcore_LV_LPDDR3);
		pmic_Vmem_adjust(Vmem_LV_LPDDR3);
    #else
		pmic_Vcore_adjust(Vcore_NV_LPDDR3);
		pmic_Vmem_adjust(Vmem_NV_LPDDR3);
    #endif
		emi_pmic_voltage_read(0);
    #endif //#ifdef VCORE_VMEM_ADJUST_IN_PRELOADER

    #ifdef MEMPLL_INIT_V1_0
		//mt_mempll_init(DDR1333, DDR_PLL_MODE);  //DDR3的数据总线速率配置DDR1333
		//mt_mempll_init(DDR800, DDR_PLL_MODE); //DDR3的数据总线速率配置DDR800
		mt_mempll_init(DDR1066, DDR_PLL_MODE);  //DDR3的数据总线速率配置DDR1066
		//mt_mempll_init(533, DDR_PLL_MODE); //only for lp3 bring up  use
		print("[EMI] LPDDR3 DRAM Clock = %d KHz, MEMPLL MODE = %d \r\n", 4*mt_get_mem_freq(), DDR_PLL_MODE);
    #else
		print("[EMI] LPDDR3 DRAM Clock = %d MHz, MEMPLL MODE = %d \r\n", DDR_MEMPLL, DDR_PLL_MODE);
    #endif

    #ifdef REXTDN_ENABLE
		print("[EMI] PCDDR3 RXTDN Calibration:\r\n");
		ett_rextdn_sw_calibration();
    #endif
		init_lpddr3(emi_set);
    #else
        print("[EMI]donot support  LPDDR3!!!!!!!!\r\n");
        ASSERT(0);
    #endif
    }
    else if ((emi_set->type & 0xF) == TYPE_PCDDR3)
    {
    #if COMBO_PCDDR3 > 0
        //----------------------------------------
        //1.default Vcore 1.125V , Vmem 1.350V, HV/LV only for HQA stress test
    #ifdef VCORE_VMEM_ADJUST_IN_PRELOADER
    #if VcHV_VmHV
        pmic_Vcore_adjust(Vcore_HV_PCDDR3);
        pmic_Vmem_adjust(Vmem_HV_PCDDR3);
    #elif VcLV_VmLV
        pmic_Vcore_adjust(Vcore_LV_PCDDR3);
        pmic_Vmem_adjust(Vmem_LV_PCDDR3);
    #else
        pmic_Vcore_adjust(Vcore_NV_PCDDR3);
        pmic_Vmem_adjust(Vmem_NV_PCDDR3);
    #endif
        emi_pmic_voltage_read(0);
    #endif //#ifdef VCORE_VMEM_ADJUST_IN_PRELOADER

		//2.mempll init
    #ifdef MEMPLL_INIT_V1_0
		//mt_mempll_init(DDR1333, DDR_PLL_MODE);//DDR3的数据总线速率配置DDR1333
		//mt_mempll_init(DDR800, DDR_PLL_MODE); //DDR3的数据总线速率配置DDR800
		mt_mempll_init(DDR1066, DDR_PLL_MODE);  //DDR3的数据总线速率配置DDR1066
		print("[EMI] PCDDR3 DRAM Clock = %d KHz, MEMPLL MODE = %d \r\n", 4*mt_get_mem_freq(), DDR_PLL_MODE);
    #else
        print("[EMI] PCDDR3 DRAM Clock = %d MHz, MEMPLL MODE = %d \r\n", DDR_MEMPLL, DDR_PLL_MODE);
    #endif
    .....................................
    
  

After modifying preloader.bin good compiler can download test, DDR stress test can use the following script to test, as follows:

linux环境monkey.sh:
#!/bin/bash     
while true
do
     adb shell svc wifi enable
     adb shell monkey 100000 --throttle 3000 --ignore-crashes  --kill-process-after-error
     sleep 3
done

windows环境monkey.bat:
:one
::adb shell monkey 100000 --ignore-crashes  --ignore-native-carshes --monitor-native-crashes --ignore-security-exceptions --ignore-security-exceptions 
adb shell svc wifi enable
adb shell monkey 100000 --throttle 3500  --ignore-crashes  --kill-process-after-error
::sleep 3
goto two

:two
adb shell svc wifi enable
adb shell monkey 100000 --throttle 3500  --ignore-crashes  --kill-process-after-error
::sleep 3
goto one

Event delay is 3 seconds, ignoring local collapse process, kill the monkey error process continues to run after a system error occurs, because they do not kill the general terms for the APP platform code can not test a lot of anomalies, this stability can test kernel. When tested, the first open mtklog, printed to the screen when you open an exception, then mtklog tool retreated backstage. After more than monkey began to run scripts. When the screen print /data/vendor/mtklog/aee_exp/db.fatal.00.KE log information is collected when a kernel panic occurs after a system restart occurs, we can unlock the file for analysis. If a system reboot does not appear, and the screen did not print db.fatal.XX.KE print, that is the main chip with DDR or hardware does not match (run less than the normal rate) problem can be resolved down (to sacrifice system performance).

Guess you like

Origin blog.csdn.net/jinron10/article/details/88823738