how does it control the GPIO as input/output in DTS ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how does it control the GPIO as input/output in DTS ?

Jump to solution
7,608 Views
Luke-Hsieh
Contributor III

Hi,

I got this from pin tool, but it didn't configure input or output for each pin in generated file.

What shall I do to make IO20 & IO21 as input and IO22 - IO24 as output high ?

 

pinctrl_hog_1: hoggrp-1 {
fsl,pins = <
MX8MN_IOMUXC_SAI5_RXC_GPIO3_IO20 0x00000116
MX8MN_IOMUXC_SAI5_RXD0_GPIO3_IO21 0x00000116
MX8MN_IOMUXC_SAI5_RXD1_GPIO3_IO22 0x00000116
MX8MN_IOMUXC_SAI5_RXD2_GPIO3_IO23 0x00000116
MX8MN_IOMUXC_SAI5_RXD3_GPIO3_IO24 0x00000116
>;
};

0 Kudos
1 Solution
7,593 Views
igorpadykov
NXP Employee
NXP Employee

Hi Luke

 

"pinctrl_hog" configures pad settings, for example for

MX8MN_IOMUXC_SAI5_RXC_GPIO3_IO20 0x00000116 it is

register described in sect.8.2.5.203 Pad Control Register (IOMUXC_SW_PAD_CTL_PAD_SAI5_RXC)

i.MX 8M Nano Applications Processor Reference Manual

For GPIO direction one can look at linux documentation (hog definition) :

https://source.codeaurora.org/external/imx/linux-imx/tree/Documentation/devicetree/bindings/gpio/gpi...

 

Best regards
igor

View solution in original post

0 Kudos
6 Replies
7,594 Views
igorpadykov
NXP Employee
NXP Employee

Hi Luke

 

"pinctrl_hog" configures pad settings, for example for

MX8MN_IOMUXC_SAI5_RXC_GPIO3_IO20 0x00000116 it is

register described in sect.8.2.5.203 Pad Control Register (IOMUXC_SW_PAD_CTL_PAD_SAI5_RXC)

i.MX 8M Nano Applications Processor Reference Manual

For GPIO direction one can look at linux documentation (hog definition) :

https://source.codeaurora.org/external/imx/linux-imx/tree/Documentation/devicetree/bindings/gpio/gpi...

 

Best regards
igor

0 Kudos
7,509 Views
Luke-Hsieh
Contributor III

Hi Igor,

Thanks.

0 Kudos
7,518 Views
BiyongSUN
NXP Employee
NXP Employee

GPIO direction could be set in the DTS. 

and it is in the device tree binding guide. 

 

How to use gpio-hog demo
https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/How-to-use-gpio-hog-demo/ta-p/1317709

0 Kudos
7,584 Views
Luke-Hsieh
Contributor III

Hi Igor,

 

MX8MN_IOMUXC_SAI5_RXC_GPIO3_IO20 0x00000116

If I want a pull high, I shall change the value from 0x116 to 0x156, right ?

 

I'm a bit surprised that it can't change the GPIO direction and value in device tree is supported on other SoC.

Anyway, it is what it is.

Will it be configured as GPIO input if I configure it as an interrupt pin without any modifications in uboot ? Or I have to change the GPIO direction even it's a interrupt pin in DTS ?

 

Are there any API in kernel I can read/write the register value ?

Are there any utility in user space I can read/write the register value ?

This is helpful to confirm if I have a proper configuration if DTS and kernel driver.

Thanks.

 

0 Kudos
7,559 Views
BiyongSUN
NXP Employee
NXP Employee

This is linux question, not about the imx itself, please read the linux document.

Here is imx forum, not linux forum. 

config in dts, should be the gpio-hog. 

 

others must combined to a certain device such a phy, pcie, etc. 

Read the linux documents. strong suggest you to do it.  

Pin is not gpio.  GPIO is the same as uart, i2c.  without pin configuration. GPIO still can work, just no way output or input, linux uart could work without pin configuration. it is the same. 

Please make sure you understand the pin and the gpio, uart, etc. modules. 

GPIO is the same as ADC, SAI, Timer.  Pin is related to the IOMUX and IOMUX right side in this picture. 

pin pull up/down no any related to the GPIO input/output. pull up/down also can be use as ADC output or input  "pin".

“Other SOC”, which one. all the binding guide in linux is 

in the linux/Documentation/devicetree/bindings/gpio/. I don't find one not follow the linux. 

Some SOC has no pin/iomux. The GPIO pin is dedicated. no need to configurate the pin for GPIO. but still need to follow the linux to config the GPIO. 

 

 

Untitled.png

 

It is in very details. for the linux, next time read the linux documents. 

Before you say "surprise", make sure you understand the linux documents.

linux/Documentation/gpio/gpio.txt

linux/Documentation/gpio/sysfs.txt

linux/Documentation/devicetree/bindings/gpio/gpio.txt

 

How to use gpio-hog demo
https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/How-to-use-gpio-hog-demo/ta-p/1317709


Simple GPIO Example - quandry
https://community.nxp.com/t5/i-MX-Processors/Simple-GPIO-Example-quandry/m-p/458761#598834

Accessing GPIO From UserSpace
https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/Accessing-GPIO-From-UserSpace/ta-p/11131...

 

 

 

0 Kudos
7,548 Views
Luke-Hsieh
Contributor III

Hi BiyongSUN,

Noted! You're right.
I should ask the imx related in imx forum.
I'm sorry about the improper expression!

By the way.
I got the answer why the register value was 0x116 in sect.8.2.5.203 Pad Control Register (IOMUXC_SW_PAD_CTL_PAD_SAI5_RXC)
Thanks, Igorpadykov

 

0 Kudos