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):
&am33xx_pinmux { pinctrl-names = "default"; pinctrl-0 = <&miscgpio_pins>; miscgpio_pins: pinmux_miscgpio { pinctrl-single,pins = < 0xA0 (PIN_OUTPUT | MUX_MODE7) /* lcd_data0.gpio2_6 */ >; }; }; |
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:
&am33xx_pinmux { lcd_pins: pinmux_lcd { pinctrl-single,pins = < 0xA0 (PIN_OUTPUT | MUX_MODE0) /* lcd_data0.lcd_data0 */ 0xA4 (PIN_OUTPUT | MUX_MODE0) /* lcd_data1.lcd_data1 */ 0xA8 (PIN_OUTPUT | MUX_MODE0) /* lcd_data2.lcd_data2 */ 0xAC (PIN_OUTPUT | MUX_MODE0) /* lcd_data3.lcd_data3 */ 0xB0 (PIN_OUTPUT | MUX_MODE0) /* lcd_data4.lcd_data4 */ 0xB4 (PIN_OUTPUT | MUX_MODE0) /* lcd_data5.lcd_data5 */ 0xB8 (PIN_OUTPUT | MUX_MODE0) /* lcd_data6.lcd_data6 */ ... |
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):
bitbake linux-ti -f -c compile && bitbake linux-ti |
cd /sys/class/gpio echo 70 > export cd gpio70 echo out > direction echo 1 > value echo 0 > value |
Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.
|