So @stefan_e.tx was onto something with the suggestion of using the function platform_get_irq_by_name
, however, since I am developing a normal linux device driver and not a platform driver, Im not sure that I could use this method. There is a different set of functions that can be used to get information from the device-tree and map that into linux values. So I got the interrupt to work in the using the following:
struct device_node* device_tree_node = NULL;
device_tree_node = of_find_node_by_name( NULL, "gpt1" );
if ( device_tree_node == NULL ) {
printk( KERN_ALERT "Device tree node: %s is not defined in DTS\n", "gpt1" );
return -1;
}
int irq_number = irq_of_parse_and_map( device_tree_node, 0 );
if ( request_irq(irq_number, irq_handler, IRQF_SHARED, "interrupt_routine_name",
(void*)( &interrupt_data ) ) ) {
printk( KERN_ALERT "FAILED TO SETUP IRQ %i", irq_number );
return -1;
}
Where gpt1
is the node name infront of the physical memory specialization(I was not able to use any other names or labels to acquire this information)
lsio_gpt1: gpt1@5d150000 {
interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>;
};
And the irq_handler
has a signature of:
static irqreturn_t irq_handler( int irq, void* dev_id ) {}
In the end, using interrupts for measuring the frequency of an external signal was not a reliable method when the frequency got too high. So i ended up using the external signal as the an external clock for the signal and then counting the number of ticks that happens in a given amount of time, which works surprisingly well