电源管理
芯片为AXP803,完整电源轨定义。
pmu0: pmu@34 {
compatible = "x-powers,axp803";
...
regulator0: regulators@0 {
reg_dcdc1: dcdc1 { regulator-name = "axp803-dcdc1"; ... };
reg_dcdc2: dcdc2 { regulator-name = "axp803-dcdc2"; ... };
...
};
};GPIO
//#define GPIO_FUNCTION_OUTPUT 0 (可设置高低电平)
//#define GPIO_FUNCTION_INPUT 1 (可读取状态)
//#define GPIO_FUNCTION_IRQ 2 中断功能(触发)
//#define GPIO_FUNCTION_FLASH 3 用作 Flash IO
//#define GPIO_FUNCTION_OUTPUT_CTRL 4 受控输出(可能由其他信号控制)
status = "okay";
compatible = "yz_gpio"; //定义了一个自定义的 yz_gpio 节点。
yz_gpio { //gpio_function = <num> 0: 输出,1: 输入,2: 中断
PB3 { gpio_function = <0>; }; // 输出
PE3 { gpio_function = <1>; }; // 输入
...
};I²C
twi1: twi@0x05002400 { //twi设备,上挂了RTC时钟电池
status = "okay";
pcf8563 {
compatible = "nxp,pcf8563"; // RTC 芯片
reg = <0x51>;
};
};
twi2: twi@0x05002800 { //上挂触摸芯片GT911
status = "okay";
ctp {
compatible = "allwinner,goodix"; // GT911 触摸屏
reg = <0x14>;
ctp_name = "GT911_1024x600"; //分辨率1024x600
};
};
twi3: twi@0x05002c00{
clock-frequency = <200000>;
pinctrl-0 = <&twi3_pins_a>;
pinctrl-1 = <&twi3_pins_b>;
status = "disabled"; //默认为禁用SPI
可挂 MCP2515 CAN 控制器(默认禁用)
spi1: spi@05011000 { //SPI1总线上挂两个can控制器
pinctrl-0 = <&spi1_pins_a &spi1_pins_b>;
pinctrl-1 = <&spi1_pins_c>;
spi_slave_mode = <0>;
spi1_cs_bitmap = <3>;
spi1_cs_number = <2>;
status = "disabled";
can0 {
device_type = "can0";
...
status = "disabled"; //默认状态为禁用,TSI需改成“okay"
};
can1{
device_type = "can1";
...
status = "disabled";
};
spidev {
compatible = "helpera133_spidev";
spi-max-frequency = <10000000>;
reg =<0x0>;
status = "disabled";
};
};spi1: spi@05011000 {
can0 { compatible = "microchip,mcp2515"; ... };
can1 { compatible = "microchip,mcp2515"; ... };
spidev { compatible = "helpera133_spidev"; ... };
};存储
sdc2: sdmmc@04022000 { //板载emmc
non-removable;
bus-width = <8>; //8bit总线
...
status = "disabled"; //默认禁用
};
sdc0: sdmmc@04020000 { //TF卡槽配置
bus-width = <4>; //4bit总线
cd-gpios = <&pio PF 6 6 1 3 0xffffffff>; // 卡检测引脚
...
status = "okay"; //默认启用
};USB
*usb_port_type: usb mode. 0-device, 1-host, 2-otg. #USB模式
*usb_detect_type: usb hotplug detect mode. 0-none, 1-vbus/id detect, 2-id/dpdm detect. #USB 热插拔检测方式
*usb_id_gpio: gpio for id detect.
*usb_det_vbus_gpio: gpio for id detect. gpio or "axp_ctrl";
*usb_wakeup_suspend:0-SUPER_STANDBY, 1-USB_STANDBY. #USB 唤醒模式usbc0:usbc0@0 {
device_type = "usbc0";
usb_port_type = <0x2>; //OTG模式
...
status = "okay";
};
...
usbc1:usbc1@0 {
...
status = "okay"; //HOST模式
};音频
Audio Driver Modules
codec:codec@0x05096000 {
/* MIC and headphone gain setting */ //耳机和MIC
mic1gain = <0x1F>; //MIC1 增益 (最大 0x1F = 31)
mic2gain = <0x1F>;
...
status = "okay"; //默认启用
};
...显示
配置方法查看屏参配置文件
lcd0: lcd0@01c0c000 {
};模拟键盘
使用 ADC 电压检测来模拟按键输入
/********************************************
voltage function
115 KEY_VOLUMEUP
114 KEY_VOLUMEDOWN
102 KEY_HOME
158 KEY_BACK
139 KEY_MENU
*********************************************/
keyboard {
compatible = "allwinner,keyboard_1350mv";
status = "disabled"; //默认禁用
key_cnt = <5>; //5个按键
key0 = <115 115>;
key1 = <236 114>;
key2 = <361 102>;
key3 = <477 158>;
key4 = <591 139>;
};WIFI
wlan: wlan@0 {
compatible = "allwinner,sunxi-wlan";
wlan_busnum = <0x1>; // 使用 SDIO1 总线
wlan_power = "axp803-dcdc1"; // 电源
wlan_io_regulator = "axp803-dldo1";
wlan_regon = <&r_pio PL 5 1 ...>; // 模块电源控制脚
wlan_hostwake = <&r_pio PL 6 6 ...>; // 模块唤醒主机 GPIO
chip_en;
power_en;
status = "okay"; //默认启用
};蓝牙
//bt节点:蓝牙电源和复位引脚配置
bt: bt@0 {
compatible = "allwinner,sunxi-bt";
bt_power = "axp803-dldo1"; // 电源
bt_rst_n = <&r_pio PL 2 1 ...>; // 复位引脚
status = "okay"; //默认打开
};
//btlpm节点:蓝牙低功耗管理(LPM),指定 UART1 通信,GPIO 用于 wake/hostwake
btlpm: btlpm@0 {
compatible = "allwinner,sunxi-btlpm";
uart_index = <0x1>; // 使用 UART1
bt_wake = <&r_pio PL 4 1 ...>;
bt_hostwake = <&r_pio PL 3 6 ...>;
status = "okay";
};地址管理 (addr_mgt)
addr_mgt: addr_mgt@0 { //负责 WiFi/BT/Ethernet MAC 地址管理,避免冲突。
compatible = "allwinner,sunxi-addr_mgt";
type_addr_wifi = <0x0>; //0x0通常表示随机生成或者使用eFuse/OTP地址
type_addr_bt = <0x0>;
type_addr_eth = <0x0>;
status = "okay";
};UART 串口
uart0: uart@05000000 {
uart-supply = <®_dcdc1>; // 电源
};
uart1: uart@05000400 {
uart1_type = <4>; // 蓝牙 UART
uart1_port = <1>;
status = "okay";
};
uart2: uart@05000800 {
uart2_type = <2>; // 通用 UART
uart2_port = <2>;
use_dma = <2>; // 启用 DMA
status = "okay";
};
uart3: uart@05000c00 {
pinctrl-0 = <&uart3_pins_a>;
pinctrl-1 = <&uart3_pins_b>;
uart3_type = <2>;
status = "disabled";
};
uart4: uart@05001000 {
pinctrl-0 = <&uart4_pins_a>;
pinctrl-1 = <&uart4_pins_b>;
uart4_type = <2>;
status = "disabled";
};以太网
启动流程:上电供电 → 时钟初始化 → PHY 复位 → 驱动绑定 → eth0 就绪
gmac0: eth@05020000 { //GMAC0 = 千兆以太网控制器
compatible = "allwinner,sunxi-gmac";
...
phy-mode = "rgmii"; // RGMII 接口
tx-delay = <2>; // TX 时钟延时
rx-delay = <2>; // RX 时钟延时
phy-rst = <&pio PH 11 1 0 1 0>; // PHY 复位引脚
gmac-power0 = "axp803-dldo2:2500000"; // 2.5V
gmac-power1 = "axp803-eldo2:1800000"; // 1.8V
gmac-power2 = "axp803-fldo1:1200000"; // 1.2V
pinctrl-0 = <&gmac_pins_baijie>;
status = "okay";
};GPU
gpu: gpu@0x01800000 {
gpu_idle = <0>; //0:默认不进入idle低功耗状态; 1:GPU在空闲时会自动降频或关断
dvfs_status = <1>; //1:启用DVFS功能(动态电压频率调整)
pll_rate = <504000>; //默认工作频率
independent_power = <0>; //0:GPU和CPU共用电源域; 1:GPU独立电源控制(支持单独上电/关断)
operating-points = < //定义4个运行点(频率/电压对)
/* KHz uV */
504000 950000 //504MHz 0.95V
472500 950000
441000 950000 //只有频率变化,电压不随频率变化
252000 950000
>;
gpu-supply = <®_dcdc4>;
};CPU电源
&cpu0 {
cpu-supply = <®_dcdc2>; //CPU电源由DCDC2提供
};作者:maikiloy 创建时间:2025-12-12 17:16
最后编辑:zheng 更新时间:2025-12-23 14:16
最后编辑:zheng 更新时间:2025-12-23 14:16