Lines Matching +full:mhu +full:- +full:doorbell

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
64 { -1, 0 }
84 reg = bus_read_4(sc->res[0], MHU_CHAN_RX_LP + MHU_INTR_STAT); in arm_doorbell_lp_intr()
88 bus_write_4(sc->res[0], MHU_CHAN_RX_LP + MHU_INTR_CLEAR, in arm_doorbell_lp_intr()
90 if (db->func != NULL) in arm_doorbell_lp_intr()
91 db->func(db->arg); in arm_doorbell_lp_intr()
106 reg = bus_read_4(sc->res[0], MHU_CHAN_RX_HP + MHU_INTR_STAT); in arm_doorbell_hp_intr()
110 bus_write_4(sc->res[0], MHU_CHAN_RX_HP + MHU_INTR_CLEAR, in arm_doorbell_hp_intr()
112 if (db->func != NULL) in arm_doorbell_hp_intr()
113 db->func(db->arg); in arm_doorbell_hp_intr()
122 if (!ofw_bus_is_compatible(dev, "arm,mhu-doorbell")) in arm_doorbell_probe()
128 device_set_desc(dev, "ARM MHU Doorbell"); in arm_doorbell_probe()
141 sc->dev = dev; in arm_doorbell_attach()
144 if (node == -1) in arm_doorbell_attach()
147 if (bus_alloc_resources(dev, arm_doorbell_spec, sc->res) != 0) { in arm_doorbell_attach()
153 error = bus_setup_intr(dev, sc->res[1], INTR_TYPE_MISC | INTR_MPSAFE, in arm_doorbell_attach()
154 NULL, arm_doorbell_lp_intr, sc, &sc->lp_intr_cookie); in arm_doorbell_attach()
157 bus_release_resources(dev, arm_doorbell_spec, sc->res); in arm_doorbell_attach()
161 error = bus_setup_intr(dev, sc->res[2], INTR_TYPE_MISC | INTR_MPSAFE, in arm_doorbell_attach()
162 NULL, arm_doorbell_hp_intr, sc, &sc->hp_intr_cookie); in arm_doorbell_attach()
165 bus_release_resources(dev, arm_doorbell_spec, sc->res); in arm_doorbell_attach()
198 "#mbox-cells", &nmboxes); in arm_doorbell_ofw_get()
209 error = ofw_bus_find_string_index(node, "mbox-names", name, &idx); in arm_doorbell_ofw_get()
216 error = ofw_bus_parse_xref_list_alloc(node, "mboxes", "#mbox-cells", in arm_doorbell_ofw_get()
253 db->dev = dev; in arm_doorbell_ofw_get()
254 db->db_dev = db_dev; in arm_doorbell_ofw_get()
255 db->chan = chan; in arm_doorbell_ofw_get()
256 db->db = db_id; in arm_doorbell_ofw_get()
269 sc = device_get_softc(db->db_dev); in arm_doorbell_set()
271 switch (db->chan) { in arm_doorbell_set()
287 bus_write_4(sc->res[0], offset + MHU_INTR_SET, (1 << db->db)); in arm_doorbell_set()
297 sc = device_get_softc(db->db_dev); in arm_doorbell_get()
299 switch (db->chan) { in arm_doorbell_get()
313 reg = bus_read_4(sc->res[0], offset + MHU_INTR_STAT); in arm_doorbell_get()
314 if (reg & (1 << db->db)) { in arm_doorbell_get()
315 bus_write_4(sc->res[0], offset + MHU_INTR_CLEAR, in arm_doorbell_get()
316 (1 << db->db)); in arm_doorbell_get()
328 db->func = func; in arm_doorbell_set_handler()
329 db->arg = arg; in arm_doorbell_set_handler()