diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2020-02-14 16:40:18 +0900 |
---|---|---|
committer | Marek Szyprowski <m.szyprowski@samsung.com> | 2021-12-16 17:18:05 +0100 |
commit | faf35a6fb8451f1cba315af92ed776c819da43b9 (patch) | |
tree | 005df81276562ec364672f83e2662e2585e7b8ed | |
parent | 8d663097a6c6befcde98aaa4fb0c5a93d691e56f (diff) | |
download | u-boot-faf35a6fb8451f1cba315af92ed776c819da43b9.tar.gz u-boot-faf35a6fb8451f1cba315af92ed776c819da43b9.tar.bz2 u-boot-faf35a6fb8451f1cba315af92ed776c819da43b9.zip |
dma-mapping: fix the prototype of dma_unmap_single()
dma_unmap_single() takes the dma address, not virtual address.
Change-Id: I90d611e4236b4d9089236019bb319cc4f7685a4f
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
-rw-r--r-- | arch/arm/include/asm/dma-mapping.h | 8 | ||||
-rw-r--r-- | arch/nds32/include/asm/dma-mapping.h | 8 | ||||
-rw-r--r-- | arch/riscv/include/asm/dma-mapping.h | 8 | ||||
-rw-r--r-- | arch/x86/include/asm/dma-mapping.h | 8 | ||||
-rw-r--r-- | drivers/mmc/tmio-common.c | 2 | ||||
-rw-r--r-- | drivers/mtd/nand/raw/denali.c | 2 | ||||
-rw-r--r-- | drivers/net/macb.c | 2 | ||||
-rw-r--r-- | drivers/usb/dwc3/core.c | 6 | ||||
-rw-r--r-- | drivers/usb/gadget/udc/udc-core.c | 2 |
9 files changed, 31 insertions, 15 deletions
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index fc5b8f634d..895b24701f 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h @@ -28,9 +28,13 @@ static inline unsigned long dma_map_single(volatile void *vaddr, size_t len, return (unsigned long)vaddr; } -static inline void dma_unmap_single(volatile void *vaddr, size_t len, - unsigned long paddr) +static inline void dma_unmap_single(dma_addr_t addr, size_t len, + enum dma_data_direction dir) { + len = ALIGN(len, ARCH_DMA_MINALIGN); + + if (dir != DMA_TO_DEVICE) + invalidate_dcache_range(addr, addr + len); } #endif /* __ASM_ARM_DMA_MAPPING_H */ diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h index e6808dc840..ae6f1ad42f 100644 --- a/arch/nds32/include/asm/dma-mapping.h +++ b/arch/nds32/include/asm/dma-mapping.h @@ -20,9 +20,13 @@ static inline unsigned long dma_map_single(volatile void *vaddr, size_t len, return (unsigned long)vaddr; } -static inline void dma_unmap_single(volatile void *vaddr, size_t len, - unsigned long paddr) +static inline void dma_unmap_single(dma_addr_t addr, size_t len, + enum dma_data_direction dir) { + len = ALIGN(len, ARCH_DMA_MINALIGN); + + if (dir != DMA_TO_DEVICE) + invalidate_dcache_range(addr, addr + len); } #endif /* __ASM_NDS_DMA_MAPPING_H */ diff --git a/arch/riscv/include/asm/dma-mapping.h b/arch/riscv/include/asm/dma-mapping.h index 3d930c90ec..8bbf0f9848 100644 --- a/arch/riscv/include/asm/dma-mapping.h +++ b/arch/riscv/include/asm/dma-mapping.h @@ -30,9 +30,13 @@ static inline unsigned long dma_map_single(volatile void *vaddr, size_t len, return (unsigned long)vaddr; } -static inline void dma_unmap_single(volatile void *vaddr, size_t len, - unsigned long paddr) +static inline void dma_unmap_single(dma_addr_t addr, size_t len, + enum dma_data_direction dir) { + len = ALIGN(len, ARCH_DMA_MINALIGN); + + if (dir != DMA_TO_DEVICE) + invalidate_dcache_range(addr, addr + len); } #endif /* __ASM_RISCV_DMA_MAPPING_H */ diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h index b353ff0bef..d83cf8ec5b 100644 --- a/arch/x86/include/asm/dma-mapping.h +++ b/arch/x86/include/asm/dma-mapping.h @@ -28,9 +28,13 @@ static inline unsigned long dma_map_single(volatile void *vaddr, size_t len, return (unsigned long)vaddr; } -static inline void dma_unmap_single(volatile void *vaddr, size_t len, - unsigned long paddr) +static inline void dma_unmap_single(dma_addr_t addr, size_t len, + enum dma_data_direction dir) { + len = ALIGN(len, ARCH_DMA_MINALIGN); + + if (dir != DMA_TO_DEVICE) + invalidate_dcache_range(addr, addr + len); } #endif /* __ASM_X86_DMA_MAPPING_H */ diff --git a/drivers/mmc/tmio-common.c b/drivers/mmc/tmio-common.c index 812205a21f..e25b95f424 100644 --- a/drivers/mmc/tmio-common.c +++ b/drivers/mmc/tmio-common.c @@ -370,7 +370,7 @@ static int tmio_sd_dma_xfer(struct udevice *dev, struct mmc_data *data) if (poll_flag == TMIO_SD_DMA_INFO1_END_RD) udelay(1); - __dma_unmap_single(dma_addr, len, dir); + dma_unmap_single(dma_addr, len, dir); return ret; } diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c index e0eb1339ec..78204da7ca 100644 --- a/drivers/mtd/nand/raw/denali.c +++ b/drivers/mtd/nand/raw/denali.c @@ -605,7 +605,7 @@ static int denali_dma_xfer(struct denali_nand_info *denali, void *buf, iowrite32(0, denali->reg + DMA_ENABLE); - dma_unmap_single(denali->dev, dma_addr, size, dir); + dma_unmap_single(dma_addr, size, dir); if (irq_status & INTR__ERASED_PAGE) memset(buf, 0xff, size); diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 377188e361..245a546cae 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -348,7 +348,7 @@ static int _macb_send(struct macb_device *macb, const char *name, void *packet, udelay(1); } - dma_unmap_single(packet, length, paddr); + dma_unmap_single(paddr, length, DMA_TO_DEVICE); if (i <= MACB_TX_TIMEOUT) { if (ctrl & MACB_BIT(TX_UNDERRUN)) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 56e2a046bf..2d64e991a9 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -284,8 +284,8 @@ static int dwc3_setup_scratch_buffers(struct dwc3 *dwc) return 0; err1: - dma_unmap_single((void *)(uintptr_t)dwc->scratch_addr, dwc->nr_scratch * - DWC3_SCRATCHBUF_SIZE, DMA_BIDIRECTIONAL); + dma_unmap_single(scratch_addr, dwc->nr_scratch * DWC3_SCRATCHBUF_SIZE, + DMA_BIDIRECTIONAL); err0: return ret; @@ -299,7 +299,7 @@ static void dwc3_free_scratch_buffers(struct dwc3 *dwc) if (!dwc->nr_scratch) return; - dma_unmap_single((void *)(uintptr_t)dwc->scratch_addr, dwc->nr_scratch * + dma_unmap_single(dwc->scratch_addr, dwc->nr_scratch * DWC3_SCRATCHBUF_SIZE, DMA_BIDIRECTIONAL); kfree(dwc->scratchbuf); } diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c index 62b47781dd..06b18507ca 100644 --- a/drivers/usb/gadget/udc/udc-core.c +++ b/drivers/usb/gadget/udc/udc-core.c @@ -65,7 +65,7 @@ void usb_gadget_unmap_request(struct usb_gadget *gadget, if (req->length == 0) return; - dma_unmap_single((void *)(uintptr_t)req->dma, req->length, + dma_unmap_single(req->dma, req->length, is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE); } EXPORT_SYMBOL_GPL(usb_gadget_unmap_request); |