1/* 2* Copyright 2019, Data61 3* Commonwealth Scientific and Industrial Research Organisation (CSIRO) 4* ABN 41 687 119 230. 5* 6* This software may be distributed and modified according to the terms of 7* the BSD 2-Clause license. Note that NO WARRANTY is provided. 8* See "LICENSE_BSD2.txt" for details. 9* 10* @TAG(DATA61_BSD) 11*/ 12 13#include <assert.h> 14#include <stdbool.h> 15 16#include <utils/util.h> 17 18#include "../../../irqchip.h" 19 20#define FSL_AVIC_INT_CELL_COUNT 1 21 22static int parse_fsl_avic_interrupts(char *dtb_blob, int node_offset, int intr_controller_phandle, 23 irq_walk_cb_fn_t callback, void *token) 24{ 25 bool is_extended = false; 26 int prop_len = 0; 27 const void *interrupts_prop = get_interrupts_prop(dtb_blob, node_offset, &is_extended, &prop_len); 28 assert(interrupts_prop != NULL); 29 int UNUSED total_cells = prop_len / sizeof(uint32_t); 30 /* There's only one interrupt cell for this IRQ chip */ 31 assert(total_cells == FSL_AVIC_INT_CELL_COUNT); 32 ps_irq_t irq = { .type = PS_INTERRUPT, .irq = { .number = READ_CELL(1, interrupts_prop, 0) }}; 33 int error = callback(irq, 0, FSL_AVIC_INT_CELL_COUNT, token); 34 if (error) { 35 return error; 36 } 37 return 0; 38} 39 40char *fsl_avic_compatible_list[] = { 41 "fsl,imx31-avic", 42 NULL 43}; 44DEFINE_IRQCHIP_PARSER(fsl_avic, fsl_avic_compatible_list, parse_fsl_avic_interrupts); 45