From: Mugunthan V N Date: Mon, 15 Feb 2016 10:01:39 +0000 (+0530) Subject: sf: spi_flash: use dma to copy data from mmap region if platform supports X-Git-Tag: v2016.03-rc3~57^2~5 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7bd1c59bdb5ccf5a0fbd8522fd35b9db1a450fb3;p=u-boot sf: spi_flash: use dma to copy data from mmap region if platform supports Add dma memcpy api to the default spi_flash_copy_mmap(), so that dma will be used to copy data when CONFIG_DMA is defined for the platform. Signed-off-by: Mugunthan V N Reviewed-by: Simon Glass Reviewed-by: Jagan Teki --- diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index 8a60c72926..3c365d5e9a 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -16,6 +16,7 @@ #include #include #include +#include #include "sf_internal.h" @@ -454,8 +455,16 @@ int spi_flash_read_common(struct spi_flash *flash, const u8 *cmd, return ret; } +/* + * TODO: remove the weak after all the other spi_flash_copy_mmap + * implementations removed from drivers + */ void __weak spi_flash_copy_mmap(void *data, void *offset, size_t len) { +#ifdef CONFIG_DMA + if (!dma_memcpy(data, offset, len)) + return; +#endif memcpy(data, offset, len); }