Changeset View
Changeset View
Standalone View
Standalone View
sys/arm/mv/mv_ap806_gicp.c
Show First 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | if ((intr_parent = ofw_bus_find_iparent(node)) == 0) { | ||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
if ((sc->parent = OF_device_from_xref(intr_parent)) == NULL) { | if ((sc->parent = OF_device_from_xref(intr_parent)) == NULL) { | ||||
device_printf(dev, | device_printf(dev, | ||||
"cannot find parent interrupt controller device\n"); | "cannot find parent interrupt controller device\n"); | ||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
sc->spi_ranges_cnt = OF_getencprop_alloc(node, "marvell,spi-ranges", | sc->spi_ranges_cnt = OF_getencprop_alloc(node, "marvell,spi-ranges", | ||||
mmel: OF_getencprop_alloc_multi() should be used here. | |||||
(void **)&sc->spi_ranges); | (void **)&sc->spi_ranges) / sizeof(*sc->spi_ranges); | ||||
xref = OF_xref_from_node(node); | xref = OF_xref_from_node(node); | ||||
if (intr_pic_register(dev, xref) == NULL) { | if (intr_pic_register(dev, xref) == NULL) { | ||||
device_printf(dev, "Cannot register GICP\n"); | device_printf(dev, "Cannot register GICP\n"); | ||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
/* Allocate GIC compatible mapping entry (3 cells) */ | /* Allocate GIC compatible mapping entry (3 cells) */ | ||||
sc->parent_map_data = (struct intr_map_data_fdt *)intr_alloc_map_data( | sc->parent_map_data = (struct intr_map_data_fdt *)intr_alloc_map_data( | ||||
Show All 28 Lines | if (irq_num >= MV_AP806_GICP_MAX_NIRQS) | ||||
return (NULL); | return (NULL); | ||||
/* Construct GIC compatible mapping. */ | /* Construct GIC compatible mapping. */ | ||||
sc->parent_map_data->ncells = 3; | sc->parent_map_data->ncells = 3; | ||||
sc->parent_map_data->cells[0] = 0; /* SPI */ | sc->parent_map_data->cells[0] = 0; /* SPI */ | ||||
sc->parent_map_data->cells[2] = irq_type; | sc->parent_map_data->cells[2] = irq_type; | ||||
/* Map the interrupt number to SPI number */ | /* Map the interrupt number to SPI number */ | ||||
for (i = 0; i < sc->spi_ranges_cnt / 2; i += 2) { | for (i = 0; i < sc->spi_ranges_cnt; i += 2) { | ||||
if (irq_num < sc->spi_ranges[i + 1]) { | if (irq_num < sc->spi_ranges[i + 1]) { | ||||
irq_num += sc->spi_ranges[i]; | irq_num += sc->spi_ranges[i]; | ||||
break; | break; | ||||
} | } | ||||
irq_num -= sc->spi_ranges[i]; | irq_num -= sc->spi_ranges[i]; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 164 Lines • Show Last 20 Lines |
OF_getencprop_alloc_multi() should be used here.