Change device tree for Beaglebone Black

I used Yocto to create a small Linux image for Beaglebone Black. I think I have everything that works the way I want, except that I need access to UARTs 2 and 4. When I used the standard Debian image, I did this with overlays on the device tree and capemgr. However, I found that a kernel built with Yocto does not have capemgr.

My options look like:

  • get the kernel to build using capemgr or
  • Modify the device tree file with the necessary changes.

Option 2 looks a lot easier.

Device tree overlay for UART here and here . I tried to include them in a couple of ways.

  • I decompiled the blob block that I used and tried to include these files from there.
  • I downloaded the full set of dts files and tried to enable the UART Device Tree overlays on am335x-boneblack.dts.

Both approaches give an error something like this:

Error: am335x-boneblack.dts:1.1-2 syntax error FATAL ERROR: Unable to parse input tree 
However, I noticed that I get a similar error when trying to compile am335x-boneblack.dts without even changing it, so I probably won't even do it right. (Using the dtc -I dts -O dtb -o result.dtb am335x-boneblack.dts command)

Obviously, I don't know what I'm doing. I suspect that the device tree overlay needs to be changed in some way so that they can be used the way I try to use them. Or maybe I'm not doing inclusion right (just adding #include to the top of the file).

Does anyone have any ideas what I can do wrong? Is this what I'm trying to do is even possible?

+5
source share
2 answers

So, I got this work by taking the blob of my device, decompiling it and merging it into sections from the overlay files of the device tree and recompiling it. I realized that I need uarts 1 and 2 instead of 2 and 4, so this is a little different from my original problem.

To decompile the device tree:

 dtc -I dtb -O dts -o am335x-boneblack.dts am335x-boneblack.dtb 

I used the existing uart0 as an example to show me the sections I need to work.

I added a section for uart1 and uart2 in the pinmux section in the section for uart0. Now it looks like this:

 pinmux_uart0_pins { pinctrl-single,pins = <0x170 0x30 0x174 0x0>; linux,phandle = <0x27>; phandle = <0x27>; }; bb_uart1_pins: pinmux_bb_uart1_pins { pinctrl-single,pins = < 0x184 0x20 /* P9.24 uart1_txd.uart1_txd OUTPUT */ 0x180 0x20 /* P9.26 uart1_rxd.uart1_rxd INPUT */ >; }; bb_uart2_pins: pinmux_bb_uart2_pins { pinctrl-single,pins = < 0x150 0x21 /okay* spi0_sclk.uart2_rxd | MODE1 */ 0x154 0x01 /* spi0_d0.uart2_txd | MODE1 */ >; }; 

Then later, you need to enable the sequential sections and indicate which contacts to use. I have modified the existing uart sections and now it looks like this:

 serial@44e09000 { compatible = "ti,omap3-uart"; ti,hwmods = "uart1"; clock-frequency = <0x2dc6c00>; reg = <0x44e09000 0x2000>; interrupts = <0x48>; status = "okay"; dmas = <0x26 0x1a 0x26 0x1b>; dma-names = "tx", "rx"; pinctrl-names = "default"; pinctrl-0 = <0x27>; }; serial@48022000 { compatible = "ti,omap3-uart"; ti,hwmods = "uart2"; clock-frequency = <0x2dc6c00>; reg = <0x48022000 0x2000>; interrupts = <0x49>; status = "okay"; dmas = <0x26 0x1c 0x26 0x1d>; dma-names = "tx", "rx"; pinctrl-names = "default"; pinctrl-0 = <&bb_uart1_pins>; }; serial@48024000 { compatible = "ti,omap3-uart"; ti,hwmods = "uart3"; clock-frequency = <0x2dc6c00>; reg = <0x48024000 0x2000>; interrupts = <0x4a>; status = "okay"; dmas = <0x26 0x1e 0x26 0x1f>; dma-names = "tx", "rx"; pinctrl-names = "default"; pinctrl-0 = <&bb_uart2_pins>; } 

To recompile the device tree:

 dtc -I dts -O dtb -o am335x-boneblack.dtb am335x-boneblack.dts 

In short, I managed to get this work, although little is known about how device trees work.

I also needed to disable hdmi, which I did by setting the status to β€œdisabled” in the hdmi section.

+3
source

A tool called fdtoverlay was added to the device tree compiler, as shown in the following commit:

https://git.kernel.org/pub/scm/utils/dtc/dtc.git/commit/?id=42409146f2db22d71559154fa1233694c964cc14

I have not tried using it yet, but it might be an easier way to associate the main device tree with overlays on the device tree.

0
source

Source: https://habr.com/ru/post/1245335/


All Articles