09-29-2023, 09:37 AM
(09-27-2023, 02:14 AM)balbes150 Wrote:(09-26-2023, 09:21 AM)MichaIng Wrote: If someone can show me a method to enable device tree overlays on-the-fly on mainline Linux 6.5.y, I am open to try it. I have however never seen such, despite for a very short time on Raspberry Pi with their vendor kernel/bootloader and "dtoverlay" command, which worked with only a very small number of their overlays, while in most cases it just caused kernel errors and did not enable the intended functionality. From that point on I was pretty sure that there is no reliable way to enable kernel device tree overlays on-the-fly, but I am open to be proven wrong.
In the meantime, even extlinux has support for (not on-the-fly) device tree overlays with fdtoverlay setting, so theoretically we could add some. Our U-Boot might be too old, as it is still a fork based on 2022.10, but I should be able to switch to mainline U-Boot, now that it supports adding (the sadly needed) SPL and DDR blobs properly.
But, it might be easier to enable I2S/SPI/... interfaces just OOTB, as long as they do not collide and the GPIO pins do not have conflicting uses.
link
https://forum.armbian.com/topic/24931-ar...ent=160812
Thanks. However, it does not seem to work reliably. Tested on VisionFive 2:
Code:
root@DietPi:~# cd /sys/kernel/config/device-tree/overlays
root@DietPi:/sys/kernel/config/device-tree/overlays# mkdir test
root@DietPi:/sys/kernel/config/device-tree/overlays# cat /boot/dietpi-visionfive2-8GB.dtbo > test/dtbo
root@DietPi:/sys/kernel/config/device-tree/overlays# cat test/status
applied
root@DietPi:/sys/kernel/config/device-tree/overlays# free -m
gesamt benutzt frei gemns. Puffer/Cache verfügbar
Speicher: 3872 659 2753 198 700 3213
Swap: 0 0 0
root@DietPi:/sys/kernel/config/device-tree/overlays# dmesg | tail -1
[62252.093999] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /memory@40000000/reg
So the overlay was applied successfully, in this case for 8 GiB RAM support, but it did not have an effect. The very same was the case with the majority of the RPi overlays I tested this (with their dtoverlay comnmand) a while ago. I think most features simply cannot be changed or added plug&play with the device tree, but the kernel and/or driver(s) need to initialise with them being set in the first place. And the memory leak warning was the very same on RPi and at least does not sound great, though I am not 100% sure if/when/how this applies or not.