Lines Matching +full:- +full:gpio +full:- +full:bank

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
5 * Copyright (c) 2012-2015 Luiz Otavio O Souza <loos@FreeBSD.org>
36 #include <sys/gpio.h>
50 #include <dev/gpio/gpiobusvar.h>
94 { SYS_RES_IRQ, 0, RF_ACTIVE }, /* bank 0 interrupt */
95 { SYS_RES_IRQ, 1, RF_ACTIVE }, /* bank 1 interrupt */
96 { -1, 0, 0 }
135 #define BCM_GPIO_LOCK(_sc) mtx_lock_spin(&(_sc)->sc_mtx)
136 #define BCM_GPIO_UNLOCK(_sc) mtx_unlock_spin(&(_sc)->sc_mtx)
137 #define BCM_GPIO_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED)
139 bus_space_write_4((_sc)->sc_bst, (_sc)->sc_bsh, _off, _val)
141 bus_space_read_4((_sc)->sc_bst, (_sc)->sc_bsh, _off)
169 {"broadcom,bcm2835-gpio", 1},
170 {"brcm,bcm2835-gpio", 1},
171 {"brcm,bcm2711-gpio", 1},
187 for (i = 0; i < sc->sc_ro_npins; i++) in bcm_gpio_pin_is_ro()
188 if (pin == sc->sc_ro_pins[i]) in bcm_gpio_pin_is_ro()
196 uint32_t bank, func, offset; in bcm_gpio_get_function() local
198 /* Five banks, 10 pins per bank, 3 bits per pin. */ in bcm_gpio_get_function()
199 bank = pin / 10; in bcm_gpio_get_function()
200 offset = (pin - bank * 10) * 3; in bcm_gpio_get_function()
203 func = (BCM_GPIO_READ(sc, BCM_GPIO_GPFSEL(bank)) >> offset) & 7; in bcm_gpio_get_function()
264 return (-1); in bcm_gpio_str_func()
285 uint32_t bank, data, offset; in bcm_gpio_set_function() local
290 /* Five banks, 10 pins per bank, 3 bits per pin. */ in bcm_gpio_set_function()
291 bank = pin / 10; in bcm_gpio_set_function()
292 offset = (pin - bank * 10) * 3; in bcm_gpio_set_function()
294 data = BCM_GPIO_READ(sc, BCM_GPIO_GPFSEL(bank)); in bcm_gpio_set_function()
297 BCM_GPIO_WRITE(sc, BCM_GPIO_GPFSEL(bank), data); in bcm_gpio_set_function()
306 if (sc->sc_is2711) { /* BCM2711 */ in bcm_gpio_set_pud()
328 uint32_t bank; in bcm_gpio_set_pud() local
330 bank = BCM_GPIO_BANK(pin); in bcm_gpio_set_pud()
332 BCM_GPIO_WRITE(sc, BCM2835_GPIO_GPPUDCLK(bank), BCM_GPIO_MASK(pin)); in bcm_gpio_set_pud()
334 BCM_GPIO_WRITE(sc, BCM2835_GPIO_GPPUDCLK(bank), 0); in bcm_gpio_set_pud()
351 for (i = 0; i < sc->sc_gpio_npins; i++) { in bcm_gpio_set_alternate()
352 if (sc->sc_gpio_pins[i].gp_pin == pin) in bcm_gpio_set_alternate()
355 if (i < sc->sc_gpio_npins) in bcm_gpio_set_alternate()
356 sc->sc_gpio_pins[i].gp_flags = bcm_gpio_func_flag(nfunc); in bcm_gpio_set_alternate()
372 pin->gp_flags &= ~(GPIO_PIN_INPUT|GPIO_PIN_OUTPUT); in bcm_gpio_pin_configure()
374 pin->gp_flags |= GPIO_PIN_OUTPUT; in bcm_gpio_pin_configure()
375 bcm_gpio_set_function(sc, pin->gp_pin, in bcm_gpio_pin_configure()
378 pin->gp_flags |= GPIO_PIN_INPUT; in bcm_gpio_pin_configure()
379 bcm_gpio_set_function(sc, pin->gp_pin, in bcm_gpio_pin_configure()
384 /* Manage Pull-up/pull-down. */ in bcm_gpio_pin_configure()
385 pin->gp_flags &= ~(GPIO_PIN_PULLUP|GPIO_PIN_PULLDOWN); in bcm_gpio_pin_configure()
388 pin->gp_flags |= GPIO_PIN_PULLUP; in bcm_gpio_pin_configure()
389 bcm_gpio_set_pud(sc, pin->gp_pin, BCM_GPIO_PULLUP); in bcm_gpio_pin_configure()
391 pin->gp_flags |= GPIO_PIN_PULLDOWN; in bcm_gpio_pin_configure()
392 bcm_gpio_set_pud(sc, pin->gp_pin, BCM_GPIO_PULLDOWN); in bcm_gpio_pin_configure()
395 bcm_gpio_set_pud(sc, pin->gp_pin, BCM_GPIO_NONE); in bcm_gpio_pin_configure()
407 return (sc->sc_busdev); in bcm_gpio_get_bus()
416 *maxpin = sc->sc_maxpins - 1; in bcm_gpio_pin_max()
426 for (i = 0; i < sc->sc_gpio_npins; i++) { in bcm_gpio_pin_getcaps()
427 if (sc->sc_gpio_pins[i].gp_pin == pin) in bcm_gpio_pin_getcaps()
431 if (i >= sc->sc_gpio_npins) in bcm_gpio_pin_getcaps()
435 *caps = sc->sc_gpio_pins[i].gp_caps; in bcm_gpio_pin_getcaps()
447 for (i = 0; i < sc->sc_gpio_npins; i++) { in bcm_gpio_pin_getflags()
448 if (sc->sc_gpio_pins[i].gp_pin == pin) in bcm_gpio_pin_getflags()
452 if (i >= sc->sc_gpio_npins) in bcm_gpio_pin_getflags()
456 *flags = sc->sc_gpio_pins[i].gp_flags; in bcm_gpio_pin_getflags()
468 for (i = 0; i < sc->sc_gpio_npins; i++) { in bcm_gpio_pin_getname()
469 if (sc->sc_gpio_pins[i].gp_pin == pin) in bcm_gpio_pin_getname()
473 if (i >= sc->sc_gpio_npins) in bcm_gpio_pin_getname()
477 memcpy(name, sc->sc_gpio_pins[i].gp_name, GPIOMAXNAME); in bcm_gpio_pin_getname()
489 for (i = 0; i < sc->sc_gpio_npins; i++) { in bcm_gpio_pin_setflags()
490 if (sc->sc_gpio_pins[i].gp_pin == pin) in bcm_gpio_pin_setflags()
494 if (i >= sc->sc_gpio_npins) in bcm_gpio_pin_setflags()
497 /* We never touch on read-only/reserved pins. */ in bcm_gpio_pin_setflags()
501 bcm_gpio_pin_configure(sc, &sc->sc_gpio_pins[i], flags); in bcm_gpio_pin_setflags()
510 uint32_t bank, reg; in bcm_gpio_pin_set() local
513 for (i = 0; i < sc->sc_gpio_npins; i++) { in bcm_gpio_pin_set()
514 if (sc->sc_gpio_pins[i].gp_pin == pin) in bcm_gpio_pin_set()
517 if (i >= sc->sc_gpio_npins) in bcm_gpio_pin_set()
519 /* We never write to read-only/reserved pins. */ in bcm_gpio_pin_set()
523 bank = BCM_GPIO_BANK(pin); in bcm_gpio_pin_set()
525 reg = BCM_GPIO_GPSET(bank); in bcm_gpio_pin_set()
527 reg = BCM_GPIO_GPCLR(bank); in bcm_gpio_pin_set()
538 uint32_t bank, reg_data; in bcm_gpio_pin_get() local
541 for (i = 0; i < sc->sc_gpio_npins; i++) { in bcm_gpio_pin_get()
542 if (sc->sc_gpio_pins[i].gp_pin == pin) in bcm_gpio_pin_get()
545 if (i >= sc->sc_gpio_npins) in bcm_gpio_pin_get()
547 bank = BCM_GPIO_BANK(pin); in bcm_gpio_pin_get()
549 reg_data = BCM_GPIO_READ(sc, BCM_GPIO_GPLEV(bank)); in bcm_gpio_pin_get()
560 uint32_t bank, data, reg; in bcm_gpio_pin_toggle() local
563 for (i = 0; i < sc->sc_gpio_npins; i++) { in bcm_gpio_pin_toggle()
564 if (sc->sc_gpio_pins[i].gp_pin == pin) in bcm_gpio_pin_toggle()
567 if (i >= sc->sc_gpio_npins) in bcm_gpio_pin_toggle()
569 /* We never write to read-only/reserved pins. */ in bcm_gpio_pin_toggle()
573 bank = BCM_GPIO_BANK(pin); in bcm_gpio_pin_toggle()
574 data = BCM_GPIO_READ(sc, BCM_GPIO_GPLEV(bank)); in bcm_gpio_pin_toggle()
576 reg = BCM_GPIO_GPCLR(bank); in bcm_gpio_pin_toggle()
578 reg = BCM_GPIO_GPSET(bank); in bcm_gpio_pin_toggle()
595 sc = sc_sysctl->sc; in bcm_gpio_func_proc()
598 nfunc = bcm_gpio_get_function(sc, sc_sysctl->pin); in bcm_gpio_func_proc()
602 if (error != 0 || req->newptr == NULL) in bcm_gpio_func_proc()
604 /* Ignore changes on read-only pins. */ in bcm_gpio_func_proc()
605 if (bcm_gpio_pin_is_ro(sc, sc_sysctl->pin)) in bcm_gpio_func_proc()
612 bcm_gpio_set_alternate(sc->sc_dev, sc_sysctl->pin, nfunc); in bcm_gpio_func_proc()
628 * Add per-pin sysctl tree/handlers. in bcm_gpio_sysctl_init()
630 ctx = device_get_sysctl_ctx(sc->sc_dev); in bcm_gpio_sysctl_init()
631 tree_node = device_get_sysctl_tree(sc->sc_dev); in bcm_gpio_sysctl_init()
634 CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "GPIO Pins"); in bcm_gpio_sysctl_init()
637 for (i = 0; i < sc->sc_gpio_npins; i++) { in bcm_gpio_sysctl_init()
640 CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "GPIO Pin"); in bcm_gpio_sysctl_init()
643 sc->sc_sysctl[i].sc = sc; in bcm_gpio_sysctl_init()
644 sc_sysctl = &sc->sc_sysctl[i]; in bcm_gpio_sysctl_init()
645 sc_sysctl->sc = sc; in bcm_gpio_sysctl_init()
646 sc_sysctl->pin = sc->sc_gpio_pins[i].gp_pin; in bcm_gpio_sysctl_init()
665 return (-1); in bcm_gpio_get_ro_pins()
671 sc->sc_ro_pins[i + sc->sc_ro_npins] = pins[i]; in bcm_gpio_get_ro_pins()
672 sc->sc_ro_npins += npins; in bcm_gpio_get_ro_pins()
674 device_printf(sc->sc_dev, "%s pins: ", label); in bcm_gpio_get_ro_pins()
681 printf("%d-%d", range_start, range_stop); in bcm_gpio_get_ro_pins()
692 printf("%d-%d.\n", range_start, range_stop); in bcm_gpio_get_ro_pins()
704 phandle_t gpio, node, reserved; in bcm_gpio_get_reserved_pins() local
707 /* Get read-only pins if they're provided */ in bcm_gpio_get_reserved_pins()
708 gpio = ofw_bus_get_node(sc->sc_dev); in bcm_gpio_get_reserved_pins()
709 if (bcm_gpio_get_ro_pins(sc, gpio, "broadcom,read-only", in bcm_gpio_get_reserved_pins()
710 "read-only") != 0) in bcm_gpio_get_reserved_pins()
712 /* Traverse the GPIO subnodes to find the reserved pins node. */ in bcm_gpio_get_reserved_pins()
714 node = OF_child(gpio); in bcm_gpio_get_reserved_pins()
717 if (len == -1) in bcm_gpio_get_reserved_pins()
718 return (-1); in bcm_gpio_get_reserved_pins()
725 return (-1); in bcm_gpio_get_reserved_pins()
729 return (-1); in bcm_gpio_get_reserved_pins()
741 if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) in bcm_gpio_probe()
744 device_set_desc(dev, "BCM2708/2835 GPIO controller"); in bcm_gpio_probe()
758 if (sc->sc_res[1] == NULL || sc->sc_res[2] == NULL) in bcm_gpio_intr_attach()
759 return (-1); in bcm_gpio_intr_attach()
763 return (-1); in bcm_gpio_intr_attach()
765 if (bus_setup_intr(dev, sc->sc_res[1], INTR_TYPE_MISC | INTR_MPSAFE, in bcm_gpio_intr_attach()
766 bcm_gpio_intr_bank0, NULL, sc, &sc->sc_intrhand[0]) != 0) in bcm_gpio_intr_attach()
767 return (-1); in bcm_gpio_intr_attach()
768 if (bus_setup_intr(dev, sc->sc_res[2], INTR_TYPE_MISC | INTR_MPSAFE, in bcm_gpio_intr_attach()
769 bcm_gpio_intr_bank1, NULL, sc, &sc->sc_intrhand[1]) != 0) in bcm_gpio_intr_attach()
770 return (-1); in bcm_gpio_intr_attach()
781 if (sc->sc_intrhand[0] != NULL) in bcm_gpio_intr_detach()
782 bus_teardown_intr(dev, sc->sc_res[1], sc->sc_intrhand[0]); in bcm_gpio_intr_detach()
783 if (sc->sc_intrhand[1] != NULL) in bcm_gpio_intr_detach()
784 bus_teardown_intr(dev, sc->sc_res[2], sc->sc_intrhand[1]); in bcm_gpio_intr_detach()
793 phandle_t gpio; in bcm_gpio_attach() local
801 sc->sc_dev = dev; in bcm_gpio_attach()
802 mtx_init(&sc->sc_mtx, "bcm gpio", "gpio", MTX_SPIN); in bcm_gpio_attach()
803 if (bus_alloc_resources(dev, bcm_gpio_res_spec, sc->sc_res) != 0) { in bcm_gpio_attach()
807 sc->sc_bst = rman_get_bustag(sc->sc_res[0]); in bcm_gpio_attach()
808 sc->sc_bsh = rman_get_bushandle(sc->sc_res[0]); in bcm_gpio_attach()
810 gpio = ofw_bus_get_node(sc->sc_dev); in bcm_gpio_attach()
811 if (!OF_hasprop(gpio, "gpio-controller")) in bcm_gpio_attach()
812 /* Node is not a GPIO controller. */ in bcm_gpio_attach()
815 sc->sc_is2711 = ofw_bus_node_is_compatible(gpio, "brcm,bcm2711-gpio"); in bcm_gpio_attach()
816 sc->sc_maxpins = sc->sc_is2711 ? BCM2711_GPIO_PINS : BCM2835_GPIO_PINS; in bcm_gpio_attach()
817 /* Setup the GPIO interrupt handler. */ in bcm_gpio_attach()
819 device_printf(dev, "unable to setup the gpio irq handler\n"); in bcm_gpio_attach()
823 * Find the read-only pins. These are pins we never touch or bad in bcm_gpio_attach()
826 if (bcm_gpio_get_reserved_pins(sc) == -1) in bcm_gpio_attach()
829 for (i = 0, j = 0; j < sc->sc_maxpins; j++) { in bcm_gpio_attach()
830 snprintf(sc->sc_gpio_pins[i].gp_name, GPIOMAXNAME, in bcm_gpio_attach()
833 sc->sc_gpio_pins[i].gp_pin = j; in bcm_gpio_attach()
834 sc->sc_gpio_pins[i].gp_caps = BCM_GPIO_DEFAULT_CAPS; in bcm_gpio_attach()
835 sc->sc_gpio_pins[i].gp_flags = bcm_gpio_func_flag(func); in bcm_gpio_attach()
838 sc->sc_gpio_npins = i; in bcm_gpio_attach()
840 sc->sc_busdev = gpiobus_attach_bus(dev); in bcm_gpio_attach()
841 if (sc->sc_busdev == NULL) in bcm_gpio_attach()
851 bus_release_resources(dev, bcm_gpio_res_spec, sc->sc_res); in bcm_gpio_attach()
852 mtx_destroy(&sc->sc_mtx); in bcm_gpio_attach()
878 uint32_t bank; in bcm_gpio_isrc_eoi() local
881 bank = BCM_GPIO_BANK(bgi->bgi_irq); in bcm_gpio_isrc_eoi()
882 BCM_GPIO_WRITE(sc, BCM_GPIO_GPEDS(bank), bgi->bgi_mask); in bcm_gpio_isrc_eoi()
889 return (bgi->bgi_mode == GPIO_INTR_LEVEL_LOW || in bcm_gpio_isrc_is_level()
890 bgi->bgi_mode == GPIO_INTR_LEVEL_HIGH); in bcm_gpio_isrc_is_level()
896 uint32_t bank; in bcm_gpio_isrc_mask() local
898 bank = BCM_GPIO_BANK(bgi->bgi_irq); in bcm_gpio_isrc_mask()
900 switch (bgi->bgi_mode) { in bcm_gpio_isrc_mask()
902 BCM_GPIO_CLEAR_BITS(sc, BCM_GPIO_GPLEN(bank), bgi->bgi_mask); in bcm_gpio_isrc_mask()
905 BCM_GPIO_CLEAR_BITS(sc, BCM_GPIO_GPHEN(bank), bgi->bgi_mask); in bcm_gpio_isrc_mask()
908 BCM_GPIO_CLEAR_BITS(sc, BCM_GPIO_GPREN(bank), bgi->bgi_mask); in bcm_gpio_isrc_mask()
911 BCM_GPIO_CLEAR_BITS(sc, BCM_GPIO_GPFEN(bank), bgi->bgi_mask); in bcm_gpio_isrc_mask()
914 BCM_GPIO_CLEAR_BITS(sc, BCM_GPIO_GPREN(bank), bgi->bgi_mask); in bcm_gpio_isrc_mask()
915 BCM_GPIO_CLEAR_BITS(sc, BCM_GPIO_GPFEN(bank), bgi->bgi_mask); in bcm_gpio_isrc_mask()
924 uint32_t bank; in bcm_gpio_isrc_unmask() local
926 bank = BCM_GPIO_BANK(bgi->bgi_irq); in bcm_gpio_isrc_unmask()
928 switch (bgi->bgi_mode) { in bcm_gpio_isrc_unmask()
930 BCM_GPIO_SET_BITS(sc, BCM_GPIO_GPLEN(bank), bgi->bgi_mask); in bcm_gpio_isrc_unmask()
933 BCM_GPIO_SET_BITS(sc, BCM_GPIO_GPHEN(bank), bgi->bgi_mask); in bcm_gpio_isrc_unmask()
936 BCM_GPIO_SET_BITS(sc, BCM_GPIO_GPREN(bank), bgi->bgi_mask); in bcm_gpio_isrc_unmask()
939 BCM_GPIO_SET_BITS(sc, BCM_GPIO_GPFEN(bank), bgi->bgi_mask); in bcm_gpio_isrc_unmask()
942 BCM_GPIO_SET_BITS(sc, BCM_GPIO_GPREN(bank), bgi->bgi_mask); in bcm_gpio_isrc_unmask()
943 BCM_GPIO_SET_BITS(sc, BCM_GPIO_GPFEN(bank), bgi->bgi_mask); in bcm_gpio_isrc_unmask()
950 bcm_gpio_intr_internal(struct bcm_gpio_softc *sc, uint32_t bank) in bcm_gpio_intr_internal() argument
956 /* Do not care of spurious interrupt on GPIO. */ in bcm_gpio_intr_internal()
957 reg = BCM_GPIO_READ(sc, BCM_GPIO_GPEDS(bank)); in bcm_gpio_intr_internal()
959 irq = BCM_GPIO_PINS_PER_BANK * bank + ffs(reg) - 1; in bcm_gpio_intr_internal()
960 bgi = sc->sc_isrcs + irq; in bcm_gpio_intr_internal()
963 if (intr_isrc_dispatch(&bgi->bgi_isrc, in bcm_gpio_intr_internal()
964 curthread->td_intr_frame) != 0) { in bcm_gpio_intr_internal()
968 device_printf(sc->sc_dev, "Stray irq %u disabled\n", in bcm_gpio_intr_internal()
971 reg &= ~bgi->bgi_mask; in bcm_gpio_intr_internal()
997 name = device_get_nameunit(sc->sc_dev); in bcm_gpio_pic_attach()
998 for (irq = 0; irq < sc->sc_maxpins; irq++) { in bcm_gpio_pic_attach()
999 sc->sc_isrcs[irq].bgi_irq = irq; in bcm_gpio_pic_attach()
1000 sc->sc_isrcs[irq].bgi_mask = BCM_GPIO_MASK(irq); in bcm_gpio_pic_attach()
1001 sc->sc_isrcs[irq].bgi_mode = GPIO_INTR_CONFORM; in bcm_gpio_pic_attach()
1003 error = intr_isrc_register(&sc->sc_isrcs[irq].bgi_isrc, in bcm_gpio_pic_attach()
1004 sc->sc_dev, 0, "%s,%u", name, irq); in bcm_gpio_pic_attach()
1008 if (intr_pic_register(sc->sc_dev, in bcm_gpio_pic_attach()
1009 OF_xref_from_node(ofw_bus_get_node(sc->sc_dev))) == NULL) in bcm_gpio_pic_attach()
1023 device_printf(sc->sc_dev, "%s: not implemented yet\n", __func__); in bcm_gpio_pic_detach()
1031 uint32_t bank; in bcm_gpio_pic_config_intr() local
1033 bank = BCM_GPIO_BANK(bgi->bgi_irq); in bcm_gpio_pic_config_intr()
1035 bcm_gpio_modify(sc, BCM_GPIO_GPREN(bank), bgi->bgi_mask, in bcm_gpio_pic_config_intr()
1037 bcm_gpio_modify(sc, BCM_GPIO_GPFEN(bank), bgi->bgi_mask, in bcm_gpio_pic_config_intr()
1039 bcm_gpio_modify(sc, BCM_GPIO_GPHEN(bank), bgi->bgi_mask, in bcm_gpio_pic_config_intr()
1041 bcm_gpio_modify(sc, BCM_GPIO_GPLEN(bank), bgi->bgi_mask, in bcm_gpio_pic_config_intr()
1043 bgi->bgi_mode = mode; in bcm_gpio_pic_config_intr()
1062 arm_irq_memory_barrier(bgi->bgi_irq); in bcm_gpio_pic_enable_intr()
1077 * 1 = low-to-high edge triggered. in bcm_gpio_pic_map_fdt()
1078 * 2 = high-to-low edge triggered. in bcm_gpio_pic_map_fdt()
1079 * 4 = active high level-sensitive. in bcm_gpio_pic_map_fdt()
1080 * 8 = active low level-sensitive. in bcm_gpio_pic_map_fdt()
1082 if (daf->ncells != 2) in bcm_gpio_pic_map_fdt()
1085 irq = daf->cells[0]; in bcm_gpio_pic_map_fdt()
1086 if (irq >= sc->sc_maxpins || bcm_gpio_pin_is_ro(sc, irq)) in bcm_gpio_pic_map_fdt()
1090 if (daf->cells[1] == 1) in bcm_gpio_pic_map_fdt()
1092 else if (daf->cells[1] == 2) in bcm_gpio_pic_map_fdt()
1094 else if (daf->cells[1] == 3) in bcm_gpio_pic_map_fdt()
1096 else if (daf->cells[1] == 4) in bcm_gpio_pic_map_fdt()
1098 else if (daf->cells[1] == 8) in bcm_gpio_pic_map_fdt()
1116 irq = dag->gpio_pin_num; in bcm_gpio_pic_map_gpio()
1117 if (irq >= sc->sc_maxpins || bcm_gpio_pin_is_ro(sc, irq)) in bcm_gpio_pic_map_gpio()
1120 mode = dag->gpio_intr_mode; in bcm_gpio_pic_map_gpio()
1137 switch (data->type) { in bcm_gpio_pic_map()
1159 *isrcp = &sc->sc_isrcs[irq].bgi_isrc; in bcm_gpio_pic_map_intr()
1207 if (bcm_gpio_pic_map(sc, data, &irq, &mode) != 0 || bgi->bgi_irq != irq) in bcm_gpio_pic_setup_intr()
1214 if (isrc->isrc_handlers != 0) in bcm_gpio_pic_setup_intr()
1215 return (bgi->bgi_mode == mode ? 0 : EINVAL); in bcm_gpio_pic_setup_intr()
1228 if (isrc->isrc_handlers == 0) in bcm_gpio_pic_teardown_intr()
1237 /* We only have one child, the GPIO bus, which needs our own node. */ in bcm_gpio_get_node()
1291 /* Convert to gpio(4) flags */ in bcm_gpio_configure_pins()
1323 /* GPIO protocol */
1354 "gpio",