hello, I want to set the P9_21(gpio3) pin of Beaglebone Green to the output pin using Device Tree at startup, and set it to low level. So, I wrote the following pinctrl-test.dts and created pinctrl-test-00A0.dtbo.
/dts-v1/; /plugin/; / { compatible = "ti,beaglebone", "ti,beaglebone-black", "ti,beaglebone-green"; /* identification */ part-number = "pinctrl-test"; version = "00A0"; /* * Free up the pins used by the cape from the pinmux helpers. */ fragment@0 { target = <&ocp>; __overlay__ { P9_21_pinmux { status = "disabled"; }; /* uart2_txd */ P9_22_pinmux { status = "disabled"; }; /* uart2_rxd */ }; }; fragment@1 { target = <&am33xx_pinmux>; __overlay__ { pinctrl_test: pinctrl_test_pins { pinctrl-single,pins = < 0x154 0x07 /* P9_21 OUTPUT | MODE7 */ 0x150 0x3f /* P9_22 INPUT | MODE7 */ >; }; }; }; fragment@2 { target = <&ocp>; __overlay__ { test_helper: helper { compatible = "bone-pinmux-helper"; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_test>; status = "okay"; }; }; }; }; And the created pinctrl-test-00A0.dtbo is described in the /boot/uEnv.txt file as follows. (omission) ###Additional custom capes uboot_overlay_addr4=/lib/firmware/pinctrl-test-00A0.dtbo #uboot_overlay_addr5=/lib/firmware/<file5>.dtbo #uboot_overlay_addr6=/lib/firmware/<file6>.dtbo #uboot_overlay_addr7=/lib/firmware/<file7>.dtbo (omission) The mode of P9_21 pin is changed to 0x07 as follows, but the direction of /sys/class/gpio/gpio3 is still input. root@beaglebone:/sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single# cat pins | grep 954 pin 85 (PIN85) 44e10954 00000007 pinctrl-single root@beaglebone:/sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single# root@beaglebone:/sys/class/gpio/gpio3# cat direction in root@beaglebone:/sys/class/gpio/gpio3# Is the GPIO pin mode setting not reflected in the direction of /sys/class/gpio/gpio3 ? How can I set /sys/class/gpio/gpio3 as an output pin to low level by using device tree at startup ? The environment used is as follows. root@beaglebone:~# /opt/scripts/tools/version.sh git:/opt/scripts/:[b39ec679648a6be8f25f48bd1c9784c1fc5a0c46] eeprom:[A335BNLTBBG1BBG219036584] model:[TI_AM335x_BeagleBone_Green] dogtag:[BeagleBoard.org Debian Buster IoT Image 2020-04-06] bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2019.04-00002-g07d5700e21]:[location: dd MBR] bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2019.04-00002-g07d5700e21]:[location: dd MBR] UBOOT: Booted Device-Tree:[am335x-boneblack-uboot-univ.dts] UBOOT: Loaded Overlay:[AM335X-PRU-RPROC-4-19-TI-00A0] UBOOT: Loaded Overlay:[BB-ADC-00A0] UBOOT: Loaded Overlay:[BB-BONE-eMMC1-01-00A0] UBOOT: Loaded Overlay:[M-BB-BBG-00A0] kernel:[4.19.94-ti-r42] nodejs:[v10.15.2] /boot/uEnv.txt Settings: uboot_overlay_options:[enable_uboot_overlays=1] uboot_overlay_options:[uboot_overlay_addr4=/lib/firmware/pinctrl-test-00A0.dtbo] uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo] uboot_overlay_options:[enable_uboot_cape_universal=1] pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>] pkg:[bb-cape-overlays]:[4.14.20200430.0-0~buster+20200430] pkg:[bb-wl18xx-firmware]:[1.20200420.1-0~buster+20200424] pkg:[kmod]:[26-1] pkg:[librobotcontrol]:[1.0.4-git20190227.1-0rcnee0~buster+20190327] pkg:[firmware-ti-connectivity]:[20190717-2rcnee1~buster+20200305] groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal bluetooth netdev i2c gpio pwm eqep remoteproc admin spi iio docker tisdk weston-launch xenomai cloud9ide] cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet] dmesg | grep remote [ 61.814804] remoteproc remoteproc0: wkup_m3 is available [ 61.923073] remoteproc remoteproc0: powering up wkup_m3 [ 61.923101] remoteproc remoteproc0: Booting fw image am335x-pm-firmware.elf, size 217168 [ 61.923354] remoteproc remoteproc0: remote processor wkup_m3 is now up [ 63.522883] remoteproc remoteproc1: 4a334000.pru is available [ 63.525211] remoteproc remoteproc2: 4a338000.pru is available dmesg | grep pru [ 63.522883] remoteproc remoteproc1: 4a334000.pru is available [ 63.523050] pru-rproc 4a334000.pru: PRU rproc node pru@4a334000 probed successfully [ 63.525211] remoteproc remoteproc2: 4a338000.pru is available [ 63.525386] pru-rproc 4a338000.pru: PRU rproc node pru@4a338000 probed successfully dmesg | grep pinctrl-single [ 0.949822] pinctrl-single 44e10800.pinmux: 142 pins, size 568 dmesg | grep gpio-of-helper [ 0.963207] gpio-of-helper ocp:cape-universal: ready lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub END root@beaglebone:~# Regards, -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to beagleboard+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/2b7fa6bf-03a2-4831-b85e-b79adc51eab7o%40googlegroups.com.