RK3568技术笔记十八 Linux GPIO驱动程序中设备树分析

这段代码是RK3568芯片的设备树(Device Tree)片段,用于描述GPIO控制器的配置。

pinctrl: pinctrl {

compatible = "rockchip,rk3568-pinctrl"; // 兼容性字符串,指定此设备树节点适用于RK3568的引脚控制器

rockchip,grf = <&grf>; // 引用通用寄存器(GRF)

rockchip,pmu = <&pmugrf>; // 引用GPIO控制寄存器

#address-cells = <2>; // 指定地址长度的位数为32x2,也就是64位地址

#size-cells = <2>; // 指定每个地址的长度是32x2,也就是64位长度

ranges; // 指定地址映射范围

gpio0: gpio@fdd60000 { // GPIO控制器0的描述,0xfdd60000是GPIO0的起始地址,这是从RK3568TRM里面截图出来的信息,一一对应了。

compatible = "rockchip,gpio-bank"; // 兼容性字符串,指定这是Rockchip GPIO控制器,为了通配GPIO

reg = <0x0 0xfdd60000 0x0 0x100>; // 寄存器地址和大小

interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>; // 中断配置

clocks = <&pmucru PCLK_GPIO0>, <&pmucru DBCLK_GPIO0>; // 时钟源配置

gpio-controller; // 标识这是一个GPIO控制器

#gpio-cells = <2>; // 每个GPIO单元的属性位数(标识和偏移)

gpio-ranges = <&pinctrl 0 0 32>; // GPIO范围配置

interrupt-controller; // 标识这是一个中断控制器

#interrupt-cells = <2>; // 每个中断单元的属性位数

};

cpp 复制代码
gpio1: gpio@fe740000 {
		compatible = "rockchip,gpio-bank";
		reg = <0x0 0xfe740000 0x0 0x100>;
		interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
		clocks = <&cru PCLK_GPIO1>, <&cru DBCLK_GPIO1>;

		gpio-controller;
		#gpio-cells = <2>;
		gpio-ranges = <&pinctrl 0 32 32>;
		interrupt-controller;
		#interrupt-cells = <2>;
	};

	gpio2: gpio@fe750000 {
		compatible = "rockchip,gpio-bank";
		reg = <0x0 0xfe750000 0x0 0x100>;
		interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
		clocks = <&cru PCLK_GPIO2>, <&cru DBCLK_GPIO2>;

		gpio-controller;
		#gpio-cells = <2>;
		gpio-ranges = <&pinctrl 0 64 32>;
		interrupt-controller;
		#interrupt-cells = <2>;
	};

	gpio3: gpio@fe760000 {
		compatible = "rockchip,gpio-bank";
		reg = <0x0 0xfe760000 0x0 0x100>;
		interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
		clocks = <&cru PCLK_GPIO3>, <&cru DBCLK_GPIO3>;

		gpio-controller;
		#gpio-cells = <2>;
		gpio-ranges = <&pinctrl 0 96 32>;
		interrupt-controller;
		#interrupt-cells = <2>;
	};
相关推荐
0xDevNull16 分钟前
Linux切换JDK版本详细教程
linux
进击的丸子25 分钟前
虹软人脸服务器版SDK(Linux/ARM Pro)多线程调用及性能优化
linux·数据库·后端
齐生141 分钟前
iOS 知识点 - IAP 是怎样的?
笔记
tingshuo291714 小时前
D006 【模板】并查集
笔记
Johny_Zhao1 天前
OpenClaw安装部署教程
linux·人工智能·ai·云计算·系统运维·openclaw
tingshuo29171 天前
S001 【模板】从前缀函数到KMP应用 字符串匹配 字符串周期
笔记
chlk1233 天前
Linux文件权限完全图解:读懂 ls -l 和 chmod 755 背后的秘密
linux·操作系统
舒一笑3 天前
Ubuntu系统安装CodeX出现问题
linux·后端
改一下配置文件3 天前
Ubuntu24.04安装NVIDIA驱动完整指南(含Secure Boot解决方案)
linux
深紫色的三北六号3 天前
Linux 服务器磁盘扩容与目录迁移:rsync + bind mount 实现服务无感迁移(无需修改配置)
linux·扩容·服务迁移