|
|
(4 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
− | {{rockpi4_header}}
| |
− | {{Languages|rockpi4/hardware/devtree_overlays | Linux5.10 Device Tree Overlays}}
| |
| | | |
− | [[rockpi4 | ROCK Pi 4]] > [[rockpi4/hardware | Hardware]] > [[rockpi4/hardware/devtree_overlays | Linux5.10 Device Tree Overlays]]
| |
− |
| |
− | === Device Tree Overlays===
| |
− |
| |
− | ==== Introduction ====
| |
− |
| |
− | This directory contains Device Tree overlays. Device Tree makes it possible
| |
− | to support many hardware configurations with a single kernel and without the
| |
− | need to explicitly load or blacklisr kernel modules.
| |
− |
| |
− | On Radxa borad which uses linux5.10 kernel, you can use "rsetup" to load overlays that you want to enable, rsetup load overlays' dtbo from [[https://github.com/radxa/overlays/tree/main/arch/arm64/boot/dts/rockchip/overlays Radxa/overlay]]
| |
− |
| |
− |
| |
− | ==== How to enable a overlay dtbo ====
| |
− | ===== usage =====
| |
− | run "rsetup" command as below:
| |
− | radxa@rock-4c-plus:~$ rsetup
| |
− |
| |
− | Please select an option below:
| |
− |
| |
− | System Maintaince
| |
− | Onboard Hardware
| |
− | Overlay Management
| |
− | Connectivity
| |
− | User Settings
| |
− | Localization
| |
− | Common Tasks
| |
− | About
| |
− |
| |
− |
| |
− |
| |
− | <Ok> <Cancel>
| |
− |
| |
− |
| |
− | Select "Overlay Management"
| |
− |
| |
− | Configure Device Tree Overlay
| |
− | Install overlay from source
| |
− | Manage installed overlay
| |
− | Rebuild boot configuration
| |
− | Reset overlay libraries with kernel's default
| |
− |
| |
− |
| |
− | <Ok> <Cancel>
| |
− |
| |
− | Select "Manage installed overlay",
| |
− |
| |
− |
| |
− | [ ] audioinjector-isolated-soundcard.dtbo
| |
− | [ ] cm3-sodimm-io-sata.dtbo
| |
− | [ ] radxa-5inch-touchscreen-on-cm3-sodimm-io.dtbo
| |
− | [ ] radxa-5inch-touchscreen-on-rock-3a.dtbo
| |
− | [ ] radxa-5inch-touchscreen-on-rock-3b.dtbo
| |
− | [ ] radxa-cm3-io-dual-cameras-gc2053.dtbo
| |
− | [ ] radxa-cm3-io-hd101boe9365-display.dtbo
| |
− | [ ] radxa-cm3-io-headphone.dtbo
| |
− | [ ] radxa-cm3-io-i2c0-hym8563.dtbo
| |
− | [ ] radxa-cm3-io-pcie2x1.dtbo
| |
− | [ ] radxa-cm3-io-radxa-10p1inch-display.dtbo
| |
− | [ ] radxa-cm3-io-sata1.dtbo
| |
− | [ ] radxa-cm3-io-sata2.dtbo
| |
− | [ ] radxa-cm3-io-sharp-lq133t1jw01-without-hdmi.dtbo
| |
− | [ ] radxa-cm3-raspcm4io-pcie2x1.dtbo
| |
− | [ ] radxa-cm3-sodimm-io-raspberrypi-7inch-touchscreen.dtbo
| |
− | [ ] radxa-cm3i-gmac1.dtbo
| |
− | [ ] rk3399-dwc3-0-host.dtbo
| |
− | [ ] rk3399-dwc3-0-otg.dtbo
| |
− | [ ] rk3399-dwc3-0-peripheral.dtbo
| |
− | [ ] rk3399-i2c2.dtbo
| |
− | [ ] rk3399-i2c6.dtbo
| |
− | [ ] rk3399-i2c7.dtbo
| |
− | [ ] rk3399-opp-1800.dtbo
| |
− | [ ] rk3399-opp-2000.dtbo
| |
− | [ ] rk3399-opp-2200.dtbo
| |
− | [ ] rk3399-opp-2400.dtbo
| |
− | [ ] rk3399-pwm0.dtbo
| |
− | [ ] rk3399-pwm1.dtbo
| |
− | [ ] rk3399-spi-5-enc28j60.dtbo
| |
− | [ ] rk3399-spi-gpio-enc28j60.dtbo
| |
− | [ ] rk3399-spi1-m1-cs0-spidev.dtbo
| |
− | [ ] rk3399-spi2-m1-cs0-spidev.dtbo
| |
− | [ ] rk3399-uart0.dtbo
| |
− | [ ] rk3399-uart2.dtbo
| |
− | [ ] rk3399-uart4.dtbo
| |
− | [ ] rk3399-w1-gpio4-d6.dtbo
| |
− | [ ] rk3568-can1-m0.dtbo
| |
− | [ ] rk3568-can1-m1.dtbo
| |
− | [ ] rk3568-disable-gmac1.dtbo
| |
− | [ ] rk3568-disable-npu.dtbo
| |
− | [ ] rk3568-fiq-debugger-uart0.dtbo
| |
− | [ ] rk3568-fiq-debugger-uart2m0.dtbo
| |
− | [ ] rk3568-fiq-debugger-uart3m0.dtbo
| |
− | [ ] rk3568-fiq-debugger-uart5m1.dtbo
| |
− | [ ] rk3568-fiq-debugger-uart7m1.dtbo
| |
− | [ ] rk3568-fiq-debugger-uart8m1.dtbo
| |
− | [ ] rk3568-fiq-debugger-uart9m1.dtbo
| |
− | [ ] rk3568-i2c2-m0.dtbo
| |
− |
| |
− |
| |
− | <Ok> <Cancel>
| |
− |
| |
− |
| |
− | Select the overlays you want to load with the space bar,
| |
− |
| |
− | [*] rk3399-uart0.dtbo
| |
− |
| |
− | Overlay with a "*" indicates that it is enabled.
| |
− |
| |
− | reboot, to make overlays work
| |
− | <pre>
| |
− | sudo reboot
| |
− | </pre>
| |
− |
| |
− |
| |
− | ===== uart2 =====
| |
− | Select the "rk3399-uart2.dtbo" overlay with the space bar
| |
− | [*] rk3399-uart2.dtbo
| |
− | then reboot , the ttyS2 device is generated in the /dev/ directory
| |
− |
| |
− | ===== uart4 =====
| |
− | Select the "rk3399-uart4.dtbo" overlay with the space bar
| |
− | [*] rk3399-uart4.dtbo
| |
− | then reboot , the ttyS4 device is generated in the /dev/ directory
| |
− |
| |
− | ===== i2c2 =====
| |
− | Select the "rk3399-i2c2.dtbo" overlay with the space bar
| |
− | [*] rk3399-i2c2.dtbo
| |
− | then reboot , the i2c-2 device is generated in the /dev/ directory
| |
− |
| |
− | ===== i2c6 =====
| |
− | Select the "rk3399-i2c6.dtbo" overlay with the space bar
| |
− | [*] rk3399-i2c6.dtbo
| |
− | then reboot , the i2c-6 device is generated in the /dev/ directory
| |
− |
| |
− | ===== i2c7 =====
| |
− | Select the "rk3399-i2c7.dtbo" overlay with the space bar
| |
− | [*] rk3399-i2c7.dtbo
| |
− | then reboot , the i2c-7 device is generated in the /dev/ directory
| |
− |
| |
− | ===== spi1 =====
| |
− | Select the "rk3399-spi1-m1-cs0-spidev.dtbo" overlay with the space bar
| |
− | [*] rk3399-spi1-m1-cs0-spidev.dtbo
| |
− | then reboot , the spi1.0 device is generated in the /dev/ directory
| |
− |
| |
− | ===== spi2 =====
| |
− | Select the "rk3399-spi1-m1-cs0-spidev.dtbo" overlay with the space bar
| |
− | [*] rk3399-spi2-m1-cs0-spidev.dtbo
| |
− | then reboot , the spi2.0 device is generated in the /dev/ directory
| |
− |
| |
− | ===== pwm0 =====
| |
− | Select the "rk3399-pwm0.dtbo" overlay with the space bar
| |
− | [*] rk3399-pwm0.dtbo
| |
− | then reboot , the pwmchip0 device is generated in the /sys/class/pwm/ directory
| |
− |
| |
− | ===== pwm1 =====
| |
− | Select the "rk3399-pwm1.dtbo" overlay with the space bar
| |
− | [*] rk3399-pwm1.dtbo
| |
− | then reboot , the pwmchip1 device is generated in the /sys/class/pwm/ directory
| |
− |
| |
− | ===== one wire =====
| |
− | Select the "rk3399-w1-gpio4-d6.dtbo" overlay with the space bar
| |
− | [*] rk3399-w1-gpio4-d6.dtbo
| |
− | then reboot , the 28-80000028f6a0 device is generated in the /sys/bus/w1/devices/ directory
| |
− |
| |
− |
| |
− |
| |
− |
| |
− | ==== How to use a overylay written by yourselt ====
| |
− | ===== DTBO code specification =====
| |
− |
| |
− | Because of the number of products we have, writing the device tree overlay(dtbo) for each product has become a significant burden. To improve code reuse, you now need to specify metadata for dtbo to facilitate sharing of the same dtbo across different products.
| |
− | In our dtbo source file, you need add a new node named "matedata", this node needs the following fields:
| |
− | * title: it's property is text, used to display in the rsetup menu, there is no necessary to also indicate the supported development board.
| |
− | * compatible: it's property is array, Compatible products or SOCs can be specified. If dtbo is not cross-product compatible, the corresponding SoC cannot be filled in.
| |
− | * category: text, Used to classify in the rsetup menu. At present, only 'display', 'camera' and 'misc' are defined
| |
− | * description: text, The functions and precautions of dtbo are briefly introduced, used to display dtbo when installing rsetup.
| |
− |
| |
− | ===== get the sdk source =====
| |
− | [[https://github.com/radxa/rockchip-bsp SDK rockchip-bsp]]
| |
− | install the tools
| |
− | <pre>
| |
− | sudo apt-get update
| |
− | sudo apt-get install git device-tree-compiler build-essential
| |
− | </pre>
| |
− |
| |
− | ===== get the source code and update it =====
| |
− | <pre>
| |
− | git clone -b master https://github.com/radxa/rockchip-bsp.git
| |
− | cd rockchip-bsp
| |
− | git submodule init
| |
− | git submodule update
| |
− | cd rockchip-bsp
| |
− | git checkout master
| |
− | git fetch origin
| |
− | git rebase origin/master
| |
− | git submodule update
| |
− | </pre>
| |
− |
| |
− |
| |
− | overlay source code are located under the directory "rockchip-bsp/kerne/arch/arm64/boot/dts/rockchip/overlay/",
| |
− |
| |
− | ===== write overlay code =====
| |
− | example:
| |
− | rk3399-rock4-i2c7.dts
| |
− | <pre>
| |
− | /dts-v1/;
| |
− | /plugin/;
| |
− |
| |
− | / {
| |
− | metadata {
| |
− | title = "Enable i2c7 on ROCK 4 plus";
| |
− | compatible = "radxa,rock-4c-plus", "rockchip,rk3399";
| |
− | category = "misc";
| |
− | description = "Enable Radxa rock-4c-plus i2c7";
| |
− | };
| |
− |
| |
− | fragment@0 {
| |
− | target = <&i2c7>;
| |
− | __overlay__ {
| |
− | status = "okay";
| |
− | };
| |
− | };
| |
− | };
| |
− | </pre>
| |
− |
| |
− | ===== compile the dts to dtbo =====
| |
− |
| |
− | <pre>
| |
− | rockchip-bsp/kernel$ make dtbs
| |
− | </pre>
| |
− |
| |
− | ===== Upload it to the board =====
| |
− | <pre>
| |
− | scp rk3399-rock4-i2c7.dts radxa@192.168.xx.xx:~
| |
− | </pre>
| |
− |
| |
− | ===== move the dtbo to correct directory =====
| |
− | radxa@rock-4c-plus:~$ sudo mv rk3399-rock4-i2c7.dtbo /boot/dtbo
| |
− |
| |
− | Then, use rsetup to check to whether that overlay is enabled, the steps are similar to "How to enable a overlay dtbo" .
| |
− | Finally, reboot the board, you will see i2c-7 under the /dev/ directory.
| |