How to properly configure GPIO in dts for ccimx6ul6bc?

As I currently understand it the ioexpander on the ccimx6ulsbc is not yet supported in 2.0-r5. I do however want to start working with the available GPIOs.

I believe I am able to use MCA_IO2 as a gpio so I look to Documentation/devicetree/bindings/gpio/gpio-mca-cc6ul.txt. I see the entry

mca: mca-ccul@7e {
compatible = “digi,mca-cc6ul-gpio”;
#gpio-cells = <2>;

What else am I missing to add this to imx6ul-ccimx6ulsbc-id135.dts? As it stands it would obviously cause a syntax error.

Also I want to get control of nets EXP_GPIO_3, EXP_GPIO_2, and EXP_GPIO1 which are connected to GPIO1_2, GPIO1_3 and GPIO1_5 respectively. As far as enabling these ports in the dts, do I look towards Documentation/devicetree/bindings/gpio/fsl-imx-gpio.txt? Also how do I map port and channel in the example provided?

gpio0: gpio@73f84000 {
compatible = “fsl,imx51-gpio”, “fsl,imx35-gpio”;
reg = <0x73f84000 0x4000>;
interrupts = <50 51>;
#gpio-cells = <2>;
#interrupt-cells = <2>;

The formula to calculate the GPIO number in software is:
32 *(GPIO_BANK-1)+GPIO_Number = Software GPIO Number
32 *(3–1)+11 = 75

MCA GPIOs are not supported yet, I believe, but you should be able to use i.mx6ul processor GPIOs

take a look here:

also I do not think you need to modify device tree to use GPIO is it’s not defined there for something else. You can do it from user space:

Output GPIO (LED):
A device node for GPIO75 is not set in our system, we have to create it using the console (GTKTerm):

cd /sys/class/gpio


echo 75 > export

echo out > gpio75/direction

• To read and write GPIO values on the command line, use:

cat gpio75/value

echo 1 > gpio75/value

echo 0 > gpio75/value

Input GPIO (button):
A device node for GPIO67 is not set in our system, we have to create it using the console (GTKTerm):

cd /sys/class/gpio


echo 67 > export

echo in > gpio67/direction

• To read GPIO value on the command line, use:

cat gpio75/value

you can also do it from C code. Let me know if you need an example.

1 Like