Firefly Open Source Community

   Login   |   Register   |
New_Topic
Print Previous Topic Next Topic

[Linux] Enable internal GPIO pull-up in DTS

87

Credits

0

Prestige

0

Contribution

registered members

Rank: 2

Credits
87

【Linux】 Enable internal GPIO pull-up in DTS

Posted at 11/7/2024 07:38:45      View:243 | 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.

Reply

Use props Report

You need to log in before you can reply Login | Register

This forum Credits Rules

Quick Reply Back to top Back to list