cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
thburghout
Participant
Participant
8,603 Views
Registered: ‎10-27-2017

Setting GPIO output value in device tree

Hi all,

 

Due to a custom board originally used with bare metal firmware; I need to set a gpio pin to HIGH. Without this the ethernet peripheral does not function. I want this done as soon in the boot process as possible to make sure the correct driver is loaded when detecting the device.

 

My best guess would be to do this in the device tree, I think this should be done in system-user.dtsi. But I'm not sure what I should add. I tried the following adjustment

 

 

/include/ "system-conf.dtsi"
/ {
};

&gem1 {
	enable-gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
};

But this does not compile, which I don't understand since I don't see any syntax error when looking at https://www.kernel.org/doc/Documentation/devicetree/bindings/gpio/gpio.txt and UG1144.

 

 

The error log looks like this:

 

DEBUG: Executing shell function do_compile
Error: /home/user/project/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/system-user.dtsi:5.28-29 syntax error
FATAL ERROR: Unable to parse input tree
WARNING: /home/user/project/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/temp/run.do_compile.30153:1 exit 1 from 'dtc -I dts -O dtb -R 8 -p 0x1000 -i /home/user/project/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0 -i /home/user/project/build/../components/plnx_workspace/device-tree-generation -o /home/user/project/build/../components/plnx_workspace/device-tree-generation/plnx_arm-system.dtb /home/user/project/build/../components/plnx_workspace/device-tree-generation/plnx_arm-system.pp'
ERROR: Function failed: do_compile (log file is located at /home/user/project/build/tmp/work/plnx_arm-xilinx-linux-gnueabi/device-tree-generation/xilinx+gitAUTOINC+43551819a1-r0/temp/log.do_compile.30153)

Any ideas? do I need to use a separate node? If so, which one? 

Thanks!

 

0 Kudos
4 Replies
jrhtech
Voyager
Voyager
8,573 Views
Registered: ‎10-04-2017

Add #include <dt-bindings/gpio/gpio.h>
0 Kudos
sandeepg
Moderator
Moderator
8,557 Views
Registered: ‎04-24-2017

Refer our wiki examples.

 

http://www.wiki.xilinx.com/Linux+GPIO+Driver

http://www.wiki.xilinx.com/AXI+GPIO

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
0 Kudos
thburghout
Participant
Participant
8,550 Views
Registered: ‎10-27-2017

Thanks, the include solved the compilation issue.

 

Unfortunately the ethernet driver does not use the enable-gpios. So it's probably not possible to have it grouped together. I will try with the resources you posted.

0 Kudos
Renan
Visitor
Visitor
1,577 Views
Registered: ‎10-02-2020

Did you get it solved? I am trying to do the exact thing. Configure a GPIO as HIGH to enable the GEM.

0 Kudos