|
【Linux】
Enable internal GPIO pull-up in DTS
Posted at 11/7/2024 07:38:45
View:242
|
Replies:0
Print
Only Author
[Copy Link]
1#
Last edited by ivan.p In 11/7/2024 07:44 Editor
Hi!
What is the right way to enable internal pull-up, with the ability to read the pin value after the system starts?
We need to use a configuration jumpers to dustinguish between device revisions.
The idea is:
* The internal pin pull-up is enabled
* The pin value is read
* The pins which have a jumper connected to the ground will have a value of 0, others - a value of 1.
We have tried to modify the Device Tree creating a device node (sorry, have not find a way to properly format the dts fragment)
/ {
board-id {
compatible = "firefly-gpio";
//compatible = "firefly,rk3308-gpio";
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&board_id_pin0>;
firefly-gpio = <&gpio0 RK_PC5 GPIO_ACTIVE_HIGH>;
};
};
&pinctrl {
board-id-pins {
board_id_pin0: board-id-pin0 {
rockchip,pins = <0 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
};
board_id_pin1: board-id-pin1 {
rockchip,pins = <0 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>;
};
board_id_pin2: board-id-pin2 {
rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
According to syslog, the "board-id" device is created, but
cat /sys/kernel/debug/pinctrl/pinctrl/pinmux-pins
and
cat /sys/kernel/debug/gpio
show no results - the pins remain uninitialized.
|
|