aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2007-09-12 23:59:32 -0400
committerPaul Mundt <lethal@linux-sh.org>2007-09-20 22:57:54 -0400
commitdfcb76089ada89a5520ad8544440799e75f01227 (patch)
treed9d12536cd6bef6ebda9eb2717f4c7a0a43a4b73 /arch/sh/boards
parentded5431ff311d963888ac951131a04fe7633aa79 (diff)
sh: se7206: Make the I/O port routines less stupid.
The port routines were logically inverted, and the MRSHPC range had no upper bound, causing 8 and 16-bit port I/O to get mangled. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards')
-rw-r--r--arch/sh/boards/se/7206/io.c29
-rw-r--r--arch/sh/boards/se/7206/setup.c8
2 files changed, 4 insertions, 33 deletions
diff --git a/arch/sh/boards/se/7206/io.c b/arch/sh/boards/se/7206/io.c
index b557273e0cbe..eb30dc2df96f 100644
--- a/arch/sh/boards/se/7206/io.c
+++ b/arch/sh/boards/se/7206/io.c
@@ -26,22 +26,22 @@ static inline void delay(void)
26static inline volatile __u16 * 26static inline volatile __u16 *
27port2adr(unsigned int port) 27port2adr(unsigned int port)
28{ 28{
29 if (port >= 0x2000) 29 if (port >= 0x2000 && port < 0x2020)
30 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000)); 30 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
31 else if (port >= 0x300 || port < 0x310) 31 else if (port >= 0x300 && port < 0x310)
32 return (volatile __u16 *) (PA_SMSC + (port - 0x300)); 32 return (volatile __u16 *) (PA_SMSC + (port - 0x300));
33} 33}
34 34
35unsigned char se7206_inb(unsigned long port) 35unsigned char se7206_inb(unsigned long port)
36{ 36{
37 return (*port2adr(port))&0xff; 37 return (*port2adr(port)) & 0xff;
38} 38}
39 39
40unsigned char se7206_inb_p(unsigned long port) 40unsigned char se7206_inb_p(unsigned long port)
41{ 41{
42 unsigned long v; 42 unsigned long v;
43 43
44 v = (*port2adr(port))&0xff; 44 v = (*port2adr(port)) & 0xff;
45 delay(); 45 delay();
46 return v; 46 return v;
47} 47}
@@ -51,12 +51,6 @@ unsigned short se7206_inw(unsigned long port)
51 return *port2adr(port);; 51 return *port2adr(port);;
52} 52}
53 53
54unsigned int se7206_inl(unsigned long port)
55{
56 maybebadio(port);
57 return 0;
58}
59
60void se7206_outb(unsigned char value, unsigned long port) 54void se7206_outb(unsigned char value, unsigned long port)
61{ 55{
62 *(port2adr(port)) = value; 56 *(port2adr(port)) = value;
@@ -73,11 +67,6 @@ void se7206_outw(unsigned short value, unsigned long port)
73 *port2adr(port) = value; 67 *port2adr(port) = value;
74} 68}
75 69
76void se7206_outl(unsigned int value, unsigned long port)
77{
78 maybebadio(port);
79}
80
81void se7206_insb(unsigned long port, void *addr, unsigned long count) 70void se7206_insb(unsigned long port, void *addr, unsigned long count)
82{ 71{
83 volatile __u16 *p = port2adr(port); 72 volatile __u16 *p = port2adr(port);
@@ -95,11 +84,6 @@ void se7206_insw(unsigned long port, void *addr, unsigned long count)
95 *ap++ = *p; 84 *ap++ = *p;
96} 85}
97 86
98void se7206_insl(unsigned long port, void *addr, unsigned long count)
99{
100 maybebadio(port);
101}
102
103void se7206_outsb(unsigned long port, const void *addr, unsigned long count) 87void se7206_outsb(unsigned long port, const void *addr, unsigned long count)
104{ 88{
105 volatile __u16 *p = port2adr(port); 89 volatile __u16 *p = port2adr(port);
@@ -116,8 +100,3 @@ void se7206_outsw(unsigned long port, const void *addr, unsigned long count)
116 while (count--) 100 while (count--)
117 *p = *ap++; 101 *p = *ap++;
118} 102}
119
120void se7206_outsl(unsigned long port, const void *addr, unsigned long count)
121{
122 maybebadio(port);
123}
diff --git a/arch/sh/boards/se/7206/setup.c b/arch/sh/boards/se/7206/setup.c
index 293ba464f334..499a3e9dbfc2 100644
--- a/arch/sh/boards/se/7206/setup.c
+++ b/arch/sh/boards/se/7206/setup.c
@@ -6,9 +6,7 @@
6 * Copyright (C) 2007 Paul Mundt 6 * Copyright (C) 2007 Paul Mundt
7 * 7 *
8 * Hitachi 7206 SolutionEngine Support. 8 * Hitachi 7206 SolutionEngine Support.
9 *
10 */ 9 */
11
12#include <linux/init.h> 10#include <linux/init.h>
13#include <linux/platform_device.h> 11#include <linux/platform_device.h>
14#include <asm/se7206.h> 12#include <asm/se7206.h>
@@ -81,24 +79,18 @@ static struct sh_machine_vector mv_se __initmv = {
81 .mv_nr_irqs = 256, 79 .mv_nr_irqs = 256,
82 .mv_inb = se7206_inb, 80 .mv_inb = se7206_inb,
83 .mv_inw = se7206_inw, 81 .mv_inw = se7206_inw,
84 .mv_inl = se7206_inl,
85 .mv_outb = se7206_outb, 82 .mv_outb = se7206_outb,
86 .mv_outw = se7206_outw, 83 .mv_outw = se7206_outw,
87 .mv_outl = se7206_outl,
88 84
89 .mv_inb_p = se7206_inb_p, 85 .mv_inb_p = se7206_inb_p,
90 .mv_inw_p = se7206_inw, 86 .mv_inw_p = se7206_inw,
91 .mv_inl_p = se7206_inl,
92 .mv_outb_p = se7206_outb_p, 87 .mv_outb_p = se7206_outb_p,
93 .mv_outw_p = se7206_outw, 88 .mv_outw_p = se7206_outw,
94 .mv_outl_p = se7206_outl,
95 89
96 .mv_insb = se7206_insb, 90 .mv_insb = se7206_insb,
97 .mv_insw = se7206_insw, 91 .mv_insw = se7206_insw,
98 .mv_insl = se7206_insl,
99 .mv_outsb = se7206_outsb, 92 .mv_outsb = se7206_outsb,
100 .mv_outsw = se7206_outsw, 93 .mv_outsw = se7206_outsw,
101 .mv_outsl = se7206_outsl,
102 94
103 .mv_init_irq = init_se7206_IRQ, 95 .mv_init_irq = init_se7206_IRQ,
104}; 96};