1 // SPDX-License-Identifier: GPL-2.0-only
3 * ioremap implementation.
5 * Copyright (C) 2015 Cadence Design Systems Inc.
9 #include <linux/pgtable.h>
10 #include <asm/cacheflush.h>
13 void __iomem *ioremap_prot(phys_addr_t phys_addr, size_t size,
16 unsigned long pfn = __phys_to_pfn((phys_addr));
17 WARN_ON(pfn_valid(pfn));
19 return generic_ioremap_prot(phys_addr, size, __pgprot(prot));
21 EXPORT_SYMBOL(ioremap_prot);
23 void iounmap(volatile void __iomem *addr)
25 unsigned long va = (unsigned long) addr;
27 if ((va >= XCHAL_KIO_CACHED_VADDR &&
28 va - XCHAL_KIO_CACHED_VADDR < XCHAL_KIO_SIZE) ||
29 (va >= XCHAL_KIO_BYPASS_VADDR &&
30 va - XCHAL_KIO_BYPASS_VADDR < XCHAL_KIO_SIZE))
33 generic_iounmap(addr);
35 EXPORT_SYMBOL(iounmap);