Exemple #1
0
static int ti_edma3_transfer(struct udevice *dev, int direction, void *dst,
                             void *src, size_t len)
{
    struct ti_edma3_priv *priv = dev_get_priv(dev);

    /* enable edma3 clocks */
    enable_edma3_clocks();

    switch (direction) {
    case DMA_MEM_TO_MEM:
        __edma3_transfer(priv->base, 1, dst, src, len);
        break;
    default:
        error("Transfer type not implemented in DMA driver\n");
        break;
    }

    /* disable edma3 clocks */
    disable_edma3_clocks();

    return 0;
}
Exemple #2
0
/* TODO: control from sf layer to here through dm-spi */
static void ti_qspi_copy_mmap(void *data, void *offset, size_t len)
{
#if defined(CONFIG_TI_EDMA3) && !defined(CONFIG_DMA)
	unsigned int			addr = (unsigned int) (data);
	unsigned int			edma_slot_num = 1;

	/* Invalidate the area, so no writeback into the RAM races with DMA */
	invalidate_dcache_range(addr, addr + roundup(len, ARCH_DMA_MINALIGN));

	/* enable edma3 clocks */
	enable_edma3_clocks();

	/* Call edma3 api to do actual DMA transfer	*/
	edma3_transfer(EDMA3_BASE, edma_slot_num, data, offset, len);

	/* disable edma3 clocks */
	disable_edma3_clocks();
#else
	memcpy_fromio(data, offset, len);
#endif

	*((unsigned int *)offset) += len;
}