diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2016-01-20 17:58:35 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-20 20:09:18 -0500 |
commit | a9aec5881b9d4aca184b29d33484a6a58d23f7f2 (patch) | |
tree | 8da654f4e0ce565ebe9c58ee28a0427948979280 /lib | |
parent | ef5c16b85b2a6d55ae12a8d7125f3908c8d271d4 (diff) |
lib/iomap_copy.c: add __ioread32_copy()
Some drivers need to read data out of iomem areas 32-bits at a time.
Add an API to do this.
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Cc: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Cc: <zajec5@gmail.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Cc: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/iomap_copy.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/iomap_copy.c b/lib/iomap_copy.c index 4527e751b5e0..b8f1d6cbb200 100644 --- a/lib/iomap_copy.c +++ b/lib/iomap_copy.c | |||
@@ -42,6 +42,27 @@ void __attribute__((weak)) __iowrite32_copy(void __iomem *to, | |||
42 | EXPORT_SYMBOL_GPL(__iowrite32_copy); | 42 | EXPORT_SYMBOL_GPL(__iowrite32_copy); |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * __ioread32_copy - copy data from MMIO space, in 32-bit units | ||
46 | * @to: destination (must be 32-bit aligned) | ||
47 | * @from: source, in MMIO space (must be 32-bit aligned) | ||
48 | * @count: number of 32-bit quantities to copy | ||
49 | * | ||
50 | * Copy data from MMIO space to kernel space, in units of 32 bits at a | ||
51 | * time. Order of access is not guaranteed, nor is a memory barrier | ||
52 | * performed afterwards. | ||
53 | */ | ||
54 | void __ioread32_copy(void *to, const void __iomem *from, size_t count) | ||
55 | { | ||
56 | u32 *dst = to; | ||
57 | const u32 __iomem *src = from; | ||
58 | const u32 __iomem *end = src + count; | ||
59 | |||
60 | while (src < end) | ||
61 | *dst++ = __raw_readl(src++); | ||
62 | } | ||
63 | EXPORT_SYMBOL_GPL(__ioread32_copy); | ||
64 | |||
65 | /** | ||
45 | * __iowrite64_copy - copy data to MMIO space, in 64-bit or 32-bit units | 66 | * __iowrite64_copy - copy data to MMIO space, in 64-bit or 32-bit units |
46 | * @to: destination, in MMIO space (must be 64-bit aligned) | 67 | * @to: destination, in MMIO space (must be 64-bit aligned) |
47 | * @from: source (must be 64-bit aligned) | 68 | * @from: source (must be 64-bit aligned) |