diff options
author | Dave Jones <davej@redhat.com> | 2006-12-12 17:41:41 -0500 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2006-12-12 17:41:41 -0500 |
commit | c4366889dda8110247be59ca41fddb82951a8c26 (patch) | |
tree | 705c1a996bed8fd48ce94ff33ec9fd00f9b94875 /arch/sh/boards/se/7206/io.c | |
parent | db2fb9db5735cc532fd4fc55e94b9a3c3750378e (diff) | |
parent | e1036502e5263851259d147771226161e5ccc85a (diff) |
Merge ../linus
Conflicts:
drivers/cpufreq/cpufreq.c
Diffstat (limited to 'arch/sh/boards/se/7206/io.c')
-rw-r--r-- | arch/sh/boards/se/7206/io.c | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/arch/sh/boards/se/7206/io.c b/arch/sh/boards/se/7206/io.c new file mode 100644 index 000000000000..b557273e0cbe --- /dev/null +++ b/arch/sh/boards/se/7206/io.c | |||
@@ -0,0 +1,123 @@ | |||
1 | /* $Id: io.c,v 1.5 2004/02/22 23:08:43 kkojima Exp $ | ||
2 | * | ||
3 | * linux/arch/sh/boards/se/7206/io.c | ||
4 | * | ||
5 | * Copyright (C) 2006 Yoshinori Sato | ||
6 | * | ||
7 | * I/O routine for Hitachi 7206 SolutionEngine. | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/types.h> | ||
13 | #include <asm/io.h> | ||
14 | #include <asm/se7206.h> | ||
15 | |||
16 | |||
17 | static inline void delay(void) | ||
18 | { | ||
19 | ctrl_inw(0x20000000); /* P2 ROM Area */ | ||
20 | } | ||
21 | |||
22 | /* MS7750 requires special versions of in*, out* routines, since | ||
23 | PC-like io ports are located at upper half byte of 16-bit word which | ||
24 | can be accessed only with 16-bit wide. */ | ||
25 | |||
26 | static inline volatile __u16 * | ||
27 | port2adr(unsigned int port) | ||
28 | { | ||
29 | if (port >= 0x2000) | ||
30 | return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000)); | ||
31 | else if (port >= 0x300 || port < 0x310) | ||
32 | return (volatile __u16 *) (PA_SMSC + (port - 0x300)); | ||
33 | } | ||
34 | |||
35 | unsigned char se7206_inb(unsigned long port) | ||
36 | { | ||
37 | return (*port2adr(port))&0xff; | ||
38 | } | ||
39 | |||
40 | unsigned char se7206_inb_p(unsigned long port) | ||
41 | { | ||
42 | unsigned long v; | ||
43 | |||
44 | v = (*port2adr(port))&0xff; | ||
45 | delay(); | ||
46 | return v; | ||
47 | } | ||
48 | |||
49 | unsigned short se7206_inw(unsigned long port) | ||
50 | { | ||
51 | return *port2adr(port);; | ||
52 | } | ||
53 | |||
54 | unsigned int se7206_inl(unsigned long port) | ||
55 | { | ||
56 | maybebadio(port); | ||
57 | return 0; | ||
58 | } | ||
59 | |||
60 | void se7206_outb(unsigned char value, unsigned long port) | ||
61 | { | ||
62 | *(port2adr(port)) = value; | ||
63 | } | ||
64 | |||
65 | void se7206_outb_p(unsigned char value, unsigned long port) | ||
66 | { | ||
67 | *(port2adr(port)) = value; | ||
68 | delay(); | ||
69 | } | ||
70 | |||
71 | void se7206_outw(unsigned short value, unsigned long port) | ||
72 | { | ||
73 | *port2adr(port) = value; | ||
74 | } | ||
75 | |||
76 | void se7206_outl(unsigned int value, unsigned long port) | ||
77 | { | ||
78 | maybebadio(port); | ||
79 | } | ||
80 | |||
81 | void se7206_insb(unsigned long port, void *addr, unsigned long count) | ||
82 | { | ||
83 | volatile __u16 *p = port2adr(port); | ||
84 | __u8 *ap = addr; | ||
85 | |||
86 | while (count--) | ||
87 | *ap++ = *p; | ||
88 | } | ||
89 | |||
90 | void se7206_insw(unsigned long port, void *addr, unsigned long count) | ||
91 | { | ||
92 | volatile __u16 *p = port2adr(port); | ||
93 | __u16 *ap = addr; | ||
94 | while (count--) | ||
95 | *ap++ = *p; | ||
96 | } | ||
97 | |||
98 | void se7206_insl(unsigned long port, void *addr, unsigned long count) | ||
99 | { | ||
100 | maybebadio(port); | ||
101 | } | ||
102 | |||
103 | void se7206_outsb(unsigned long port, const void *addr, unsigned long count) | ||
104 | { | ||
105 | volatile __u16 *p = port2adr(port); | ||
106 | const __u8 *ap = addr; | ||
107 | |||
108 | while (count--) | ||
109 | *p = *ap++; | ||
110 | } | ||
111 | |||
112 | void se7206_outsw(unsigned long port, const void *addr, unsigned long count) | ||
113 | { | ||
114 | volatile __u16 *p = port2adr(port); | ||
115 | const __u16 *ap = addr; | ||
116 | while (count--) | ||
117 | *p = *ap++; | ||
118 | } | ||
119 | |||
120 | void se7206_outsl(unsigned long port, const void *addr, unsigned long count) | ||
121 | { | ||
122 | maybebadio(port); | ||
123 | } | ||