Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

Rockpi4/hardware/devtree overlays linux5.10

< Rockpi4‎ | hardware
Revision as of 06:19, 6 December 2022 by Nascs (Talk | contribs)

    ROCK Pi 4 >  Hardware >  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 [Radxa/overlay]


How to enable a overlay dtbo

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-opp-1800.dtbo                                             
   [ ] rk3399-opp-2000.dtbo                                          
   [ ] rk3399-opp-2200.dtbo                                              
   [ ] rk3399-opp-2400.dtbo 
   [ ] rk3399-spi-5-enc28j60.dtbo                                     
   [ ] rk3399-spi-gpio-enc28j60.dtbo                                  
   [ ] rk3399-uart0.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

sudo reboot


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
[SDK rockchip-bsp] 

install the tools

sudo apt-get update
sudo apt-get install git device-tree-compiler build-essential
get the source code and update it
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


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

/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";
		};
	};
};
compile the dts to dtbo
rockchip-bsp/kernel$ make dtbs
Upload it to the board
scp rk3399-rock4-i2c7.dts radxa@192.168.xx.xx:~
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.