Lines Matching +full:zynq +full:- +full:7000

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
30 * A GPIO driver for Xilinx Zynq-7000.
32 * The GPIO peripheral on Zynq allows controlling 114 general purpose I/Os.
34 * Pins 53-0 are sent to the MIO. Any MIO pins not used by a PS peripheral are
35 * available as a GPIO pin. Pins 64-127 are sent to the PL (FPGA) section of
36 * Zynq as EMIO signals.
41 * Reference: Zynq-7000 All Programmable SoC Technical Reference Manual.
71 /* Zynq 7000 */
103 #define ZYNQ_BANK_NPIN(type, bank) (ZYNQ##type##_BANK##bank##_NPIN)
104 #define ZYNQ_BANK_PIN_MIN(type, bank) (ZYNQ##type##_BANK##bank##_PIN_MIN)
105 #define ZYNQ_BANK_PIN_MAX(type, bank) (ZYNQ##type##_BANK##bank##_PIN_MIN + ZYNQ##type##_BANK##bank#…
107 #define ZYNQ_PIN_IS_MIO(type, pin) (pin >= ZYNQ##type##_PIN_MIO_MIN && \
108 pin <= ZYNQ##type##_PIN_MIO_MAX)
109 #define ZYNQ_PIN_IS_EMIO(type, pin) (pin >= ZYNQ##type##_PIN_EMIO_MIN && \
110 pin <= ZYNQ##type##_PIN_EMIO_MAX)
112 #define ZGPIO_LOCK(sc) mtx_lock(&(sc)->sc_mtx)
113 #define ZGPIO_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx)
115 mtx_init(&(sc)->sc_mtx, device_get_nameunit((sc)->dev), \
117 #define ZGPIO_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx);
142 .name = "Zynq-7000 GPIO Controller",
177 {"xlnx,zynqmp-gpio-1.0", (uintptr_t)&zynqmp_gpio_conf},
181 #define WR4(sc, off, val) bus_write_4((sc)->mem_res, (off), (val))
182 #define RD4(sc, off) bus_read_4((sc)->mem_res, (off))
184 /* Xilinx Zynq-7000 GPIO register definitions:
208 return (sc->busdev); in zy7_gpio_get_bus()
217 *maxpin = sc->conf->maxpin; in zy7_gpio_pin_max()
229 for (i = 0; i < sc->conf->nbanks; i++) { in zy7_pin_valid()
230 if (pin >= sc->conf->bank_min[i] && pin <= sc->conf->bank_max[i]) { in zy7_pin_valid()
264 switch (sc->conf->type) { in zy7_gpio_pin_getname()
278 name[GPIOMAXNAME - 1] = '\0'; in zy7_gpio_pin_getname()
280 snprintf(name, GPIOMAXNAME, "EMIO_%d", pin - emio_min); in zy7_gpio_pin_getname()
281 name[GPIOMAXNAME - 1] = '\0'; in zy7_gpio_pin_getname()
413 conf = (struct zynq_gpio_conf *)ofw_bus_search_compatible(dev, compat_data)->ocd_data; in zy7_gpio_probe()
417 device_set_desc(dev, conf->name); in zy7_gpio_probe()
429 sc->dev = dev; in zy7_gpio_attach()
430 sc->conf = (struct zynq_gpio_conf *)ofw_bus_search_compatible(dev, compat_data)->ocd_data; in zy7_gpio_attach()
436 sc->mem_res = bus_alloc_resource_any(dev, in zy7_gpio_attach()
438 if (sc->mem_res == NULL) { in zy7_gpio_attach()
444 sc->busdev = gpiobus_attach_bus(dev); in zy7_gpio_attach()
445 if (sc->busdev == NULL) { in zy7_gpio_attach()
460 if (sc->mem_res != NULL) { in zy7_gpio_detach()
463 rman_get_rid(sc->mem_res), sc->mem_res); in zy7_gpio_detach()