SPI 速度优化,提升DDR 频率+CPU频率

MTK SPI 速度优化,提升DDR 频率+CPU频率

 

是指VCORE ddr的改动. 

一、Kernel的接口拉CPU频率,可以使用接口:

/kernel-4.4/drivers/misc/mediatek/include/mt-plat/mt6758/include/mach/mtk_ppm_api.h

extern void mt_ppm_sysboost_freq(enum ppm_sysboost_user user, unsigned int freq);

 

目前UT是预留出来的.

//引入头文件

#include "mach/mtk_ppm_api.h"

//request:

mt_ppm_sysboost_freq(BOOST_BY_UT,2340000);

//release:

mt_ppm_sysboost_freq(BOOST_BY_UT, 0);

 
获取CPU的频率:
可以读一下节点:
大核:

cat /proc/cpufreq/MT_CPU_DVFS_L/cpufreq

小核:

cat /proc/cpufreq/MT_CPU_DVFS_LL/cpufreq

 

 
二、在下面两只文件加入高亮的部分
drivers/misc/mediatek/base/power/include/vcorefs_v3/mtk_vcorefs_governor.h
@@ -52,6 +52,7 @@ enum dvfs_kicker {
                    KIR_BOOTUP,
                    KIR_FBT,
                    KIR_WIFI,
                    KIR_SPI,
                    KIR_SYSFS,
                    KIR_MM_NON_FORCE,
                    KIR_SYSFS_N,
drivers/misc/mediatek/base/power/vcorefs_v3/mtk_vcorefs_governor.c
@@ -147,6 +147,7 @@ static char *kicker_name[] = {
                    "KIR_BOOTUP",
                    "KIR_FBT",
                    "KIR_WIFI",
                    "KIR_SPI",
                    "KIR_SYSFS",
                    "KIR_MM_NON_FORCE",
                    "KIR_SYSFS_N",

 

需要加入头文件

#include

api: int vcorefs_request_dvfs_opp(enum dvfs_kicker kicker, enum dvfs_opp opp)

parameters:

1) kicer: KIR_SPI

2) opp:

                   OPP_0  for 3200/0.8V

                   OPP_1  for 2667/0.7V

                   OPP_2  for 1600/0.7V

                   OPP_UNREQ for release request

 

e.g.

1.//request dvfs floor to 3200

vcorefs_request_dvfs_opp(KIR_WIFI, OPP_0);

2.//release request

vcorefs_request_dvfs_opp(KIR_WIFI, OPP_UNREQ );   

 

enum dvfs_opp {

                    OPP_UNREQ = -1,

                    OPP_0 = 0,

                    OPP_1,

                    OPP_2,

                    NUM_OPP,

                    };

 

Note1: 因為 api內用到mutex, 外層不能用spinlock. 且要能允許sleep

Note2: request, 請一定要有 un-request, 不然有可能拉住系統最低檔位造成power issue.

 

Vcore读频率:

Cat /sys/power/vcorefs/vcore_debug

下面的数值变成0

sw_opp: 0

 

高通SPI频率,只能在数组中选:


static struct clk_freq_tbl ftbl_blsp_spi_apps_clk_src[] = {
    F(    960000,              xo,   10,    1,     2),
    F(   4800000,              xo,    4,    0,     0),
    F(   9600000,              xo,    2,    0,     0),
    F(  12500000, gpll0_main_div2,   16,    1,     2),
    F(  16000000,           gpll0,   10,    1,     5),
    F(  19200000,              xo,    1,    0,     0),
    F(  25000000,           gpll0,   16,    1,     2),
    F(  50000000,           gpll0,   16,    0,     0),
    F_END
};
 

你可能感兴趣的:(SPI 速度优化,提升DDR 频率+CPU频率)