Changeset View
Changeset View
Standalone View
Standalone View
sys/arm/broadcom/bcm2835/bcm2835_gpio.c
Show First 20 Lines • Show All 1,009 Lines • ▼ Show 20 Lines | bcm_gpio_pic_enable_intr(device_t dev, struct intr_irqsrc *isrc) | ||||
bcm_gpio_isrc_unmask(sc, bgi); | bcm_gpio_isrc_unmask(sc, bgi); | ||||
} | } | ||||
static int | static int | ||||
bcm_gpio_pic_map_fdt(struct bcm_gpio_softc *sc, struct intr_map_data_fdt *daf, | bcm_gpio_pic_map_fdt(struct bcm_gpio_softc *sc, struct intr_map_data_fdt *daf, | ||||
u_int *irqp, uint32_t *modep) | u_int *irqp, uint32_t *modep) | ||||
{ | { | ||||
u_int irq; | u_int irq; | ||||
uint32_t mode, bank; | uint32_t mode; | ||||
/* | /* | ||||
* The first cell is the interrupt number. | * The first cell is the interrupt number. | ||||
* The second cell is used to specify flags: | * The second cell is used to specify flags: | ||||
* bits[3:0] trigger type and level flags: | * bits[3:0] trigger type and level flags: | ||||
* 1 = low-to-high edge triggered. | * 1 = low-to-high edge triggered. | ||||
* 2 = high-to-low edge triggered. | * 2 = high-to-low edge triggered. | ||||
* 4 = active high level-sensitive. | * 4 = active high level-sensitive. | ||||
* 8 = active low level-sensitive. | * 8 = active low level-sensitive. | ||||
*/ | */ | ||||
if (daf->ncells != 2) | if (daf->ncells != 2) | ||||
return (EINVAL); | return (EINVAL); | ||||
irq = daf->cells[0]; | irq = daf->cells[0]; | ||||
if (irq >= BCM_GPIO_PINS || bcm_gpio_pin_is_ro(sc, irq)) | if (irq >= BCM_GPIO_PINS || bcm_gpio_pin_is_ro(sc, irq)) | ||||
return (EINVAL); | return (EINVAL); | ||||
/* Only reasonable modes are supported. */ | /* Only reasonable modes are supported. */ | ||||
bank = BCM_GPIO_BANK(irq); | |||||
if (daf->cells[1] == 1) | if (daf->cells[1] == 1) | ||||
mode = GPIO_INTR_EDGE_RISING; | mode = GPIO_INTR_EDGE_RISING; | ||||
else if (daf->cells[1] == 2) | else if (daf->cells[1] == 2) | ||||
mode = GPIO_INTR_EDGE_FALLING; | mode = GPIO_INTR_EDGE_FALLING; | ||||
else if (daf->cells[1] == 3) | else if (daf->cells[1] == 3) | ||||
mode = GPIO_INTR_EDGE_BOTH; | mode = GPIO_INTR_EDGE_BOTH; | ||||
else if (daf->cells[1] == 4) | else if (daf->cells[1] == 4) | ||||
mode = GPIO_INTR_LEVEL_HIGH; | mode = GPIO_INTR_LEVEL_HIGH; | ||||
▲ Show 20 Lines • Show All 185 Lines • Show Last 20 Lines |