btm
Posts: 3
Joined: Tue Mar 12, 2019 1:06 pm

Devicetree and u-boot

Tue Mar 12, 2019 1:18 pm

Hi,
I am trying to use u-boot to boot one of several kernels which is chosen automatically to allow for software remote upgrade and fallback in case of failure. Each kernel will have corresponding devicetree attached to it so I need to be able to load a devicetree (possibly in a fit image) in u-boot. I cannot use the one loaded by the initial closed source bootloader as that may not be appropriate for a newer kernel.

I have struggled to make this work and the only way I could get wifi and ethernet to work was to run dtmerge on the provided devicetree file

dtmerge -d bcm2710-rpi-3-b.dtb merged.dtb -

If I use bcm2710-rpi-3-b.dtb alone wifi and ethernet (and usb) do not start. After the (non-)merge the merged.dtb file seems to be able to activate both ethernet and wifi. The difference seems to be some manipulation of i2c devices (diff follows):

--- 1 2019-03-12 12:14:23.078082030 +0100
+++ 2 2019-03-12 12:14:26.094071212 +0100
@@ -18,6 +18,9 @@
#address-cells = <0x00000001>;
#size-cells = <0x00000001>;
aliases {
+ i2c_vc = "/soc/[email protected]";
+ i2c_arm = "/soc/[email protected]";
+ i2c = "/soc/[email protected]";
serial0 = "/soc/[email protected]";
serial1 = "/soc/[email protected]";
audio = "/soc/audio";
@@ -934,6 +937,12 @@
phandle = <0x00000078>;
};
__overrides__ {
+ i2c_vc_baudrate = [00 00 00 23 63 6c 6f 63 6b 2d 66 72 65 71 75 65 6e 63 79 3a 30 00];
+ i2c_arm_baudrate = [00 00 00 22 63 6c 6f 63 6b 2d 66 72 65 71 75 65 6e 63 79 3a 30 00];
+ i2c_baudrate = [00 00 00 22 63 6c 6f 63 6b 2d 66 72 65 71 75 65 6e 63 79 3a 30 00];
+ i2c_vc = [00 00 00 23 73 74 61 74 75 73 00];
+ i2c_arm = [00 00 00 22 73 74 61 74 75 73 00];
+ i2c = [00 00 00 22 73 74 61 74 75 73 00];
cam0-pwdn-ctrl;
cam0-pwdn;
cam0-led-ctrl;
@@ -987,6 +996,9 @@
};
};
__symbols__ {
+ i2c_vc = "/soc/[email protected]";
+ i2c_arm = "/soc/[email protected]";
+ i2c = "/soc/[email protected]";
cpu_thermal = "/thermal-zones/cpu-thermal";
soc = "/soc";
dma = "/soc/[email protected]";

How could I have known some random i2c nodes would activate wifi and ethernet and what is the mechanism by which this happens?
How does a (to an outsider) null merge lead to changes in the device tree with such a significant effect?

/Brian

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2170
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Devicetree and u-boot

Tue Mar 12, 2019 3:36 pm

How could I have known some random i2c nodes would activate wifi and ethernet and what is the mechanism by which this happens?
I don't believe they do. There must be some other effect at work.
How does a (to an outsider) null merge lead to changes in the device tree with such a significant effect?
The other effects of dtmerge are mentioned in the documentation: https://www.raspberrypi.org/documentati ... md#part4.2

btm
Posts: 3
Joined: Tue Mar 12, 2019 1:06 pm

Re: Devicetree and u-boot

Wed Mar 13, 2019 10:29 am

Thanks for the reply. I think my problem was that I used an incorrect devicetree. My kernel contains two which apply to a raspberry pi B:

./arch/arm/boot/dts/bcm2710-rpi-3-b.dtb

and

./arch/arm/boot/dts/bcm2837-rpi-3-b.dtb

The first seems to contain what is necessary for ethernet and wifi to work. The second seems not to.
Of course I chose the second for my testing.

What is the second for?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2170
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Devicetree and u-boot

Wed Mar 13, 2019 10:34 am

The second is the Device Tree blob for an "upstream" kernel - a kernel that doesn't use any of Raspberry Pi's modifications. The most significant difference is that they don't use the FIQ-enhanced dwc_otg USB driver, so performance can be worse.

btm
Posts: 3
Joined: Tue Mar 12, 2019 1:06 pm

Re: Devicetree and u-boot

Wed Mar 13, 2019 1:18 pm

Ok. How come usb/ethernet and wifi are disabled/don't work in the upstream case when used with a non upstream kernel?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2170
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: Devicetree and u-boot

Wed Mar 13, 2019 1:34 pm

It's probably a mismatch between the drivers built and the drivers expected by the Device Tree.

Return to “Device Tree”