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: 
Adventurer
Adventurer
4,905 Views
Registered: ‎09-28-2016

zynq7000 I2C0 interrupt IRQ?

Jump to solution

Hi,all

 

my board is zc706, I am confused by the zynq7000 interrupt IRQ, for example, the I2C0's IRQ number.

 

in the zynq-7000.dtsi file, about i2c0 as below:

i2c0: i2c@e0004000 {
            compatible = "cdns,i2c-r1p10";
            status = "disabled";
            clocks = <&clkc 38>;
            interrupt-parent = <&intc>;
            interrupts = <0 25 4>;
            reg = <0xe0004000 0x1000>;
            #address-cells = <1>;
            #size-cells = <0>;

 it shows  i2c0 IRQ number is 25.

 

 

but as ug585-Zynq-7000-TRM page 229 describration below:

 

Source   Interrupt Name    IRQ ID#     Status Bits           Required Type     PS-PL Signal Name     I/0

IOP                 I2C0                     57      spi_status_0[25]        High level              IRQP2F[11]           Output

 

 it shows  i2c0 IRQ number is 57.

 

 

who can clarify it clearly? thanks a lot in advanced

 

 

Tom

0 Kudos
1 Solution

Accepted Solutions
Moderator
Moderator
8,986 Views
Registered: ‎12-04-2016

Re: zynq7000 I2C0 interrupt IRQ?

Jump to solution

Hi Tom

 

Let me allow to Clarify the Interrupt Related Stuff with respect to Zynq:

 

Let's consider your Case:

   interrupts = < 0 25 4 >;
   interrupt-parent = <intc>; ---> Interrupt Controller GIC

Let's look into, what are these three numbers assigned to “interrupts”?

 

The first number (zero) is a flag indicating if the interrupt is an SPI (shared peripheral interrupt). A nonzero value means it is an SPI. The truth is that these interrupts are SPIs according to Zynq’s Technical Reference Manual (the TRM), and still the common convention is to write zero in this field, saying that they aren’t. Since this misdeclaration is so common, it’s recommended to stick to it, in particular since declaring the interrupt as an SPI will cause some confusion regarding the interrupt number.

 

The second number is related to the interrupt number. To make a long story short, click the “GIC” box in Vivado or XPS’s main window’s “Zynq” tab, look at the number assigned to the interrupt (57 for I2C0 ) and subtract it by 32 (57 - 32 = 25).

So, next immediate doubt is why minus 32?

(The translate function normally adds 16 to SPIs and 32 to non-SPIs, so for interrupts generated by fabric logic in a Zynq, the number in the DTS file should be the hardware number (as shown in Vivado) minus 32.)

So, put it in further short way, Get the Interrupt ID info from TRM and simply minus it with 32, and place resultant value in device tree entry of Interrupt.

 

The third number is the type of interrupt. Three values are possible:

  • 0 — Leave it as it was (power-up default or what the bootloader set it to, if it did)
  • 1 — Rising edge
  • 4 — Level sensitive, active high

I hope, i tried my best to clarify your doubt. Thanks

 

 

Best Regards

Shabbir

6 Replies
Moderator
Moderator
8,987 Views
Registered: ‎12-04-2016

Re: zynq7000 I2C0 interrupt IRQ?

Jump to solution

Hi Tom

 

Let me allow to Clarify the Interrupt Related Stuff with respect to Zynq:

 

Let's consider your Case:

   interrupts = < 0 25 4 >;
   interrupt-parent = <intc>; ---> Interrupt Controller GIC

Let's look into, what are these three numbers assigned to “interrupts”?

 

The first number (zero) is a flag indicating if the interrupt is an SPI (shared peripheral interrupt). A nonzero value means it is an SPI. The truth is that these interrupts are SPIs according to Zynq’s Technical Reference Manual (the TRM), and still the common convention is to write zero in this field, saying that they aren’t. Since this misdeclaration is so common, it’s recommended to stick to it, in particular since declaring the interrupt as an SPI will cause some confusion regarding the interrupt number.

 

The second number is related to the interrupt number. To make a long story short, click the “GIC” box in Vivado or XPS’s main window’s “Zynq” tab, look at the number assigned to the interrupt (57 for I2C0 ) and subtract it by 32 (57 - 32 = 25).

So, next immediate doubt is why minus 32?

(The translate function normally adds 16 to SPIs and 32 to non-SPIs, so for interrupts generated by fabric logic in a Zynq, the number in the DTS file should be the hardware number (as shown in Vivado) minus 32.)

So, put it in further short way, Get the Interrupt ID info from TRM and simply minus it with 32, and place resultant value in device tree entry of Interrupt.

 

The third number is the type of interrupt. Three values are possible:

  • 0 — Leave it as it was (power-up default or what the bootloader set it to, if it did)
  • 1 — Rising edge
  • 4 — Level sensitive, active high

I hope, i tried my best to clarify your doubt. Thanks

 

 

Best Regards

Shabbir

Explorer
Explorer
4,824 Views
Registered: ‎11-22-2015

Re: zynq7000 I2C0 interrupt IRQ?

Jump to solution

 This is a very good explanation of what is in the devicetree but there is no reason you should have to edit the devicetree.  The devicetree can be automatically be generated by the xilinx tools and then you can parse the devicetree in your device driver.  The linux devicetree API's can be used to find the correct IRQ for the device.  

  If you use this method you will never have to look at the TRM and try to figure out what is going on the since the tools will generate the devicetree correctly for the kernel it is built for.

 

jeff

0 Kudos
Adventurer
Adventurer
4,795 Views
Registered: ‎09-28-2016

Re: zynq7000 I2C0 interrupt IRQ?

Jump to solution

Hi, Shabbir

 

thank your very much for your clarification, I have understood the  translate function.

another question maybe clarify it please.

 

i2c0: i2c@e0004000 {
            compatible = "cdns,i2c-r1p10";
            status = "disabled";
            clocks = <&clkc 38>;
            interrupt-parent = <&intc>;
            interrupts = <0 25 4>;
            reg = <0xe0004000 0x1000>;
            #address-cells = <1>;
            #size-cells = <0>;

 

what's the mean of the entry of "clocks = <&clkc 38>;"

 

in the device tree file zynq-7000.dtsi, have a relate to clock entry as below:

clkc: clkc@100 {
                #clock-cells = <1>;
                compatible = "xlnx,ps7-clkc";
                fclk-enable = <0xf>;
                clock-output-names = "armpll", "ddrpll", "iopll", "cpu_6or4x",
                        "cpu_3or2x", "cpu_2x", "cpu_1x", "ddr2x", "ddr3x",
                        "dci", "lqspi", "smc", "pcap", "gem0", "gem1",
                        "fclk0", "fclk1", "fclk2", "fclk3", "can0", "can1",
                        "sdio0", "sdio1", "uart0", "uart1", "spi0", "spi1",
                        "dma", "usb0_aper", "usb1_aper", "gem0_aper",
                        "gem1_aper", "sdio0_aper", "sdio1_aper",
                        "spi0_aper", "spi1_aper", "can0_aper", "can1_aper",
                        "i2c0_aper", "i2c1_aper", "uart0_aper", "uart1_aper",
                        "gpio_aper", "lqspi_aper", "smc_aper", "swdt",
                        "dbg_trc", "dbg_apb";
                reg = <0x100 0x100>;
            };

 

what's the relationship between i2c0's clocks attribute and clkc node?

 

 

Tom

 

 

0 Kudos
Adventurer
Adventurer
4,794 Views
Registered: ‎09-28-2016

Re: zynq7000 I2C0 interrupt IRQ?

Jump to solution

hi, jeff

 

thanks, I have got it!!!

0 Kudos
Explorer
Explorer
4,727 Views
Registered: ‎06-03-2015

Re: zynq7000 I2C0 interrupt IRQ?

Jump to solution

Hi Tom,

 

what's the relationship between i2c0's clocks attribute and clkc node?

[Satish]: This regards to clock framework used in the BSP and internally relates to Power management.

In this scenario, .dtsi is talking about SoC capabilities 

from .dtsi file, clk presenting in dtsi is connected to different device clocks.  

clkc: clkc@100 {
                #clock-cells = <1>;
                compatible = "xlnx,ps7-clkc";
                fclk-enable = <0xf>;
                clock-output-names = "armpll", "ddrpll", "iopll", "cpu_6or4x",
                        "cpu_3or2x", "cpu_2x", "cpu_1x", "ddr2x", "ddr3x",
                        "dci", "lqspi", "smc", "pcap", "gem0", "gem1",
                        "fclk0", "fclk1", "fclk2", "fclk3", "can0", "can1",
                        "sdio0", "sdio1", "uart0", "uart1", "spi0", "spi1",
                        "dma", "usb0_aper", "usb1_aper", "gem0_aper",
                        "gem1_aper", "sdio0_aper", "sdio1_aper",
                        "spi0_aper", "spi1_aper", "can0_aper", "can1_aper",
                        "i2c0_aper", "i2c1_aper", "uart0_aper", "uart1_aper",
                        "gpio_aper", "lqspi_aper", "smc_aper", "swdt",
                        "dbg_trc", "dbg_apb";
                reg = <0x100 0x100>;
            };

 

and .dts is talking about capabilities of the specific board, in your case it is I2C0

I2C0 is connected to .dtsi file clock entry in the corr spending address.

 

Thanks & regards,

Satish.G

 

G Satish Kumar
0 Kudos
Adventurer
Adventurer
4,680 Views
Registered: ‎09-28-2016

Re: zynq7000 I2C0 interrupt IRQ?

Jump to solution

Hi, gsatish10

 

thanks you, got it!!!

 

 

Tom

0 Kudos