I tried to set some GPIOs via the GPIO SYSFS interface, but they don't switch as expected. What changes are required in the device tree?
Here is an example showing how to mux an LCD pin as GPIO in the PD15.1.0 phyCORE-AM335x BSP. With minor node and pad muxing syntax changes, this example is applicable to other PHYTEC BSPs that use device trees.
Add the following code in the device tree to set LCD_DATA0 to GPIO2_6 (mux mode 7):
Check for any other references to the pin you are setting and remove these or disable the node in the dts. In this case, LCD_DATA0 is being set to LCD in am335x-phytec-lcd-018.dtsi:
Since the am335x-phytec-lcd-018.dtsi is an expansion board, barebox is configured to enable these nodes on booting the kernel. Please see How to Enable Expansion Boards in barebox for Yocto AM335x for instructions on disabling LCD pins.
Rebuild the device tree (dependent on BSP, for the PD15.1.0 AM335x, linux-ti is the kernel recipe):
- To verify that the output of the GPIO pin can now be toggled, boot the board with this new device tree and follow the commands below:
(Note: For the AM335x processor, the GPIO number corresponds to 32*Bank + (gpio), so gpio2_6 is gpio70)