Problems loading device tree overlays on Arria10 socfpga, kernel 4.14.126

Hi everyone,

I have the following problem related to the Arria10 socfpga. I use a yocto build with either
the kernel 4.9.76-ltsi-rt (yocto thud) or 4.14.126-ltsi-rt (yocto warrior). Information on device tree overlays in general is available here:

https://rocketboards.org/foswiki/Documentation/HOWTOCreateADeviceTree#A10_SoC_device_tree_orientation.

Unfortunately, this description works for kernel 4.9.78 only.

For my problem, I use a very simple device tree overlay file (dtso) which looks as follows:

/dts-v1/;/plugin/;
/ {
fragment {

target-path = "/soc/base_fpga_region"; 

#address-cells = <0x1>; 
#size-cells = <0x1>; 

__overlay__ { 

	external-fpga-config; 

	#address-cells = <0x2>; 
     	#size-cells = <0x1>;

	// Ranges
	ranges = <0x00000001 0x00000450 0xff200450 0x00000008>; // Sys id driver
		
	sysid: sysid@100000450 {
		       compatible = "altr,sysid-18.1", "altr,sysid-1.0";
		       reg = <0x00000001 0x00000450 0x00000008>;
		       clocks = <&clk_0>;
		       id = <3684762384>;	
		       timestamp = <1568123853>;
		       }; //end sysid@0x100000450 (sysid)
		
	clk_0: clk_0 {
		       compatible = "fixed-clock";
		       #clock-cells = <0>;
		       clock-frequency = <50000000>;	/* 50.00 MHz */
		       clock-output-names = "clk_0-clk";
		       }; //end clk_0 (clk_0)
	};
};

};

The purpose of the device tree overlay is to be loaded at runtime to load the driver module to access the Altera sysid (compatibility string “altr,sysid-18.1”) afterwards. No firmware (rbf file) is to be loaded since this has already been loaded during uboot phase. The address of the altera_sysid memory (ranges and reg sections) is not of importance since it is not verified against the hardware in the driver. The entries and values such as reg, irq etc in the overlay file have been taken from a device tree generated involving the sopc2dts tool.

For loading the device tree overlay (denoted as dtree.dtbo), I use the following sequence:

mkdir /config
mount -t configfs configfs /config
mkdir /config/device-tree/overlays/my_olay_folder
echo dtree.dtbo > /config/device-tree/overlays/my_olay_folder/path
umount /config

Of course, I run the dtc with the right options to generate a valid device tree overlay.

With this setting, I tested the following systems:

  1. DE0 Board with Cyclone 5 socfpga
  2. A custom board with an Arria10 socfpga

Both systems are operated based on a yocto generated root filesystem.

If booting the 4.9.76 kernel, in both cases, the device tree overlay is loaded after bootup by running the mentioned commands. Afterwards, I can see that the altera_sysid driver module is loaded (command lsmod shows the altera_sysid module).

Now with the 4.14.126 kernel, I can load the device tree overlay on the De0 board which is based on the Cyclone 5 socfpga. Again, the altera_sysid module is stated to be loaded afterwards.

In contrast to this, this procedure does not work on the Arria10 board: the device tree can be loaded on the Arria10 system by the mentioned commands but the altera_sysid module is NOT loaded afterwards. After loading the device tree overlay I can even see in /proc/device-tree that all entries including the compatibility strings are there - just no module has been loaded!

Starting from the described case, I tested all kinds of device tree overlays (different dtc versions, different realizations of the dtso file, different kernels > 4.14.126 etc) - I can not get the kernel to load any module by loading the device tree overlay.

So, here is my question: what is the trick? How can I get the module to be loaded by loading a device tree overlay on the Arria10? Or is this behavior a bug?

The described problem makes life rather complicated for me:

  • in most cases in embedded Linux systems, the device tree overlay is merged into the full device tree in the uboot (or the binblob boot loader in case of the Raspi). This does not work on the Arria10 socfpga systems if a uboot taylored given the Quartus project is required: This, unfortunately, still is only supported for the Altera/Intel provided version of uboot which is based on the 2013 release and does not support device tree overlay merges yet (fdt apply).
  • The 4.9.76-ltsi-rt branch has recently been removed from the altera kernel github repository. A thud based yocto build involving the 4.9.76 kernel is not possibly at the moment.

Any help or hint on this topic is greatly appreciated.

Thank you in advance and best regards

Hauke

Hello @hkhauke,
has You verified that the driver of Altera sysid is correctly loaded for Arria10 if You do not place its node into a Device Tree overlay but into a Device Tree Blob itself? In other words - it is really problem of the Device Tree overlay rather than problem of the driver?
I could also mention that unmounting configfs post applying overlay is not neccessary. I use mounting of configs via /etc/fstab config file (i.e. no need of mounting and unmounting) and it functions very well (however on Cyclone V, Linux kernel 4.7 - 4.18).
Best wishes and good luck,
Yours Jan KoneÄŤnĂ˝.

Hi Jan,

thank you for the response. Your question about using the device tree blob rather than an overlay made me think into another direction and I finally found the solution. The following overlay file works for me now:

/dts-v1/;/plugin/;

/ {

fragment@0 {

target-path = "/soc"; 

#address-cells = <0x1>; 
#size-cells = <0x1>; 

__overlay__ { 

	#address-cells = <0x2>; 
    	#size-cells = <0x1>;
	
	// Ranges
	ranges = <0x00000001 0x00000450 0xff200450 0x00000008>; // Sys id driver
			       	
		
	sysid: sysid@100000450 {
		       compatible = "altr,sysid-18.1", "altr,sysid-1.0";
		       reg = <0x00000001 0x00000450 0x00000008>;
		       clocks = <&clk_0>;
		       id = <3684762384>;
		       timestamp = <1568123853>;
		       }; //end sysid@0x100000450 (sysid)

	clk_0: clk_0 {
		       compatible = "fixed-clock";
		       #clock-cells = <0>;
		       clock-frequency = <50000000>;	/* 50.00 MHz */
		       clock-output-names = "clk_0-clk";
		       }; //end clk_0 (clk_0)
       };
};

fragment@1 {

target-path = "/soc/base_fpga_region"; 

#address-cells = <0x1>; 
#size-cells = <0x1>; 

__overlay__ { 

	external-fpga-config; 

	};
};

};

All other explanations available out there on the net seemed to require that all fragments must be placed into the “base_fpga_region”. However, this region seems to be no longer allowed in Arria10. Since in my setting a firmware is not required to be read (external-fpga-config) I have no idea if the part to load an rbf file works.

The given overlay file works for me now :slight_smile:

Thank you and best regards
Hauke

1 Like