How to set GPIO initial setting for i.MX8M Mini.

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to set GPIO initial setting for i.MX8M Mini.

跳至解决方案
1,546 次查看
tan-k
Contributor III

Hi,

We use custom board using i.MX8M Mini.
And we try to change OS based on Linux for i.MX (Linux 5.4.70_2.3.0).
We have some additional GPIO for output and input.
Could you please let us know how to set these direction in kernel?
We need to change device tree? Could you please show example?
Also, we need to get and set the value of GPIO in user space.

Any help would be appreciated.

Thank you.

Best regards,

0 项奖励
回复
1 解答
1,538 次查看
igorpadykov
NXP Employee
NXP Employee

Hi TANAKA

 

>Could you please let us know how to set these direction in kernel?
>We need to change device tree? Could you please show example?

 

not possible to set direction and set the value of GPIO in device tree, one can

set them in uboot, example:

https://source.codeaurora.org/external/imx/uboot-imx/tree/board/freescale/imx8mm_evk/spl.c?h=imx_v20...

https://source.codeaurora.org/external/imx/uboot-imx/tree/include/asm-generic/gpio.h?h=imx_v2020.04_...


>Also, we need to get and set the value of GPIO in user space.

 

one can look at example

https://variwiki.com/index.php?title=MX8M_GPIO&release=RELEASE_HARDKNOTT_V1.0_DART-MX8M-MINI

 

Best regards
igor

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,539 次查看
igorpadykov
NXP Employee
NXP Employee

Hi TANAKA

 

>Could you please let us know how to set these direction in kernel?
>We need to change device tree? Could you please show example?

 

not possible to set direction and set the value of GPIO in device tree, one can

set them in uboot, example:

https://source.codeaurora.org/external/imx/uboot-imx/tree/board/freescale/imx8mm_evk/spl.c?h=imx_v20...

https://source.codeaurora.org/external/imx/uboot-imx/tree/include/asm-generic/gpio.h?h=imx_v2020.04_...


>Also, we need to get and set the value of GPIO in user space.

 

one can look at example

https://variwiki.com/index.php?title=MX8M_GPIO&release=RELEASE_HARDKNOTT_V1.0_DART-MX8M-MINI

 

Best regards
igor

0 项奖励
回复
1,523 次查看
tan-k
Contributor III

Hi,

Thank you for your reply.
We referred to your URL and could set GPIO in uboot.
Also, we could set and get the value GPIO via /sys/class/gpio.

Best regards,

0 项奖励
回复