Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cfa93fb9 authored by Paul Burton's avatar Paul Burton Committed by Ralf Baechle
Browse files

MIPS: dma-default: Don't check hw_coherentio if device is non-coherent



There are no cases where plat_device_is_coherent() will return zero
whilst hw_coherentio is non-zero, and acting any differently in such a
case doesn't make much sense - if a device is non-coherent with the CPU
caches then access to memory "coherent" with DMA must be uncached. Clean
up the nonsensical case.

Signed-off-by: default avatarPaul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14348/


Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent f2302023
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -161,7 +161,6 @@ static void *mips_dma_alloc_coherent(struct device *dev, size_t size,
	*dma_handle = plat_map_dma_mem(dev, ret, size);
	if (!plat_device_is_coherent(dev)) {
		dma_cache_wback_inv((unsigned long) ret, size);
		if (!hw_coherentio)
		ret = UNCAC_ADDR(ret);
	}

@@ -190,7 +189,7 @@ static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr,

	plat_unmap_dma_mem(dev, dma_handle, size, DMA_BIDIRECTIONAL);

	if (!plat_device_is_coherent(dev) && !hw_coherentio)
	if (!plat_device_is_coherent(dev))
		addr = CAC_ADDR(addr);

	page = virt_to_page((void *) addr);
@@ -210,7 +209,7 @@ static int mips_dma_mmap(struct device *dev, struct vm_area_struct *vma,
	unsigned long pfn;
	int ret = -ENXIO;

	if (!plat_device_is_coherent(dev) && !hw_coherentio)
	if (!plat_device_is_coherent(dev))
		addr = CAC_ADDR(addr);

	pfn = page_to_pfn(virt_to_page((void *)addr));