mx6ul gpio 在device tree 中的配置

转载地址:http://blog.chinaunix.net/uid-22670933-id-5761825.html

内核版本:linux-3.14.38


以GPIO1_IO13为例:
1. 在arch/arm/boot/dts/imx6ul-14x14-evk.dts中:
 pinctrl_hog_1: hoggrp-1 {
                        fsl,pins = <
 
                               MX6UL_PAD_LCD_RESET__WDOG1_WDOG_ANY   0x30b0
                                MX6UL_PAD_UART1_RTS_B__GPIO1_IO19       0x17059
                                MX6UL_PAD_GPIO1_IO05__USDHC1_VSELECT    0x17059
                                MX6UL_PAD_GPIO1_IO09__GPIO1_IO09        0x17059

                                MX6UL_PAD_JTAG_TDI__GPIO1_IO13          0xC0000000     
                        >;
                };
MX6UL_PAD_JTAG_TDI__GPIO1_IO13:宏定义引脚JTAG_TDI功能复用为GPIO13;

0xC0000000:
  • 0x80000000 is special and means "I don't know and don't change from the default"
  • Bit 30 set to 1 means: software input on (SION) whcih means that the logical value of an output can be read back
注意:要把SION设为1,才可以用在gpio为output时读回,否则读回将为0。但根据Refernce Manual中,SION应该在software mux control registers的第四位,而0xC0000000设置的却是SW_PAD_CTL Register,而且Manual中也没看见这个寄存器能设置SION,这里很奇怪。

2. 在用户空间可控制gpio13:


echo 13 > /sys/class/gpio/export

echo out > /sys/class/gpio/gpio2/direction

echo 1 > /sys/class/gpio/gpio2/value

echo 0 > /sys/class/gpio/gpio2/value




参考链接:
https://github.com/FrankBau/meta-marsboard-bsp/wiki/iMX6-Pad-Mux-and-Pad-Control
http://cache.freescale.com/files/32bit/doc/app_note/AN5078.pdf
http://permalink.gmane.org/gmane.linux.ports.arm.kernel/295260
http://www.kosagi.com/w/index.php?title=Definitive_GPIO_guide#Linux_Device_Tree_Naming_Convention

你可能感兴趣的:(mx6ul gpio 在device tree 中的配置)