How to correctly configure PAD as gpio

cancel
Showing results for 
Search instead for 
Did you mean: 

How to correctly configure PAD as gpio

224 Views
a_dimuoio
Contributor I

Hello, everybody.
I'm working on an imx6q, I'm trying to configure the PAD
MX6QDL_PAD_EIM_DA15__EIM_AD15
as a gpio in the devicetree to use it as digital input.

After reading imx6q-pinfunc.h and detecting
#define MX6QDL_PAD_EIM_DA15__EIM_AD15 0x150 0x464 0x000 0x0 0x0
I saw that the gpio function corresponds to the 0x5 functionality, so I configured the devicetree as below:

gpiogrp {
   fsl,pins = <0x150 0x464 0x000 0x5 0x0 0x0 0x1b0b0>
   linux,phandle = <0x49>;
   phandle = <0x49>;
};

gpio@020a4000 {
   compatible = "fsl,imx6q-gpio", "fsl,imx35-gpio";
   reg = <0x20a4000 0x4000>;
   interrupts = <0x0 0x46 0x4 0x0 0x47 0x4>;
   gpio-controller;
   interrupt-controller;
   linux,phandle = <0x47>;
   phandle = <0x47>;
};

gpiocust {
   pinctrl-names = "default";
   pinctrl-0 = <0x49>;
   status = "okay";
   gpios = <0x47 0x0f 0x01>;
};

But the read value is always 0;
What am I doing wrong?

Thanks for your help.Istantanea_2020-05-11_17-35-15.png

Labels (1)
Tags (2)
0 Kudos
2 Replies

109 Views
igorpadykov
NXP TechSupport
NXP TechSupport

Hi Antonio

what bsp used in the case, recommended to use some from

source.codeaurora.org/external/imx/linux-imx nxp repository:

linux-imx - i.MX Linux kernel 

linux documentation:

i.MX Software and Development Tools | NXP 

gpio example :

Simple GPIO Example - quandry 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

109 Views
a_dimuoio
Contributor I

Hi Igor, thanks for the help

This link is really usefull Simple GPIO Example - quandry 

I've finally understand how to configure the gpio PAD, and the use of the SION bit configured by pinctrl.

Thanks!!!

0 Kudos