硬件平台:rv1108
在内核中实现使用pinctrl子系统控制gpio主要实在两个方面:dts文件的节点的添加和驱动代码的编写。
1.dts文件的修改
在kernel/arch/arm/boot/dts/rv1108-evb-v12.dts中添加如下信息:
mz391_gpio_rst:mz391_gpio_rst {
compatible = "rk,mz391-rst";
pinctrl-names = "mz391-rst-on", "mz391-rst-off";
pinctrl-0 = ;
pinctrl-1 = ;
};
在 kernel/arch/arm/boot/dts/rv1108.dtsi
gpio3a3_low {
mz391_resetpin_on: pin_gpio3a3_low {
rockchip,pins = <3 GPIO_A3 RK_FUNC_GPIO &pcfg_output_low>;
};
mz391_resetpin_off: pin_gpio3a3_high {
rockchip,pins = <3 GPIO_A3 RK_FUNC_GPIO &pcfg_output_high>;
};
};
2.驱动代码
包括makefile和Kconfig的编写。
#include
#include
#include
#include
#include
#i