2019-12-09 03:29 PM
Hi,
Is there any example showing how to configure a simple GPIO line using DeviceTree? I would like to set the pullup/pulldown or open drain and then use the /sys/class/gpio to read or write the value. The only example I can find is the GPIO setting for particular peripheral and not for standalone input/output pin.
I have added the following section to the &pinctrl in my device tree but I think it has no effect on the pins configuration.
gpio_pins_mx: gpio_pins_mx-0 {
u-boot,dm-pre-reloc;
pins {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('D', 11, GPIO)>,
<STM32_PINMUX('C', 0, GPIO)>,
<STM32_PINMUX('B', 7, GPIO)>;
bias-pull-down;
};
};
Thank you,
Chris
2019-12-12 02:16 AM
Hi @Community member
Did you refer to https://wiki.st.com/stm32mpu/wiki/GPIO_device_tree_configuration ?
Did you check same pin are not used / configured for another peripheral ?
Olivier
2019-12-12 02:44 AM
Yes, I know this document, but is it not clear to me how i should configure the standalone GPIO. The article specifies the foo-device that controls the GPIO, however I need to configure a GPIO for the independent control with the /sys/class/gpio subsystem. The pins I listed are not used by any other device, but I suspect that I need to refer to them in the root node somehow.
I am able to control the GPIO by exporting them and using the direction and value files, however i still don't know hot to set the pull-ups etc.
Chris
2022-10-09 06:34 PM
I would also be interested in this. The only answer I found so far is writing a dummy driver existing solely, so we can declare something in the device tree and reference the pinctrl node for our GPIO. There has got to be a simpler solution.