平台:OKMX6Q-S 系统:Linux 内核版本:linux-3.0.35
本次修改将原SD卡功能占用的部分引脚释放,复用为gpio。具体的gpio号需要参考CPU手册(IMX6DQRM.pdf)的第四章,Chapter 4 External Signals and Pin Multiplexing。 1、修改流程 修改文件arch/arm/mach-mx6/board-mx6q_sabresd.h(四核)或者arch/arm/mach-mx6/board-mx6dl_sabresd.h(双核),在其中增加如下定义: /*GPIO*/ MX6Q_PAD_SD3_CLK__GPIO_7_3,
MX6Q_PAD_SD3_CMD__GPIO_7_2, MX6Q_PAD_SD3_DAT2__GPIO_7_6, MX6Q_PAD_SD3_DAT3__GPIO_7_7, MX6Q_PAD_SD3_DAT4__GPIO_7_1, MX6Q_PAD_SD3_DAT5__GPIO_7_0, MX6Q_PAD_SD3_DAT6__GPIO_6_18, MX6Q_PAD_SD3_DAT7__GPIO_6_17, MX6Q_PAD_NANDF_D1__GPIO_2_1, MX6Q_PAD_NANDF_D0__GPIO_2_0, 将原来的SD卡的功能注释掉 /* USDHC3 */ /*
MX6Q_PAD_SD3_CLK__USDHC3_CLK_50MHZ, MX6Q_PAD_SD3_CMD__USDHC3_CMD_50MHZ,
MX6Q_PAD_SD3_DAT0__USDHC3_DAT0_50MHZ,
MX6Q_PAD_SD3_DAT1__USDHC3_DAT1_50MHZ,
MX6Q_PAD_SD3_DAT2__USDHC3_DAT2_50MHZ,
MX6Q_PAD_SD3_DAT3__USDHC3_DAT3_50MHZ,
MX6Q_PAD_SD3_DAT4__USDHC3_DAT4_50MHZ,
MX6Q_PAD_SD3_DAT5__USDHC3_DAT5_50MHZ,
MX6Q_PAD_SD3_DAT6__USDHC3_DAT6_50MHZ,
MX6Q_PAD_SD3_DAT7__USDHC3_DAT7_50MHZ,
MX6Q_PAD_NANDF_D0__GPIO_2_0,
MX6Q_PAD_NANDF_D1__GPIO_2_1, */
注:该版本的内核将引脚功能定义在arch/arm/plat-mxc/include/mach/iomux-mx6q.h文件中,其中对每个引脚的全部复用功能进行了定义,有兴趣可以看一下。
2、测试 GPIO 球号 定义 GPIO号 89 MX6Q_PAD_SD3_CLK__GPIO_7_3 195 91 MX6Q_PAD_SD3_CMD__GPIO_7_2 194 94 MX6Q_PAD_SD3_DAT2__GPIO_7_6 198 93 MX6Q_PAD_SD3_DAT3__GPIO_7_7 199 92 MX6Q_PAD_SD3_DAT4__GPIO_7_1 193 90 MX6Q_PAD_SD3_DAT5__GPIO_7_0 192 88 MX6Q_PAD_SD3_DAT6__GPIO_6_18 178 87 MX6Q_PAD_SD3_DAT7__GPIO_6_17 177 83 MX6Q_PAD_NANDF_D1__GPIO_2_1 33 84 MX6Q_PAD_NANDF_D0__GPIO_2_0 32 GPIO_M_N到GPIOX的算法,GPIOX=(M-1)*32+N,例如
GPIO_4_28=(4-1)*32+28=124
测试命令 echo
33 > /sys/class/gpio/export echo
out > /sys/class/gpio/gpio33/direction echo 1
> /sys/class/gpio/gpio33/value cat
/sys/class/gpio/gpio33/value |
|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )
GMT+8, 2024-11-22 05:10
Powered by Discuz! X3.4
© 2001-2013 Comsenz Inc.