Skip to content

Commit b66c1a3

Browse files
pmundtLinus Torvalds
authored andcommitted
[PATCH] sh: I/O routine cleanups and ioremap() overhaul
This introduces a few changes in the way that the I/O routines are defined on SH, specifically so that things like the iomap API properly wrap through the machvec for board-specific quirks. In addition to this, the old p3_ioremap() work is converted to a more generic __ioremap() that will map through the PMB if it's available, or fall back on page tables for everything else. An alpha-like IO_CONCAT is also added so we can start to clean up the board-specific io.h mess, which will be handled in board update patches.. Signed-off-by: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent bf3a00f commit b66c1a3

6 files changed

Lines changed: 440 additions & 337 deletions

File tree

‎arch/sh/kernel/io.c‎

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,58 +2,73 @@
22
* linux/arch/sh/kernel/io.c
33
*
44
* Copyright (C) 2000 Stuart Menefy
5+
* Copyright (C) 2005 Paul Mundt
56
*
67
* Provide real functions which expand to whatever the header file defined.
78
* Also definitions of machine independent IO functions.
9+
*
10+
* This file is subject to the terms and conditions of the GNU General Public
11+
* License. See the file "COPYING" in the main directory of this archive
12+
* for more details.
813
*/
9-
10-
#include <asm/io.h>
1114
#include <linux/module.h>
15+
#include <asm/machvec.h>
16+
#include <asm/io.h>
1217

1318
/*
1419
* Copy data from IO memory space to "real" memory space.
1520
* This needs to be optimized.
1621
*/
17-
void memcpy_fromio(void * to, unsigned long from, unsigned long count)
22+
void memcpy_fromio(void *to, volatile void __iomem *from, unsigned long count)
1823
{
1924
char *p = to;
2025
while (count) {
2126
count--;
22-
*p = readb(from);
27+
*p = readb((void __iomem *)from);
2328
p++;
2429
from++;
2530
}
2631
}
27-
32+
EXPORT_SYMBOL(memcpy_fromio);
33+
2834
/*
2935
* Copy data from "real" memory space to IO memory space.
3036
* This needs to be optimized.
3137
*/
32-
void memcpy_toio(unsigned long to, const void * from, unsigned long count)
38+
void memcpy_toio(volatile void __iomem *to, const void *from, unsigned long count)
3339
{
3440
const char *p = from;
3541
while (count) {
3642
count--;
37-
writeb(*p, to);
43+
writeb(*p, (void __iomem *)to);
3844
p++;
3945
to++;
4046
}
4147
}
42-
48+
EXPORT_SYMBOL(memcpy_toio);
49+
4350
/*
4451
* "memset" on IO memory space.
4552
* This needs to be optimized.
4653
*/
47-
void memset_io(unsigned long dst, int c, unsigned long count)
54+
void memset_io(volatile void __iomem *dst, int c, unsigned long count)
4855
{
4956
while (count) {
5057
count--;
51-
writeb(c, dst);
58+
writeb(c, (void __iomem *)dst);
5259
dst++;
5360
}
5461
}
55-
56-
EXPORT_SYMBOL(memcpy_fromio);
57-
EXPORT_SYMBOL(memcpy_toio);
5862
EXPORT_SYMBOL(memset_io);
5963

64+
void __iomem *ioport_map(unsigned long port, unsigned int nr)
65+
{
66+
return sh_mv.mv_ioport_map(port, nr);
67+
}
68+
EXPORT_SYMBOL(ioport_map);
69+
70+
void ioport_unmap(void __iomem *addr)
71+
{
72+
sh_mv.mv_ioport_unmap(addr);
73+
}
74+
EXPORT_SYMBOL(ioport_unmap);

0 commit comments

Comments
 (0)