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
883 Views
Registered: ‎10-28-2018

How to determin the interrupt number for zynq ultrascale+ and link to linux interrupt handller

Jump to solution

Hi,

With 2017.3 environment, I was trying to setup a PL logic which interact with Linux on

zynq PS, I'm rather confused and do not know I was doing it right, but here is what I did:

I connected a signal which sends a rising edge to PS's port "pl_ps_irq0[0:0]" after some condition. The block diagram is like this:

bd.JPG

I know that a device driver is needed, so I'm also trying to develop the device driver. During the development , there is a function call "request_irq()" from linux kernel which binds a handler to an interrupt number(this is how I understand, is it correct ?).

So the question is where do I get that interrupt number?

I have looked into ug1085 page 314:

irq_num.JPG

Seems the interrupt number should be  121 or 128 since I connected only one signal to it ( am I correct? I also read somewhere else that the interrupt number in dts should subtract 32 somehow.)

I exported the hardware and used the hdf file to configure linux with the petalinux tool: 

$ petalinux-config --get-hw-description=<dir containning the hdf>

I exited after the config UI poped up.( This should setup with default config ? )

Build linux with $ petalinux-build

I expected to find the interrupt somewhere in a dts/dtsi file, so I searched and looked in the

<petalinux work dir>/components/plnx_workspace/device-tree/device-tree-generation .

There is a file pl.dtsi in which I found the dts node for my hardware in pl:

/ {
	amba_pl: amba_pl@0 {
		#address-cells = <2>;
		#size-cells = <2>;
		compatible = "simple-bus";
		ranges ;
		axi_performance_benchmarker_0: axi_performance_benchmarker@a0000000 {
			compatible = "xlnx,axi-performance-benchmarker-1.0";
			reg = <0x0 0xa0000000 0x0 0x1000>;
			xlnx,m00-axi-addr-width = <0x20>;
			xlnx,m00-axi-burst-len = <0x40>;
			xlnx,m00-axi-data-width = <0x80>;
			xlnx,m00-axi-id-width = <0x1>;
			xlnx,s01-axi-lite-addr-width = <0x6>;
			xlnx,s01-axi-lite-data-width = <0x20>;
		};
		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>;
		};
	};
};

but there isn't any interrupts setup in this dts node.

Should I look elsewhere for the interrupt setup or should I do something to tell the petalinux tool to include the interrupt information in my design?(I was expecting that this information can be generated automatically into a dts/dtsi. ).

Or should I just hand code the interrupt information somewhere else so that it can then appear in the device tree after another build?

 

I also read from ug1085,seems the interrupt from PL is only connected to RPU's GIC(PL390),

and RPU is then connected to GIC-400's distributer in APU :

GIC_diagram.JPG

 

This seems rather complex, should I program the RPU to process the interrupt also or the petalinux tool have already taken care of that?

I read from 481232 a suggestion to use UIO which eliminates the need for kernel development, I also concern the performance if doing so.

Any suggestions?

--

Regards

Kang

Regards,
Kang
Tags (1)
0 Kudos
1 Solution

Accepted Solutions
Moderator
Moderator
822 Views
Registered: ‎09-12-2007

Re: How to determin the interrupt number for zynq ultrascale+ and link to linux interrupt handller

Jump to solution

I think the issue here is the DTG (devicetree generator) is not detecting your interrupt signal. The DTG will look for all ports of type INTERRUPT. 

See Line 1793

https://github.com/Xilinx/device-tree-xlnx/blob/master/device_tree/data/common_proc.tcl

Im guessing that your txn_done signal is set to undef, and not intr:

intr.PNG

As a workaround, you can update the system-user.dtsi manually in petalinux:

&axi_performance_benchmarker_0 {

interrupt-parent = <&gic>;
interrupts = <0 89 4>;

};

Or, you can update your IP to set this pin as type interrupt in the IP packager

 

 

5 Replies
Moderator
Moderator
823 Views
Registered: ‎09-12-2007

Re: How to determin the interrupt number for zynq ultrascale+ and link to linux interrupt handller

Jump to solution

I think the issue here is the DTG (devicetree generator) is not detecting your interrupt signal. The DTG will look for all ports of type INTERRUPT. 

See Line 1793

https://github.com/Xilinx/device-tree-xlnx/blob/master/device_tree/data/common_proc.tcl

Im guessing that your txn_done signal is set to undef, and not intr:

intr.PNG

As a workaround, you can update the system-user.dtsi manually in petalinux:

&axi_performance_benchmarker_0 {

interrupt-parent = <&gic>;
interrupts = <0 89 4>;

};

Or, you can update your IP to set this pin as type interrupt in the IP packager

 

 

Contributor
Contributor
811 Views
Registered: ‎10-28-2018

Re: How to determin the interrupt number for zynq ultrascale+ and link to linux interrupt handller

Jump to solution

Hi, 

Thanks for the answer,

I already get a interrupt number after set pin type to interrupt, it is also 89.

So, Is the number a hardware interrupt number, or a mapped interrupt number?

Is it the number to be used in the "request_irq()"?

 

Regards,
Kang
0 Kudos
Explorer
Explorer
793 Views
Registered: ‎06-03-2015

Re: How to determin the interrupt number for zynq ultrascale+ and link to linux interrupt handller

Jump to solution

 Hi

The no . provided by you (89) is hardware supported number.

Flow of IRQ Subsystem is as follows:

request_irq() -> struct irq_chip-> IRQ Domain mapping (Linear map/Tree map etc.)-> IRQ chip GPIO controller -> SoC -> GIC

89 is one taking care by GIC in hardware level.

when it is come to Linux, its no. changes and you can print the same using request_irq()  first argument.

Thanks & Regards

Satish G

 

 

   

 

 

G Satish Kumar
0 Kudos
Contributor
Contributor
770 Views
Registered: ‎10-28-2018

Re: How to determin the interrupt number for zynq ultrascale+ and link to linux interrupt handller

Jump to solution

Hi gsatish10,

The number 89 is generated by the hardware hdf and petalinux tool,

By "when it is come to Linux, its no. changes and you can print the same using request_irq()  first argument."

do you mean that  the 89 in the dtsi file is the number to put in the first argument of request_irq() (aka request_irq(89,......) )?

Or the number changed in linux so I need to print the number out with some function related to request_irq() ?

I'm a little confused by your statement. 

: )

Regards,
Kang
0 Kudos
Highlighted
Contributor
Contributor
745 Views
Registered: ‎10-28-2018

Re: How to determin the interrupt number for zynq ultrascale+ and link to linux interrupt handller

Jump to solution

I was able to query the linux interrupt number by:

struct device_node * np = of_find_node_by_name(NULL,"<node_name>"); // the <node_name> is the one before “@” sign in dtsi file.

int irq_number = irq_of_parse_and_map(np,0);

request_irq(irq_number,......);

 

so to conclusion, there are 3 interrupt numbers,

the one in ug1085: 121, (this also showed up in one column  in /proc/interrupt after successful insert the kernel module.)

the one in dtsi file: 89,(this one only showed up in dtsi file, so far I can see).

the one mapped by linux.(52, in my case)

still need sometime to figure out clearly.

@stephenm @gsatish10 Thanks.

Regards,
Kang
Tags (1)