当前位置:网站首页>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部分的初始化完成~!
边栏推荐
- 结构化查询语言SQL-关系数据库标准语言
- JVS应用中心
- The item 'node.exe' was not recognized as the name of a cmdlet, function, script file, or runnable program.
- R 语言data.frame 中的另一行中减去一行
- pycharm汉化教程(碧蓝幻想汉化插件安装)
- How MySQL's allowMultiQueries flag relates to JDBC and jOOQ
- CameraToolUnity中两种摄像机的两种观察控制方式
- [Virtualization ecological platform] Raspberry Pi installation virtualization platform operation process
- 2022/7/28
- ApiPost 真香真强大,是时候丢掉 Postman、Swagger 了
猜你喜欢
随机推荐
PyQt5快速开发与实战 9.5 PyQtGraph在PyQt中的应用 && 9.6 Plotly在PyQt中的应用
结构化查询语言SQL-关系数据库标准语言
ESP8266-Arduino编程实例-PIR(被动红外)传感器驱动
便利贴--46{基于移动端长页中分页加载逻辑封装}
vb.net 画曲线
MySQL limit paging query and performance issues
淀粉与纤维素
才22岁!这位'00后'博士拟任职985高校!
蓝牙协议栈开发板 STM32F1 跑蓝牙协议栈 –传统蓝牙搜索演示以及实现原理[通俗易懂]
file contains vulnerabilities
R语言做面板panelvar例子
MySQL日志中“binlog”的三种格式玩起来真爽
IDEA configure method annotation automatic parameters
订song餐系统
Summary of several defragmentation schemes for MySQL (to solve the problem of not releasing space after deleting a large amount of data)
JVS开发套件产品定位
The item 'node.exe' was not recognized as the name of a cmdlet, function, script file, or runnable program.
502 bad gateway causes and solutions
MySql模糊查询大全
keras自带数据集(横线生成器)