WIP FPC-III support
[linux/fpc-iii.git] / arch / mips / lib / iomap_copy.c
blob157500a09a4829278c67905b0b5ecb09edc72f13
1 // SPDX-License-Identifier: GPL-2.0-only
3 #include <linux/export.h>
4 #include <linux/io.h>
6 /**
7 * __ioread64_copy - copy data from MMIO space, in 64-bit units
8 * @to: destination (must be 64-bit aligned)
9 * @from: source, in MMIO space (must be 64-bit aligned)
10 * @count: number of 64-bit quantities to copy
12 * Copy data from MMIO space to kernel space, in units of 32 or 64 bits at a
13 * time. Order of access is not guaranteed, nor is a memory barrier
14 * performed afterwards.
16 void __ioread64_copy(void *to, const void __iomem *from, size_t count)
18 #ifdef CONFIG_64BIT
19 u64 *dst = to;
20 const u64 __iomem *src = from;
21 const u64 __iomem *end = src + count;
23 while (src < end)
24 *dst++ = __raw_readq(src++);
25 #else
26 __ioread32_copy(to, from, count * 2);
27 #endif
29 EXPORT_SYMBOL_GPL(__ioread64_copy);