| 636 | } |
| 637 | |
| 638 | static int |
| 639 | aw_mmc_setup_dma(struct aw_mmc_softc *sc) |
| 640 | { |
| 641 | int error; |
| 642 | |
| 643 | /* Allocate the DMA descriptor memory. */ |
| 644 | error = bus_dma_tag_create( |
| 645 | bus_get_dma_tag(sc->aw_dev), /* parent */ |
| 646 | AW_MMC_DMA_ALIGN, 0, /* align, boundary */ |
| 647 | BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ |
| 648 | BUS_SPACE_MAXADDR, /* highaddr */ |
| 649 | NULL, NULL, /* filter, filterarg*/ |
| 650 | AW_MMC_DMA_DESC_SIZE, 1, /* maxsize, nsegment */ |
| 651 | AW_MMC_DMA_DESC_SIZE, /* maxsegsize */ |
| 652 | 0, /* flags */ |
| 653 | NULL, NULL, /* lock, lockarg*/ |
| 654 | &sc->aw_dma_tag); |
| 655 | if (error) |
| 656 | return (error); |
| 657 | |
| 658 | error = bus_dmamem_alloc(sc->aw_dma_tag, &sc->aw_dma_desc, |
| 659 | BUS_DMA_COHERENT | BUS_DMA_WAITOK | BUS_DMA_ZERO, |
| 660 | &sc->aw_dma_map); |
| 661 | if (error) |
| 662 | return (error); |
| 663 | |
| 664 | error = bus_dmamap_load(sc->aw_dma_tag, |
| 665 | sc->aw_dma_map, |
| 666 | sc->aw_dma_desc, AW_MMC_DMA_DESC_SIZE, |
| 667 | aw_dma_desc_cb, sc, 0); |
| 668 | if (error) |
| 669 | return (error); |
| 670 | if (sc->aw_dma_map_err) |
| 671 | return (sc->aw_dma_map_err); |
| 672 | |
| 673 | /* Create the DMA map for data transfers. */ |
| 674 | error = bus_dma_tag_create( |
| 675 | bus_get_dma_tag(sc->aw_dev), /* parent */ |
| 676 | AW_MMC_DMA_ALIGN, 0, /* align, boundary */ |
| 677 | BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ |
| 678 | BUS_SPACE_MAXADDR, /* highaddr */ |
| 679 | NULL, NULL, /* filter, filterarg*/ |
| 680 | sc->aw_mmc_conf->dma_xferlen * |
| 681 | AW_MMC_DMA_SEGS, AW_MMC_DMA_SEGS, /* maxsize, nsegments */ |
| 682 | sc->aw_mmc_conf->dma_xferlen, /* maxsegsize */ |
| 683 | BUS_DMA_ALLOCNOW, /* flags */ |
| 684 | NULL, NULL, /* lock, lockarg*/ |
| 685 | &sc->aw_dma_buf_tag); |
| 686 | if (error) |
| 687 | return (error); |
| 688 | error = bus_dmamap_create(sc->aw_dma_buf_tag, 0, |
| 689 | &sc->aw_dma_buf_map); |
| 690 | if (error) |
| 691 | return (error); |
| 692 | |
| 693 | return (0); |
| 694 | } |
| 695 |
no test coverage detected