How to configure Input/Output a GPIO in Devicetree?

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

How to configure Input/Output a GPIO in Devicetree?

11,427 次查看
alokpawar
Contributor I

Hi All,

I am using yocto 1.6 daisy branch with kernel 3.10.17.

I am able to configure all platform data and pin-muxing correctly.

I have a query in that... How can we configure a GPIO that is Input/output in device tree?

I didn't find anything in device tree.

I have two GPIO in which one is input and other output, i am able to configure everything successfully.

But need to ask where i can define those pin as Input or Output ... In device tree? ... or ... in board file? ... or in driver?

Thanks

Alks

标签 (5)
0 项奖励
3 回复数

9,763 次查看
avni
Contributor I

I want to set GPIO2_IO14 as output and set pin to 1 in device tree file.

what are the changes needed for that?

标记 (2)
0 项奖励

10,390 次查看
lategoodbye
Senior Contributor I

Hi Alok,

the purpose of the devicetree is to describe the hardware and not it's configuration. As far as i know it's not possible to set the GPIO direction directly via DT. But if you assign the GPIO to assigned function like a LED and the led driver would do that for you.

In the case you want to keep them as GPIOs you can set direction in board file or via sysfs.

BR Stefan

0 项奖励

10,390 次查看
igorpadykov
NXP Employee
NXP Employee

Hi Alok

I think there is no intuitively clear description,

one can just look at examples

Re: Any examples on how to modify the .dts (device tree) source for custom hardware?

Definitive GPIO guide - Studio Kousagi Wiki

http://lxr.free-electrons.com/source/Documentation/devicetree/bindings/gpio/gpio.txt

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------

0 项奖励