Jump to content

DTB overlay problems and w1-gpio not working (25.2.0-trunk.124_Tinkerboard-2_bookworm_current_6.6.63)


Recommended Posts

Posted

Hello, I have installed the "Armbian_community_25.2.0-trunk.124_Tinkerboard-2_bookworm_current_6.6.63_minimal.img.xz" image on my tinkerboard-2 to develop a library for one wire devices.

 

There is a problem with the usage of armbian-config on activating overlays. The entry in armbianEnv.txt includes the prefix in the overlay name. This can be workarounded manually, e.g. for w1-gpio the correct entry needs to be:
 

overlays=rk3399-w1-gpio2

 

If anyone can point me to the source code I maybe can provide a PR to fix it.

Another problem is the content of the overlay of this w1-gpio.

 

After activating the dmesg give an error (the first warning is normal and also exist on my working w1-gpio with tinkerboard1):
 

sudo dmesg | grep one
[    8.630758] gpio-36 (onewire@0): enforced open drain please flag it properly in DT/ACPI DSDT/board file
[    8.630883] OF: /onewire@0: could not get #gpio-cells for /vop@ff8f0000/port/endpoint@3
[    8.630926] w1-gpio onewire@0: gpio_request_one (ext_pullup_enable_pin) failed
[    8.630934] w1-gpio: probe of onewire@0 failed with error -22

 

Reloading the module "w1_gpio" each time leads to the same output.

 

Decompiling the overlay gives this content:

/dts-v1/;

/ {
        compatible = "rockchip,rk3399";

        fragment@0 {
                target-path = "/";

                __overlay__ {

                        onewire@0 {
                                compatible = "w1-gpio";
                                pinctrl-names = "default";
                                gpios = <0xffffffff 0x04 0x00 0xae>;
                                status = "okay";
                                phandle = <0x01>;
                        };
                };
        };

        __symbols__ {
                w1 = "/fragment@0/__overlay__/onewire@0";
        };

        __fixups__ {
                gpio1 = "/fragment@0/__overlay__/onewire@0:gpios:0";
        };
};

 

The difference to the tinkerboard1 overlay seems to be the structure of the "gpios" line. Normally there are 3 values only. Some searching in the latest Kernel documentation do not give me a hint that there is something changed in the past, but maybe I'm wrong here.

My first try was to remove the last value, compiling the dtbo and test it. There is no error anymore in the dmesg output. Also the gpio-36 is now shown:
 

sudo cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-31, parent: platform/ff720000.gpio, gpio0:
 gpio-3   (                    |act-led             ) out lo
 gpio-4   (                    |pwr-led             ) out hi
 gpio-10  (                    |rsv-led             ) out lo
 gpio-12  (                    |ep                  ) out hi

gpiochip1: GPIOs 32-63, parent: platform/ff730000.gpio, gpio1:
 gpio-35  (                    |vbus-5vout          ) out lo
 gpio-36  (                    |onewire@0           ) out lo
 gpio-46  (                    |vsel                ) out lo
 gpio-49  (                    |vsel                ) out lo

 

Nevertheless it is not working. On the tinkerboard1 the gpio output is a bit different (gpio-17 is "out hi"):
 

sudo cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-23, parent: platform/ff750000.gpio, gpio0:
 gpio-3   (                    |led-2               ) out hi
 gpio-5   (                    |GPIO Key Power      ) in  hi IRQ ACTIVE LOW
 gpio-11  (                    |dvs                 ) out hi
 gpio-12  (                    |dvs                 ) out lo
 gpio-17  (                    |onewire@0           ) out hi


How can I proceed at this point with debugging and error catching?

Thanks Thomas

Posted

Good news - it is working now!

 

As you can see here, the "gpio-36" is not available on 40-pin-header. The overlay needs to be manipulated. This can be done with the following steps:

  • choose the gpio number from the link above (consider the "forbidden" yellow marked pins)
  • the gpios are organized in lines of 32 gpios, so 0-31 is line 0, 32-63 is line 1 and so on (see also output of "cat /sys/kernel/debug/gpio")
  • the GPIO-description GPIO<line>_<bank><number> helps us to change the overlay values
  • if the choosen number will be "gpio-8", you can see it is header pin 7 and located on "GPIO0_B0"
  • so the line needs to be changed from "gpio1" to "gpio0" in the overlay "__fixups__" section
  • the pin-number "0x04" (coming from the gpio-36 = offset 32 for line 1 plus 0x04) needs to be changed to "0x08" (0x08 plus 0 as offset from line 0)
  • after that changes the overlay can be compiled and activated like mentioned in the former post

If someone can point me to the sources I can create a PR for fixup.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines