Change Pinfunction

Hello,
I would like to change my pinfunctions. Is it possilble only to change “imx6q-pinfunc.h” in /arch/arm/boot/dts or have I to change also other things?

Thanks
Michael

hi @Michael_I

Which pin function do you want to change?

I would like to change following Pins to GPIO Function:
-2,4,6,49,83,89,91,95,176,178,184,186,188,202,204,214,216,217,279,281,287,289

And Pin 17 as SDA (to ALT2).

Thanks a lot.

For this you have to read the following guide to change the device tree files. Usually you don’t have to touch *-pinfunc.h file, since this is defined by the Soc.

Additionally Information about Gpio numbering in Linux can be found here.

I have already read that guide, but can you send an example? I have build a new device Tree file for my evaluation board. It looks like that :

/*
 * Copyright 2014-2016 Toradex AG
 * Copyright 2012 Freescale Semiconductor, Inc.
 * Copyright 2011 Linaro Ltd.
 *
 * The code contained herein is licensed under the GNU General Public
 * License. You may obtain a copy of the GNU General Public License
 * Version 2 or later at the following locations:
 *
 * http://www.opensource.org/licenses/gpl-license.html
 * http://www.gnu.org/copyleft/gpl.html
 */

/dts-v1/;

#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include "imx6q.dtsi"
#include "imx6qdl-apalis.dtsi"
#include "imx6qdl-apalis-eval.dtsi"

/ {
	model = "Toradex Apalis iMX6Q/D Module on Apalis Evaluation Board";
	compatible = "toradex,apalis_imx6q-eval", "toradex,apalis_imx6q",
		     "fsl,imx6q";
};

What must i add to reconfigure Port 156 and Port 157 (UART1 RX and TX) as GPIO?

Thanks

hi @Michael_I

If you have a custom board, then it is a good thing to create a new file for the board.
What do you mean this port 156 (UART1 RX or 157 TX)? Are you talking about SOC Ports. You should consult the Datasheet of the Module Apalis iMX6 and check there, which SODIMM Pin you want to use for your GPIO functionality.

So if you mean the SODIMM PIN 156, 157, then you should do the following:
SODIMM 156 → SD1_DATA0 and GPIO2_IO02
SODIMM 157 → Unfortunately this SODIMM has no GPIO functionality.

So for SODIMM 156, you edit the file imx6qdl-apalis.dtsi (at module level) under the node &iomuxc you add the following:

pinctrl_additionalgpio: additionalgpios {
fsl,pins = <
MX6QDL_PAD_NANDF_D2__GPIO2_IO02 0x1b0b0
>;
};

Further, you should delete this pin from other functionalities (look for MX6QDL_PAD_NANDF_D2 in all the imx6 apalis device tree files) .

Once you compiled and flashed the device tree file to the module, then you can control this pin as gpio in Linux.