This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
products:sbc:common:configurations:device-tree-overlay [2022/09/05 02:55] nick |
products:sbc:common:configurations:device-tree-overlay [2023/11/07 04:18] (current) nick |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Device Tree Overlay ====== | ====== Device Tree Overlay ====== | ||
| - | ===== Introduction ===== | + | We can use DT overlays to enable/ |
| - | You can use Device Tree Overlay to enable or disable the peripherals without recompiling the kernel source code. | + | ===== DT collections |
| - | ^ | + | https://github.com/khadas/khadas-linux-kernel-dt-overlays |
| - | ^ VIM1 | + | |
| - | ^ VIM2 | + | |
| - | ^ VIM3 | + | |
| - | ^ VIM3L | / | + | |
| - | ^ VIM1S | / | + | |
| - | ^ VIM4 | + | |
| - | ^ Edge2 | / | + | |
| - | ^ Edge1 | / | + | |
| - | | ::: | + | |
| - | <tabbox VIM1/ | + | ===== Device Reference Table ====== |
| - | <WRAP tip > | + | ^ |
| - | This page takes VIM3 as an example, which can be different from yours but the structure is the same. | + | ^ VIM1 |
| - | </WRAP> | + | ^ VIM2 |
| + | ^ | ||
| + | | ::: | ||
| + | ^ VIM3L | 4.9/ | ||
| + | | ::: | ||
| + | ^ VIM1S | 5.4/ | ||
| + | ^ VIM4 | ||
| + | ^ Edge2 | 5.10 | / | ||
| + | ^ Edge1 | 4.4 | ||
| + | | ::: | ::: | / | ||
| + | ===== Device Configurations ===== | ||
| - | The dtbo files are stored in directory '' | + | <tabbox VIM1/2/3/3L/Edge1> |
| - | ```txt | + | DT-overlays '' |
| - | khadas@Khadas:~$ ll / | + | |
| - | total 40 | + | |
| - | drwxr-xr-x 2 root root 4096 Jan 29 11:13 ./ | + | |
| - | drwxr-xr-x 6 root root 4096 Jan 29 11:13 ../ | + | |
| - | -rw-r--r-- 1 root root 352 Jan 29 09:35 disable-ts050.dtbo | + | |
| - | -rw-r--r-- 1 root root 223 Jan 29 09:35 i2c3.dtbo | + | |
| - | -rw-r--r-- 1 root root 277 Jan 29 09:35 m2x-eth.dtbo | + | |
| - | -rw-r--r-- 1 root root 472 Jan 29 09:35 onewire.dtbo | + | |
| - | -rw-r--r-- 1 root root 1072 Jan 29 09:35 os08a10.dtbo | + | |
| - | -rw-r--r-- 1 root root 345 Jan 29 09:35 pwm_f.dtbo | + | |
| - | -rw-r--r-- 1 root root 447 Jan 29 09:35 spi1.dtbo | + | |
| - | -rw-r--r-- 1 root root 225 Jan 29 09:35 uart3.dtbo | + | |
| - | ``` | + | |
| <WRAP important > | <WRAP important > | ||
| - | **#BOARD#** should be '' | + | **BOARD** should be '' |
| </ | </ | ||
| - | The releated dtbo configuration file is ''/ | + | <WRAP tip > |
| + | Next example for VIM3 device, which can be different for other device, but the structure | ||
| + | </ | ||
| ```shell | ```shell | ||
| + | khadas@Khadas: | ||
| + | disable-ts050.dtbo | ||
| + | i2c3.dtbo | ||
| + | m2x-eth.dtbo | ||
| + | onewire.dtbo | ||
| + | os08a10.dtbo | ||
| + | pwm_f.dtbo | ||
| + | spi1.dtbo | ||
| + | uart3.dtbo | ||
| + | ``` | ||
| + | |||
| + | DT-overlays configuration file: | ||
| + | |||
| + | ```txt / | ||
| # Device Tree Overlays | # Device Tree Overlays | ||
| # | # | ||
| Line 61: | Line 64: | ||
| ``` | ``` | ||
| - | '' | + | * default '' |
| + | * If you want to disable '' | ||
| + | * If you want to enable '' | ||
| - | * If you want to disable '' | + | <tabbox VIM3 with 5.15 kernel> |
| - | * If you want to enable '' | + | DT-overlays |
| - | <tabbox VIM4> | + | ```shell |
| + | khadas@Khadas: | ||
| + | uart3.dtbo | ||
| + | pwm_f.dtbo | ||
| + | i2c3.dtbo | ||
| + | spi1.dtbo | ||
| + | os08a10.dtbo | ||
| + | onewire.dtbo | ||
| + | disable-ts050.dtbo | ||
| + | m2x-eth.dtbo | ||
| + | otg-device.dtbo | ||
| + | ``` | ||
| - | The dtbo files are stored in directory | + | DT-overlays configuration file: ''/ |
| + | <tabbox VIM3L with 5.15 kernel> | ||
| + | |||
| + | DT-overlays '' | ||
| + | |||
| + | ```shell | ||
| + | khadas@Khadas: | ||
| + | uart3.dtbo | ||
| + | pwm_f.dtbo | ||
| + | i2c3.dtbo | ||
| + | spi1.dtbo | ||
| + | os08a10.dtbo | ||
| + | onewire.dtbo | ||
| + | disable-ts050.dtbo | ||
| + | m2x-eth.dtbo | ||
| + | otg-device.dtbo | ||
| ``` | ``` | ||
| - | khadas@Khadas: | + | |
| - | total 28 | + | DT-overlays configuration file: ''/ |
| - | drwxr-xr-x 2 root root 4096 Jul 6 14:55 . | + | |
| - | drwxr-xr-x 3 root root 4096 Jul 6 14:55 .. | + | <tabbox VIM4> |
| - | -rwxr-xr-x 1 root root 462 Jul 6 14:55 ext_board.dtbo | + | |
| - | -rwxr-xr-x 1 root root 223 Jul 6 14:55 i2cm_a.dtbo | + | DT-overlays '' |
| - | -rwxr-xr-x 1 root root 223 Jul 6 14:55 i2cm_f.dtbo | + | |
| - | -rwxr-xr-x 1 root root 225 Jul 6 14:55 pwm_f.dtbo | + | ```shell |
| - | -rwxr-xr-x 1 root root 225 Jul 6 14:55 uart_e.dtbo | + | khadas@Khadas: |
| + | ext_board.dtbo | ||
| + | i2cm_a.dtbo | ||
| + | i2cm_f.dtbo | ||
| + | pwm_f.dtbo | ||
| + | uart_e.dtbo | ||
| ``` | ``` | ||
| - | The releated dtbo configuration file is ''/ | + | DT-overlays |
| <tabbox VIM1S> | <tabbox VIM1S> | ||
| - | The dtbo files are stored in directory ''/ | + | DT-overlays '' |
| + | ```shell | ||
| + | khadas@Khadas: | ||
| + | i2cm_b.dtbo | ||
| + | i2cm_e.dtbo | ||
| + | pwm_f.dtbo | ||
| + | uart_c.dtbo | ||
| ``` | ``` | ||
| - | khadas@Khadas: | + | DT-overlays configuration file is ''/ |
| - | total 28 | + | |
| - | drwxrwxr-x 2 root root 4096 Aug 19 09:21 ./ | + | |
| - | drwxr-xr-x 3 root root 4096 Aug 19 09:21 ../ | + | |
| - | -rw-rw-r-- 1 root root 223 Aug 12 10:59 i2cm_b.dtbo | + | |
| - | -rw-rw-r-- 1 root root 223 Aug 12 10:59 i2cm_e.dtbo | + | |
| - | -rw-rw-r-- 1 root root 345 Aug 12 10:59 pwm_f.dtbo | + | |
| - | -rw-rw-r-- 1 root root 225 Aug 12 10:59 uart_c.dtbo | + | |
| - | ``` | + | |
| - | + | ||
| - | The releated dtbo configuration file is ''/ | + | |
| <tabbox Edge2> | <tabbox Edge2> | ||
| - | The dtbo files are stored in directory ''/ | + | DT-overlays '' |
| - | ``` | + | ```shell |
| khadas@Khadas: | khadas@Khadas: | ||
| mipi-panel.dtbo | mipi-panel.dtbo | ||
| ``` | ``` | ||
| - | The releated dtbo configuration file is ''/ | + | DT-overlays |
| </ | </ | ||
| - | ===== Configuration ===== | + | ===== Configuration |
| - | If you want to enable the peripherals, | + | You need to edit the DT overlays |
| + | ===== Make custom DT Overlays ===== | ||
| - | ===== Make Your Own DTBO Files ===== | + | There are some preparations steps for DT overlays '' |
| - | There are some preparations using dtbo files, you can also add your own dtbos to enable or disable the peripherals. | + | ==== Write DT Overlay Source==== |
| + | Basic DT overlay source example: | ||
| - | * Write your own Device Tree Overlay file, for example: | + | ```dts |
| /dts-v1/; | /dts-v1/; | ||
| /plugin/; | /plugin/; | ||
| Line 141: | Line 174: | ||
| ``` | ``` | ||
| - | * Compile | + | ==== Compile |
| - | khadas@Khadas: | + | |
| - | khadas@Khadas: | + | ```sh |
| - | example.dtbo | + | dtc -I dts -O dtb -o example.dtbo example.dts |
| ``` | ``` | ||
| - | * Copy the dtbo file to dtbo directory | + | ==== Copy DT Overlays |
| - | * VIM1/ | + | |
| - | **#BOARD#** should be '' | + | * VIM3 with 5.15 kernel is ''/ |
| + | * VIM3L with 5.15 kernel is ''/ | ||
| + | * VIM4 is ''/ | ||
| + | * VIM1S is ''/ | ||
| + | * Edge2 is ''/ | ||
| + | | ||
| + | |||
| + | <WRAP important > | ||
| + | **BOARD** should be '' | ||
| </ | </ | ||
| - | * VIM4 is ''/ | ||
| - | * VIM1S is ''/ | ||
| + | ==== Edit DT Overlays Configuration ==== | ||
| + | |||
| + | Edit list variable value inside DT overlay configuration file: | ||
| + | |||
| + | * VIM1/ | ||
| + | * VIM3 with 5.15 kernel is ''/ | ||
| + | * VIM3L with 5.15 kernel is ''/ | ||
| + | * VIM4 is ''/ | ||
| + | * VIM1S is ''/ | ||
| + | * Edge2 is ''/ | ||
| - | * Edit dtbo configuration file and add '' | + | ==== Reboot ==== |
| - | * VIM1/ | + | |
| - | * VIM4 is ''/ | + | |
| - | * VIM1S is ''/ | + | |
| - | * Reboot the board | + | Need reboot |