1 // SPDX-License-Identifier: GPL-2.0-only
3 * DMA implementation for Hexagon
5 * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
8 #include <linux/dma-map-ops.h>
9 #include <linux/memblock.h>
12 void arch_sync_dma_for_device(phys_addr_t paddr, size_t size,
13 enum dma_data_direction dir)
15 void *addr = phys_to_virt(paddr);
19 hexagon_clean_dcache_range((unsigned long) addr,
20 (unsigned long) addr + size);
23 hexagon_inv_dcache_range((unsigned long) addr,
24 (unsigned long) addr + size);
26 case DMA_BIDIRECTIONAL:
27 flush_dcache_range((unsigned long) addr,
28 (unsigned long) addr + size);
36 * Our max_low_pfn should have been backed off by 16MB in mm/init.c to create
37 * DMA coherent space. Use that for the pool.
39 static int __init hexagon_dma_init(void)
41 return dma_init_global_coherent(PFN_PHYS(max_low_pfn),
42 hexagon_coherent_pool_size);
44 core_initcall(hexagon_dma_init);