Howto access IRQ2 on a LS1046a

cancel
Showing results for 
Search instead for 
Did you mean: 

Howto access IRQ2 on a LS1046a

Jump to solution
830 Views
edelhardbecker
Contributor I

Hi all,

we're running a LS1046A-RDB and have to use (so far) external IRQ2 that should, according to the ref manual, be accessible at 165 of the GIC. We have the following entry in fsl-ls1046a-rdb.dts (inside the existing "&ifc { ... };"  section):

cpld: board-control@2,0 {
    compatible = "fsl,ls1046ardb-cpld";
    reg = <0x2 0x0 0x0010000>;
    interrupts = <GIC_SPI 165 IRQ_TYPE_LEVEL_LOW>;
    interrupt-parent = <&gic>;
    status = "okay";
};

In our "probe(struct platform_device *dev)" function, the dev->dev.of_node is filled with the entry "board-control" from the device tree. But the following call always fails (despite we can see the entries from the device tree in /proc/device-tree/soc/ifc@1530000/board-control@2,0/ ! ):

struct device_node *node = of_find_node_by_name(NULL, "fsl,ls1046ardb-cpld");
if (node == NULL) {
    printk("Error node not found\n");
}

When i nevertheless try to map the IRQ hardcoded, of_irq_to_resource(dev->dev.of_node, 0, <MyIRQ>) always fails (tried for MyIRQ 165, (165 - 32) and 2).

Interestingly in the resource of the platform_device there is a IRQ: at dev->resource[1] we find IRQ 12. With 12 filled in for MyIRQ calling of_irq_to_resource() succeeds, we can request the IRQ and see

root@ls1046ardb:~# cat /proc/interrupts
CPU0 CPU1 CPU2 CPU3
[ ... ]
11: 0 0 0 0 GIC 75 Level fsl-ifc
12: 0 0 0 0 GIC 197 Edge fsl,ls1046ardb-cpld, IFC CPLD Hack Driver

I.e. it is mapped by the kernel to 197, which is 165+32?!

What is missing for IRQ2?

Thanks and greetings,
Edelhard

Labels (1)
0 Kudos
1 Solution
372 Views
Pavel
NXP TechSupport
NXP TechSupport

NXP SDK for LS1046a does not declare IRQ2 interrupt in DTS file. This SDK supports sysfs for GPIO using as interrupt source. Perhaps this possibility can be used for your task. If IRQ2 is needed, see attached files.

  1. Declare the IRQ properly in the DTS. See the fsl-ls1046a-qds.dts file as example. Find the "IRQ10_B" in this file. The value of the "interrupt"

It looks like that

                                                                                                                                                                                                            interrupts = <GIC_SPI 165 IRQ_TYPE_LEVEL_LOW>;

property should be added.

property is calculated as "Internal interrupt ID" - 32

  

  1. Request the interrupt property from the Open Firmware in the driver.

 

  1. Map the interrupt to the resource ID. This can be done by of_irq_to_resource() or by irq_of_parse_and_map().

  

  1. Request the interrupt by the resource number.


Have a great day,
Pavel Chubakov

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
3 Replies
373 Views
Pavel
NXP TechSupport
NXP TechSupport

NXP SDK for LS1046a does not declare IRQ2 interrupt in DTS file. This SDK supports sysfs for GPIO using as interrupt source. Perhaps this possibility can be used for your task. If IRQ2 is needed, see attached files.

  1. Declare the IRQ properly in the DTS. See the fsl-ls1046a-qds.dts file as example. Find the "IRQ10_B" in this file. The value of the "interrupt"

It looks like that

                                                                                                                                                                                                            interrupts = <GIC_SPI 165 IRQ_TYPE_LEVEL_LOW>;

property should be added.

property is calculated as "Internal interrupt ID" - 32

  

  1. Request the interrupt property from the Open Firmware in the driver.

 

  1. Map the interrupt to the resource ID. This can be done by of_irq_to_resource() or by irq_of_parse_and_map().

  

  1. Request the interrupt by the resource number.


Have a great day,
Pavel Chubakov

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
372 Views
edelhardbecker
Contributor I

Thanks Pavel, it is working now with IRQ2 (no GPIO workaround needed). Device tree entry is 

 interrupts = <GIC_SPI 133 IRQ_TYPE_LEVEL_LOW>;

and linux reports:

     CPU0 CPU1 CPU2 CPU3
 12:    3    0    0    0    GIC 165 Level     IFC CPLD Hack Driver

Greetings,

Edelhard

0 Kudos
372 Views
edelhardbecker
Contributor I

Addendum: however we try to request_irq() (or devm_request_irq()), it always fails in irq_to_desc(). It seems the kernel does not have 165 (and 133) in its irq_desc list. Isn't this created by the device tree?

Thanks again,
Edelhard

0 Kudos