Device Tree For the Custom Board i.MX8M Plus

cancel
Showing results for 
Search instead for 
Did you mean: 

Device Tree For the Custom Board i.MX8M Plus

Jump to solution
352 Views
Wobaffet
Contributor IV

Hello,

What is the best efficient way to edit the device tree for our custom board with i.MX8MP MPU? Some components of our board will be same with the evaluation board so how should we proceed? Can you share your experiences?

Does Config Tools for i.MX create only pin_mux.dts file?

Thank you in advance.

0 Kudos
1 Solution
343 Views
edwardtyrrell
Senior Contributor I

Hi,

Once you have a build running on your custom board you can try the following.

First locate your correct device tree file(s), sometimes with Yocto and certain builds it may not be the files you think.. Then as a quick test comment out some obviously unused items and rebuild. Check you boot log to make sure the devices have disappeared or are no longer probed. You can trim down the device tree a fair bit if needed. Once you have worked out what can go, create some device tree patch file(s) and add these to your sources/meta-yours/recipes-kernel etc to make the changes permanent. This is fine if you want to work with modified EVK builds. You can remove unwanted drivers as well using bitbake linux-imx -c menuconfig thus having a similar effect as removing them from your device tree. 

Just be aware if you tweak the actual device tree file(s) up in /arch/arm64/boot/dts/freescale somewhere then do a kernel clean and build you will loose your changes. Do your changes after a kernel clean if you need to do one, creating patch files is a better practice so perhaps worth looking into sooner rather than later. 

Hope it helps, it's a big learning curve.

View solution in original post

4 Replies
333 Views
khang_letruong
Senior Contributor III

Hi @Wobaffet,

There more than 1 way to do that. Either you can add your new device-tree files into the kernel repository (1) that is cloned from https://source.codeaurora.org/external/imx/linux-imx/ or you can add them as patch(es) by the Yocto recipes (2).

Example of (1) :

a. Toradex with their verdin boards : https://git.toradex.com/cgit/linux-toradex.git/log/?h=toradex_5.4-2.3.x-imx

b. Phytec with their phycore boards: https://github.com/phytec/linux-phytec-imx/tree/v5.4.70_2.3.2-phy

c. Variscite with their var-dart boards: https://github.com/varigit/linux-imx/tree/5.4-2.3.x-imx_var01

...

Example of (2): SolidRun with their recipes to add their Hummingboard : https://github.com/SolidRun/meta-solidrun-arm-imx8/blob/hardknott-imx8mp/recipes-kernel/linux/linux-...

Also, my best practice would be including the imx8mp-evk.dts into the custom .dts and do the tweaking (add new nodes, removing unused nodes, overriding nodes with new properties, ...). Or you can completely add a new custom .dts by only including imx8mp.dtsi which is crucial for any iMX8MP based board.

Regards,
K.

 

 

344 Views
edwardtyrrell
Senior Contributor I

Hi,

Once you have a build running on your custom board you can try the following.

First locate your correct device tree file(s), sometimes with Yocto and certain builds it may not be the files you think.. Then as a quick test comment out some obviously unused items and rebuild. Check you boot log to make sure the devices have disappeared or are no longer probed. You can trim down the device tree a fair bit if needed. Once you have worked out what can go, create some device tree patch file(s) and add these to your sources/meta-yours/recipes-kernel etc to make the changes permanent. This is fine if you want to work with modified EVK builds. You can remove unwanted drivers as well using bitbake linux-imx -c menuconfig thus having a similar effect as removing them from your device tree. 

Just be aware if you tweak the actual device tree file(s) up in /arch/arm64/boot/dts/freescale somewhere then do a kernel clean and build you will loose your changes. Do your changes after a kernel clean if you need to do one, creating patch files is a better practice so perhaps worth looking into sooner rather than later. 

Hope it helps, it's a big learning curve.

310 Views
Wobaffet
Contributor IV
I have general knowledge of the concept but I am kind of lost on the job. For now, custom board will be again similar to evk so I should be fine patching it without creating a new machine? I've built a yocto image (imx-image-core) for the imx8mp evk. Eventually there are some dtb files at the /tmp/deploy/images/imx8mpevk for it. In this case If I take a look at the respective dts files and edit them w.r.t my use case and peripherals would that work? Editing will be done in my own layer with patching respective files.
0 Kudos
299 Views
edwardtyrrell
Senior Contributor I

Hi,

For now, custom board will be again similar to evk so I should be fine patching it without creating a new machine? Yes. Designers/developers often base a product on an EVK initially to hit the ground running, that takes care of the basic hardware and prevents all sorts of issues. It's not unusual to develop on an EVK until you get the proper hardware in your hands.. So, if you have a custom board that is based on an EVK then you can boot and run a Yocto image even if your missing peripherals or have added more.      

Eventually there are some dtb files at the /tmp/deploy/images/imx8mpevk for it. In this case If I take a look at the respective dts files and edit them w.r.t my use case and peripherals would that work? The dtb files you mentioned are objects that are built and are not editable, you need to edit/replace these at their source in a location like /arch/arm64/boot/dts/freescale/imx8mm-evk.dtsi as you said.. Therefore editing the source files, adding and deleting peripherals would work. Remember to enable new drivers in your menu config.

As khang_letruong said, you can replace the dtsi file outright or do a custom file and include it.