| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * arch/sh/kernel/iomap.c |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2000 Niibe Yutaka |
|---|
| 5 | 6 | * Copyright (C) 2005 - 2007 Paul Mundt |
|---|
| 6 | | - * |
|---|
| 7 | | - * This file is subject to the terms and conditions of the GNU General Public |
|---|
| 8 | | - * License. See the file "COPYING" in the main directory of this archive |
|---|
| 9 | | - * for more details. |
|---|
| 10 | 7 | */ |
|---|
| 11 | 8 | #include <linux/module.h> |
|---|
| 12 | 9 | #include <linux/io.h> |
|---|
| 13 | 10 | |
|---|
| 14 | | -unsigned int ioread8(void __iomem *addr) |
|---|
| 11 | +unsigned int ioread8(const void __iomem *addr) |
|---|
| 15 | 12 | { |
|---|
| 16 | 13 | return readb(addr); |
|---|
| 17 | 14 | } |
|---|
| 18 | 15 | EXPORT_SYMBOL(ioread8); |
|---|
| 19 | 16 | |
|---|
| 20 | | -unsigned int ioread16(void __iomem *addr) |
|---|
| 17 | +unsigned int ioread16(const void __iomem *addr) |
|---|
| 21 | 18 | { |
|---|
| 22 | 19 | return readw(addr); |
|---|
| 23 | 20 | } |
|---|
| 24 | 21 | EXPORT_SYMBOL(ioread16); |
|---|
| 25 | 22 | |
|---|
| 26 | | -unsigned int ioread16be(void __iomem *addr) |
|---|
| 23 | +unsigned int ioread16be(const void __iomem *addr) |
|---|
| 27 | 24 | { |
|---|
| 28 | 25 | return be16_to_cpu(__raw_readw(addr)); |
|---|
| 29 | 26 | } |
|---|
| 30 | 27 | EXPORT_SYMBOL(ioread16be); |
|---|
| 31 | 28 | |
|---|
| 32 | | -unsigned int ioread32(void __iomem *addr) |
|---|
| 29 | +unsigned int ioread32(const void __iomem *addr) |
|---|
| 33 | 30 | { |
|---|
| 34 | 31 | return readl(addr); |
|---|
| 35 | 32 | } |
|---|
| 36 | 33 | EXPORT_SYMBOL(ioread32); |
|---|
| 37 | 34 | |
|---|
| 38 | | -unsigned int ioread32be(void __iomem *addr) |
|---|
| 35 | +unsigned int ioread32be(const void __iomem *addr) |
|---|
| 39 | 36 | { |
|---|
| 40 | 37 | return be32_to_cpu(__raw_readl(addr)); |
|---|
| 41 | 38 | } |
|---|
| .. | .. |
|---|
| 77 | 74 | * convert to CPU byte order. We write in "IO byte |
|---|
| 78 | 75 | * order" (we also don't have IO barriers). |
|---|
| 79 | 76 | */ |
|---|
| 80 | | -static inline void mmio_insb(void __iomem *addr, u8 *dst, int count) |
|---|
| 77 | +static inline void mmio_insb(const void __iomem *addr, u8 *dst, int count) |
|---|
| 81 | 78 | { |
|---|
| 82 | 79 | while (--count >= 0) { |
|---|
| 83 | 80 | u8 data = __raw_readb(addr); |
|---|
| .. | .. |
|---|
| 86 | 83 | } |
|---|
| 87 | 84 | } |
|---|
| 88 | 85 | |
|---|
| 89 | | -static inline void mmio_insw(void __iomem *addr, u16 *dst, int count) |
|---|
| 86 | +static inline void mmio_insw(const void __iomem *addr, u16 *dst, int count) |
|---|
| 90 | 87 | { |
|---|
| 91 | 88 | while (--count >= 0) { |
|---|
| 92 | 89 | u16 data = __raw_readw(addr); |
|---|
| .. | .. |
|---|
| 95 | 92 | } |
|---|
| 96 | 93 | } |
|---|
| 97 | 94 | |
|---|
| 98 | | -static inline void mmio_insl(void __iomem *addr, u32 *dst, int count) |
|---|
| 95 | +static inline void mmio_insl(const void __iomem *addr, u32 *dst, int count) |
|---|
| 99 | 96 | { |
|---|
| 100 | 97 | while (--count >= 0) { |
|---|
| 101 | 98 | u32 data = __raw_readl(addr); |
|---|
| .. | .. |
|---|
| 128 | 125 | } |
|---|
| 129 | 126 | } |
|---|
| 130 | 127 | |
|---|
| 131 | | -void ioread8_rep(void __iomem *addr, void *dst, unsigned long count) |
|---|
| 128 | +void ioread8_rep(const void __iomem *addr, void *dst, unsigned long count) |
|---|
| 132 | 129 | { |
|---|
| 133 | 130 | mmio_insb(addr, dst, count); |
|---|
| 134 | 131 | } |
|---|
| 135 | 132 | EXPORT_SYMBOL(ioread8_rep); |
|---|
| 136 | 133 | |
|---|
| 137 | | -void ioread16_rep(void __iomem *addr, void *dst, unsigned long count) |
|---|
| 134 | +void ioread16_rep(const void __iomem *addr, void *dst, unsigned long count) |
|---|
| 138 | 135 | { |
|---|
| 139 | 136 | mmio_insw(addr, dst, count); |
|---|
| 140 | 137 | } |
|---|
| 141 | 138 | EXPORT_SYMBOL(ioread16_rep); |
|---|
| 142 | 139 | |
|---|
| 143 | | -void ioread32_rep(void __iomem *addr, void *dst, unsigned long count) |
|---|
| 140 | +void ioread32_rep(const void __iomem *addr, void *dst, unsigned long count) |
|---|
| 144 | 141 | { |
|---|
| 145 | 142 | mmio_insl(addr, dst, count); |
|---|
| 146 | 143 | } |
|---|