static void altera_tse_stop_msgdma(struct udevice *dev) { struct altera_tse_priv *priv = dev_get_priv(dev); msgdma_reset(priv->sgdma_rx); msgdma_reset(priv->sgdma_tx); }
static int msgdma_attach(device_t dev) { struct msgdma_softc *sc; phandle_t xref, node; int err; sc = device_get_softc(dev); sc->dev = dev; if (bus_alloc_resources(dev, msgdma_spec, sc->res)) { device_printf(dev, "could not allocate resources for device\n"); return (ENXIO); } /* CSR memory interface */ sc->bst = rman_get_bustag(sc->res[0]); sc->bsh = rman_get_bushandle(sc->res[0]); /* Descriptor memory interface */ sc->bst_d = rman_get_bustag(sc->res[1]); sc->bsh_d = rman_get_bushandle(sc->res[1]); /* Setup interrupt handler */ err = bus_setup_intr(dev, sc->res[2], INTR_TYPE_MISC | INTR_MPSAFE, NULL, msgdma_intr, sc, &sc->ih); if (err) { device_printf(dev, "Unable to alloc interrupt resource.\n"); return (ENXIO); } node = ofw_bus_get_node(dev); xref = OF_xref_from_node(node); OF_device_register_xref(xref, dev); if (msgdma_reset(sc) != 0) return (-1); WRITE4(sc, DMA_CONTROL, CONTROL_GIEM); return (0); }