Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com> Tested-by: Peter Schneider <pschneider1968@googlemail.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Salvatore Bonaccorso <carnil@debian.org> Tested-by: Brett A C Sheffield <bacs@librecast.net> Tested-by: Mark Brown <broonie@kernel.org> Tested-by: Luna Jernberg <droidbittin@gmail.com> Tested-by: Ronald Warsow <rwarsow@gmx.de> Tested-by: Justin M. Forbes <jforbes@fedoraproject.org> Tested-by: Ron Economos <re@w6rz.net> Tested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
45 lines
1.0 KiB
C
45 lines
1.0 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* DMA implementation for Hexagon
|
|
*
|
|
* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
|
|
*/
|
|
|
|
#include <linux/dma-map-ops.h>
|
|
#include <linux/memblock.h>
|
|
#include <asm/page.h>
|
|
|
|
void arch_sync_dma_for_device(phys_addr_t paddr, size_t size,
|
|
enum dma_data_direction dir)
|
|
{
|
|
void *addr = phys_to_virt(paddr);
|
|
|
|
switch (dir) {
|
|
case DMA_TO_DEVICE:
|
|
hexagon_clean_dcache_range((unsigned long) addr,
|
|
(unsigned long) addr + size);
|
|
break;
|
|
case DMA_FROM_DEVICE:
|
|
hexagon_inv_dcache_range((unsigned long) addr,
|
|
(unsigned long) addr + size);
|
|
break;
|
|
case DMA_BIDIRECTIONAL:
|
|
flush_dcache_range((unsigned long) addr,
|
|
(unsigned long) addr + size);
|
|
break;
|
|
default:
|
|
BUG();
|
|
}
|
|
}
|
|
|
|
/*
|
|
* Our max_low_pfn should have been backed off by 16MB in mm/init.c to create
|
|
* DMA coherent space. Use that for the pool.
|
|
*/
|
|
static int __init hexagon_dma_init(void)
|
|
{
|
|
return dma_init_global_coherent(PFN_PHYS(max_low_pfn),
|
|
hexagon_coherent_pool_size);
|
|
}
|
|
core_initcall(hexagon_dma_init);
|