当前位置:网站首页>A40i/T3 uboot启动时对PMU部分初始化
A40i/T3 uboot启动时对PMU部分初始化
2022-07-31 11:52:00 【szembed】
全志A40i/T3核心板使用的是:AXP221s电源管理芯片。
因此上电起来需要做的工作之一就是初始化这个电源管理芯片。
而主控Arm与该芯片的通讯接口为I2C(这个视每个不同的PMU管理芯片情况而定)。
因此在初始化该芯片前,还需要先初始化Arm的I2C总线。
一. 初始化I2C总线
函数调用路径,从 init_fnc_t * init_sequence[] 开始:
-> init_fnc_t * init_sequence[] // uboot的启动初始化函数数组
-> static int init_func_pmubus(void) // 初始化i2c总线,为下一步初始化PMU模块做准备
I2C总线相关函数主要集中在“sunxi_i2c.c”文件内,主要是对I2C总线,时钟和寄存器进行初始化。
-> void i2c_init(int speed, int slaveaddr)
-> int sunxi_i2c_init(int bus_num,int speed, int slaveaddr)
-> void sunxi_i2c_bus_setting(int bus_num) // 配置i2c总线
-> void i2c_set_clock(int bus_num,int speed) // 配置i2c功能时钟
至此I2C总线初始化完毕。如果配置成功,则保存读写函数指针。
i2c_read_pt = sunxi_i2c_read;
i2c_write_pt = sunxi_i2c_write;
二. 然后就是核心板的PMU模块初始化。
-> int power_source_init(void)
-> // 从sys_config.fex中读取相关配置参数
nodeoffset = fdt_path_offset(working_fdt,FDT_PATH_POWER_SPLY);
if(nodeoffset >=0)
{
fdt_getprop_u32(working_fdt, nodeoffset, "dcdc2_vol", &dcdc_vol);
}
if(!dcdc_vol)
{
cpu_vol = 900;
}
else
{
cpu_vol = dcdc_vol%10000;
}
-> // 初始化CPU电源管理模块(PMU),并配置相关电源参数
axp_exist = axp_probe();
if(axp_exist)
{
axp_probe_factory_mode();
if(!axp_probe_power_supply_condition())
{
//PMU_SUPPLY_DCDC2 is for cpua
if(!axp_set_supply_status(0, PMU_SUPPLY_DCDC2, cpu_vol, -1))
{
tick_printf("PMU: dcdc2 %d\n", cpu_vol);
sunxi_clock_set_corepll(uboot_spare_head.boot_data.run_clock);
}
else
{
printf("axp_set_dcdc2 fail\n");
}
}
else
{
printf("axp_probe_power_supply_condition error\n");
}
}
else
{
printf("axp_probe error\n");
}
-> // 参数获取验证pll_cpux = sunxi_clock_get_corepll();
tick_printf("PMU: cpux %d Mhz,AXI=%d Mhz\n", pll_cpux,sunxi_clock_get_axi());
printf("PLL6=%d Mhz,AHB1=%d Mhz, APB1=%dMhz MBus=%dMhz\n", sunxi_clock_get_pll6(),
sunxi_clock_get_ahb(),
sunxi_clock_get_apb(),
sunxi_clock_get_mbus());if(axp_exist)
{
axp_set_charge_vol_limit();
axp_set_all_limit();
axp_set_hardware_poweron_vol();
axp_set_power_supply_output();
//power_config_gpio_bias();
power_limit_init();
}
主要做的:读取sys_config.fex,初始化一些参数。包括: axp221设备地址(axp221是通过i2c连接到soc上的) 电池容量 电池充电电流 电池充电电压 预充电时间 持续充电时间等。
这个根据Arm主控要求和芯片特性来。
我也没有深入追踪,有兴趣的朋友可以找到这款PMU的芯片手册结合代码看看。
至此对PMU部分的初始化完成~!
边栏推荐
- lotus-local-net 2k v1.17.0-rc4
- Redis - Basics
- JVS轻应用的组成与配置
- In PLC communication error or timeout or download the prompt solution of the model
- Distributed id solution
- 分布式事务——分布式事务简介、分布式事务框架 Seata(AT模式、Tcc模式、Tcc Vs AT)、分布式事务—MQ
- Summary of several defragmentation schemes for MySQL (to solve the problem of not releasing space after deleting a large amount of data)
- B/S架构模式的一个整体执行流程
- ESP8266-Arduino编程实例-HDC1008温度湿度传感器驱动
- 2022/7/28
猜你喜欢

Experience innovation and iteration through the development of lucky draw mini-programs

DCM middleware family welcomes a new member

Android studio connects to MySQL and completes simple login and registration functions

CoCube群机器人预览→资讯剧透←

MySQL index usage and optimization

Redis - Basics

ApiPost is really fragrant and powerful, it's time to throw away Postman and Swagger

JVS应用中心

apisix-Getting Started

基于C51实现按键控制
随机推荐
How to correctly write the binary stream of the file returned by the server to the local file and save it as a file
安装MYSQL遇到问题:write configuration file卡主
SAP Commerce Cloud Product Review 的添加逻辑
最全phpmyadmin漏洞汇总
音视频基础
Read through the interface to call the artifact RestTemplate
Docker installs canal and mysql for simple testing and achieves cache consistency between redis and mysql
一文带你了解redux的工作流程——actionreducerstore
deeplab实现自己遥感地质分割数据集
R语言做面板panelvar例子
Three-tier architecture service, dao, controller layer
矩形脉冲波形的占空比及脉冲和瞬态特征的测量
LeetCode 1161.最大层内元素和:层序遍历
Service discovery of kubernetes
mysql根据多字段分组——group by带两个或多个参数
ApiPost 真香真强大,是时候丢掉 Postman、Swagger 了
Use jOOQ to write vendor-agnostic SQL with JPA's native query or @Formula.
无法将“node.exe”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。
Use Excel to read data exposed by SAP ABAP CDS View through ODBC
Android studio connects to MySQL and completes simple login and registration functions