Lines Matching +full:ipq4019 +full:- +full:pinctrl

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
30 * This is a pinmux/gpio controller for the IPQ4018/IPQ4019.
245 GDEF(-1),
255 if (ofw_bus_is_compatible(dev, "qcom,ipq4019-pinctrl") == 0) in qcom_tlmm_ipq4018_probe()
259 "Qualcomm Atheross TLMM IPQ4018/IPQ4019 GPIO/Pinmux driver"); in qcom_tlmm_ipq4018_probe()
268 KASSERT(mtx_initialized(&sc->gpio_mtx), ("gpio mutex not initialized")); in qcom_tlmm_ipq4018_detach()
271 if (sc->gpio_ih) in qcom_tlmm_ipq4018_detach()
272 bus_teardown_intr(dev, sc->gpio_irq_res, sc->gpio_ih); in qcom_tlmm_ipq4018_detach()
273 if (sc->gpio_irq_res) in qcom_tlmm_ipq4018_detach()
274 bus_release_resource(dev, SYS_RES_IRQ, sc->gpio_irq_rid, in qcom_tlmm_ipq4018_detach()
275 sc->gpio_irq_res); in qcom_tlmm_ipq4018_detach()
276 if (sc->gpio_mem_res) in qcom_tlmm_ipq4018_detach()
277 bus_release_resource(dev, SYS_RES_MEMORY, sc->gpio_mem_rid, in qcom_tlmm_ipq4018_detach()
278 sc->gpio_mem_res); in qcom_tlmm_ipq4018_detach()
279 if (sc->gpio_pins) in qcom_tlmm_ipq4018_detach()
280 free(sc->gpio_pins, M_DEVBUF); in qcom_tlmm_ipq4018_detach()
281 mtx_destroy(&sc->gpio_mtx); in qcom_tlmm_ipq4018_detach()
297 mtx_init(&sc->gpio_mtx, device_get_nameunit(dev), NULL, MTX_DEF); in qcom_tlmm_ipq4018_attach()
300 sc->gpio_mem_rid = 0; in qcom_tlmm_ipq4018_attach()
301 sc->gpio_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, in qcom_tlmm_ipq4018_attach()
302 &sc->gpio_mem_rid, RF_ACTIVE); in qcom_tlmm_ipq4018_attach()
304 if (sc->gpio_mem_res == NULL) { in qcom_tlmm_ipq4018_attach()
310 if ((sc->gpio_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, in qcom_tlmm_ipq4018_attach()
311 &sc->gpio_irq_rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) { in qcom_tlmm_ipq4018_attach()
317 if ((bus_setup_intr(dev, sc->gpio_irq_res, INTR_TYPE_MISC, in qcom_tlmm_ipq4018_attach()
318 qcom_tlmm_filter, qcom_tlmm_intr, sc, &sc->gpio_ih))) { in qcom_tlmm_ipq4018_attach()
325 sc->dev = dev; in qcom_tlmm_ipq4018_attach()
326 sc->gpio_npins = QCOM_TLMM_IPQ4018_GPIO_PINS; in qcom_tlmm_ipq4018_attach()
327 sc->gpio_muxes = &gpio_muxes[0]; in qcom_tlmm_ipq4018_attach()
328 sc->sc_debug = 0; in qcom_tlmm_ipq4018_attach()
333 sc->gpio_pins = malloc(sizeof(*sc->gpio_pins) * sc->gpio_npins, in qcom_tlmm_ipq4018_attach()
337 for (i = 0; i < sc->gpio_npins; i++) { in qcom_tlmm_ipq4018_attach()
338 snprintf(sc->gpio_pins[i].gp_name, GPIOMAXNAME, in qcom_tlmm_ipq4018_attach()
340 sc->gpio_pins[i].gp_pin = i; in qcom_tlmm_ipq4018_attach()
341 sc->gpio_pins[i].gp_caps = DEFAULT_CAPS; in qcom_tlmm_ipq4018_attach()
343 &sc->gpio_pins[i].gp_flags); in qcom_tlmm_ipq4018_attach()
349 sc->busdev = gpiobus_attach_bus(dev); in qcom_tlmm_ipq4018_attach()
350 if (sc->busdev == NULL) { in qcom_tlmm_ipq4018_attach()