UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor
Contributor
2,802 Views
Registered: ‎06-06-2017

axi dma node missing from the device tree

Jump to solution

Hi all,

 

I have build a HW on a ZCU102 which simply transfers samples (Counter Values) from the PL to PS DDR using the AXI DMA in simple mode and the write channel only. My bare metal application is working properly.

In order to be able to make it work under linux using the axidma drivers I used petalinux.

I used petalinux-config command (with the --get-hw-dercription option) in order to set the boot settings to SD card.

 

If I am not wrong, after the configuration I should be able to see that the axi dma node is specified in the device tree file.

But is not there.

Shouldn't this generated automatically by the SDK and Petalinux ? In which file it should be located?

Is not in the pl.dtsi or zynqmp.dtsi

 

Thank you

PS: petalinux version is 2017.1

 

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Adventurer
Adventurer
3,912 Views
Registered: ‎03-22-2016

Re: axi dma node missing from the device tree

Jump to solution

@amatsaka wrote:

Hi all,

 

I have build a HW on a ZCU102 which simply transfers samples (Counter Values) from the PL to PS DDR using the AXI DMA in simple mode and the write channel only. My bare metal application is working properly.

In order to be able to make it work under linux using the axidma drivers I used petalinux.

I used petalinux-config command (with the --get-hw-dercription option) in order to set the boot settings to SD card.

 

If I am not wrong, after the configuration I should be able to see that the axi dma node is specified in the device tree file.

But is not there.

Shouldn't this generated automatically by the SDK and Petalinux ? In which file it should be located?

Is not in the pl.dtsi or zynqmp.dtsi

 

Thank you

PS: petalinux version is 2017.1

 


Yes, the AXI DMA should show up in the generated device tree. After running petalinux-config --get-hw-description and petalinux-build -c device-tree, you should see the axi dma show up in components/plnx_workspace/device-tree/device-tree-generation/pl.dtsi.

 

If it's not showing up there, I would check to make sure that you're doing "Export Hardware" from vivado before you do get-hw-description to import it into petalinux. Additionally, try petalinux-build -c device-tree to make sure it rebuilds the device tree.

 

If it helps, I have built that very design (zynq connected to axi dma) on the same hw (zcu102) with the same version of vivado (2017.1), and it's working, so it should be possible to get the same results.

0 Kudos
12 Replies
Highlighted
Adventurer
Adventurer
3,913 Views
Registered: ‎03-22-2016

Re: axi dma node missing from the device tree

Jump to solution

@amatsaka wrote:

Hi all,

 

I have build a HW on a ZCU102 which simply transfers samples (Counter Values) from the PL to PS DDR using the AXI DMA in simple mode and the write channel only. My bare metal application is working properly.

In order to be able to make it work under linux using the axidma drivers I used petalinux.

I used petalinux-config command (with the --get-hw-dercription option) in order to set the boot settings to SD card.

 

If I am not wrong, after the configuration I should be able to see that the axi dma node is specified in the device tree file.

But is not there.

Shouldn't this generated automatically by the SDK and Petalinux ? In which file it should be located?

Is not in the pl.dtsi or zynqmp.dtsi

 

Thank you

PS: petalinux version is 2017.1

 


Yes, the AXI DMA should show up in the generated device tree. After running petalinux-config --get-hw-description and petalinux-build -c device-tree, you should see the axi dma show up in components/plnx_workspace/device-tree/device-tree-generation/pl.dtsi.

 

If it's not showing up there, I would check to make sure that you're doing "Export Hardware" from vivado before you do get-hw-description to import it into petalinux. Additionally, try petalinux-build -c device-tree to make sure it rebuilds the device tree.

 

If it helps, I have built that very design (zynq connected to axi dma) on the same hw (zcu102) with the same version of vivado (2017.1), and it's working, so it should be possible to get the same results.

0 Kudos
Contributor
Contributor
2,775 Views
Registered: ‎06-06-2017

Re: axi dma node missing from the device tree

Jump to solution

Hi @jeffsimpson

thanks very much for your response.

 

Would you mind sharing the files? It would help me a lot....

 

Thanx again

 

0 Kudos
Adventurer
Adventurer
2,767 Views
Registered: ‎03-22-2016

Re: axi dma node missing from the device tree

Jump to solution

What files? pl.dtsi is auto-generated from the design, so things like interrupts and memory addresses aren't going to be correct. I don't think the problem is in your design, but rather is somewhere in the process you're using to get it imported into Petalinux.

 

I think your best bet will be to work through the process of exporting a hardware definition from Vivado and importing it to Petalinux until it works, then applying that same process to the design you're actually using.

You can do that with a really minimal design:

- Make a new vivado project using the zcu102 board.

- Add a zynq, run block automation.

- Drag a GPIO in and run connection automation.

- Auto-assign addresses.

- Build the project (generate bitstream)

- Export Hardware (select "include bitstream", pick "Local to project")

- Create a new petalinux project using the bsp

- Run petalinux-config --get-hw-description [sdk directory from vivado project]

- Look in the pl.dtsi file to see that the GPIO is there.

0 Kudos
Contributor
Contributor
2,753 Views
Registered: ‎06-06-2017

Re: axi dma node missing from the device tree

Jump to solution

Hi @jeffsimpson

 

I meant the .c files you accessing the axidma driver from you user space application, assuming you are using the xilinx linux driver. I have a feeling that using the driver is not straightforward 

 

 

 

0 Kudos
Adventurer
Adventurer
2,749 Views
Registered: ‎03-22-2016

Re: axi dma node missing from the device tree

Jump to solution

To start with, you should be able to just use the axidmatest module that comes in the kernel. Once that is working, take that code and hack it to do what you need.

 

There are also a few different "dma proxy" modules that people have written and posted here. Those modules act as the proxy between the xilinx dma driver and userspace applications. If one of those meets your needs, that might be the easiest route. But definitely make sure that you can get axidmatest working first!

 

Examples:

https://github.com/ikwzm/udmabuf

https://github.com/mstuehn/dma_proxy

0 Kudos
Contributor
Contributor
2,719 Views
Registered: ‎06-06-2017

Re: axi dma node missing from the device tree

Jump to solution

Hi @jeffsimpson

 

I have used the petalinux-package build -c device-tree which indeed created the pl.dtsi 

under ../components/plnx_workspace/device-tree-generation

/ {
	amba_pl: amba_pl@0 {
		#address-cells = <2>;
		#size-cells = <2>;
		compatible = "simple-bus";
		ranges ;
		axi_dma_0: dma@80000000 {
			#dma-cells = <1>;
			clock-names = "s_axi_lite_aclk", "m_axi_sg_aclk", "m_axi_s2mm_aclk";
			clocks = <&misc_clk_0>, <&misc_clk_0>, <&misc_clk_0>;
			compatible = "xlnx,axi-dma-1.00.a";
			interrupt-parent = <&gic>;
			interrupts = <0 89 4>;
			reg = <0x0 0x80000000 0x0 0x10000>;
			xlnx,addrwidth = <0x20>;
			dma-channel@80000030 {
				compatible = "xlnx,axi-dma-s2mm-channel";
				dma-channels = <0x1>;
				interrupts = <0 89 4>;
				xlnx,datawidth = <0x20>;
				xlnx,device-id = <0x0>;
			};
		};
		axi_gpio_0: gpio@80010000 {
			#gpio-cells = <2>;
			compatible = "xlnx,xps-gpio-1.00.a";
			gpio-controller ;
			reg = <0x0 0x80010000 0x0 0x10000>;
			xlnx,all-inputs = <0x0>;
			xlnx,all-inputs-2 = <0x0>;
			xlnx,all-outputs = <0x0>;
			xlnx,all-outputs-2 = <0x0>;
			xlnx,dout-default = <0x00000000>;
			xlnx,dout-default-2 = <0x00000000>;
			xlnx,gpio-width = <0x1>;
			xlnx,gpio2-width = <0x20>;
			xlnx,interrupt-present = <0x0>;
			xlnx,is-dual = <0x0>;
			xlnx,tri-default = <0xFFFFFFFF>;
			xlnx,tri-default-2 = <0xFFFFFFFF>;
		};
		psu_ctrl_ipi: PERIPHERAL@ff380000 {
			compatible = "xlnx,PERIPHERAL-1.0";
			reg = <0x0 0xff380000 0x0 0x80000>;
		};
		psu_message_buffers: PERIPHERAL@ff990000 {
			compatible = "xlnx,PERIPHERAL-1.0";
			reg = <0x0 0xff990000 0x0 0x10000>;
		};
		misc_clk_0: misc_clk_0 {
		};
	};
};

I have also run the kernel config to inclule the axidmatest (not as a module).

 

So I build the BOOT.bin and image.ub files and loaded them onto my target board.

During kernel boot there was an error with the DMA driver see picture

After a quick research in the forum I found that the error was caused by  the misc_clk_0: misc_clk_0 entry in the pl.dtsi.

see https://forums.xilinx.com/t5/Embedded-Linux/AXI-DMA-Driver-Problem/td-p/726772

and https://forums.xilinx.com/t5/Embedded-Linux/AXI-DMA-test-failure/td-p/805245

I modified the project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi to look like this:

/include/ "system-conf.dtsi"
/ {
	axidmatest_0: axidmatest@0 {
		compatible = "xlnx,axi-dma-test-1.00.a";
		dmas = <&axi_dma_0 0
			&axi_dma_0 1>;
		dma-names = "axidma0", "axidma1";
	};
};

	&misc_clk_0 {
		#clock-cells = <0>;
     		clock-frequency = <99999000>;
		compatible = "fixed-clock";
};

After building and loading the image I get kernel panic due to the axidmatest entry in the system-user.dtsi. So I search for the axidmatest entry in the device tree files and nothing was found.

 

Since we have a similar setup I would like to ask you if you have faced the same problem 

especially for the misc_clk_0: misc_clk_0 and the axidmatest node missing from the device-tree files

 

Thanx in advance!

 

 

 

 

 

 

 

terminal.png
0 Kudos
Adventurer
Adventurer
2,711 Views
Registered: ‎03-22-2016

Re: axi dma node missing from the device tree

Jump to solution

Very similar!

 

This is what I have in system-user.dtsi for 2017.1:

/include/ "system-conf.dtsi"
/ {
    dmatest_0: dmatest@0 {
        compatible ="xlnx,axi-dma-test-1.00.a";
        dmas = <&axi_dma_0 0 &axi_dma_0 1>;
        dma-names = "axidma0", "axidma1";
    };
};

&misc_clk_0 {
    compatible = "fixed-clock";
    #clock-cells = <0>;
    clock-frequency = <100>;
};

 

The clock entry needed to be modified as it is being generated incorrectly by Vivado. That bug is fixed in 2017.4.

 

The entry for axidmatest is intentionally left out of the device tree. The developer is meant to add their own entry selecting which dma channels they want to use for the test module. Everything you have sounds like the same process I went through.

 

Here's the thread I started with the issues I had in 2017.4, but I also found success with 2017.1:

https://forums.xilinx.com/t5/Embedded-Linux/AXI-DMA-test-error-zcu102-ES2-Petalinux-2017-4/m-p/831864#M24311


So is it working now, I take it?

0 Kudos
Contributor
Contributor
2,705 Views
Registered: ‎06-06-2017

Re: axi dma node missing from the device tree

Jump to solution

@jeffsimpsonStill no......

after I used your system-user.dtsi and run build again I get the Oops for the axidmatest (see pic)

Which I don't understand since I've included in the kernel config. Should I modularize it?

Or should make sence to switch to 2017.4?

 

 

terminal.png
0 Kudos
Adventurer
Adventurer
2,701 Views
Registered: ‎03-22-2016

Re: axi dma node missing from the device tree

Jump to solution

Definitely switch it to a module. If you decide to switch to 2017.4, make sure you catch the 'High Memory' setting in the other thread.

I haven't seen the issue you're seeing now, unfortunately, so I don't know what it could be.

Another "trick" I found is that you can clone a copy of https://github.com/Xilinx/linux-xlnx and then checkout the tag "xilinx-v2017.1". Use that as the "external source" kernel. Then, you can modify things like axidmatest.c and xilinx_dma.c right in the tree for debugging purposes.

0 Kudos
Contributor
Contributor
1,411 Views
Registered: ‎06-06-2017

Re: axi dma node missing from the device tree

Jump to solution

@jeffsimpson

I managed to have a running system after I set the axidmatest as a module in kernel config.

What I don't understand is that I see the VDMA driver is installed which does not exist in my HW design. 

 

The axidma test is not working and makes sense since my HW has only the S2MM channel enable.

 

Is there any other way to verify that the axidma driver is properly installed without using the axidmatest module?

 

I am not sure I followed the last bit of your post with the "external source" kernel.

 

 

terminal.png
0 Kudos
Contributor
Contributor
1,400 Views
Registered: ‎06-06-2017

Re: axi dma node missing from the device tree

Jump to solution

Ok I think I got it looking at the source code. They've included all in driver under the name "xilinx-vdma"

0 Kudos
Adventurer
Adventurer
1,394 Views
Registered: ‎03-22-2016

Re: axi dma node missing from the device tree

Jump to solution

Yeah, as you discovered, Xilinx combined the VDMA, AXI DMA and CDMA into a single module. In 2017.4, updates to the xilinx_dma kernel module make it a little more clear in the kernel log which device is detected.

Petalinux uses a kernel from xilinx git, tagged at a particular version to match the petalinux release. The kernel build process is behind the scenes in petalinux (for better or worse). It automatically checks out the version from git, applies your kernel config, and builds.

 

In petalinux-config, under "Linux Components Selection", you can change "Linux-kernel" from being "linux-xlnx" (the default) to "ext-local-src". When you pick "ext-local-src", you can then provide a local directory containing the kernel source you want to use. If you clone the xilinx kernel from git and check out the "xilinx-2017.1" release, you've effectively exactly replicated what petalinux already does, except now it operates on kernel source that you can modify as you like. Add debug statements to drivers, etc.

For actual development, it's better to write "out-of-tree" kernel modules, but if you're modifying the provided source, this is a quick and easy way to do it.

 

I don't know of an easy way to test axi dma without a loopback that has both MM2S and S2MM channels. If possible, I'd suggest trying that design first, getting that working, and then making the assumption that either channel would work on its own.

0 Kudos