aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2011-06-08 04:06:25 -0400
committerPaul Mundt <lethal@linux-sh.org>2011-06-08 04:06:25 -0400
commita01cdc10689f5d252530d14474528ea785ecfde4 (patch)
treed843fd8d12728a7eebfef2e79c3ee056770ed47f /drivers/tty
parentab7cfb5548d22604fafeaaa95950be2f97869f1e (diff)
serial: sh-sci: Tidy up ioread/write wrappers, kill off unused SCI helper.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/sh-sci.h35
1 files changed, 9 insertions, 26 deletions
diff --git a/drivers/tty/serial/sh-sci.h b/drivers/tty/serial/sh-sci.h
index 4dc249ecc59f..923ebd908e70 100644
--- a/drivers/tty/serial/sh-sci.h
+++ b/drivers/tty/serial/sh-sci.h
@@ -181,32 +181,25 @@
181#define SCI_MAJOR 204 181#define SCI_MAJOR 204
182#define SCI_MINOR_START 8 182#define SCI_MINOR_START 8
183 183
184#define SCI_IN(size, offset) \ 184#define SCI_IN(size, offset) \
185 if ((size) == 8) { \ 185 ioread##size(port->membase + (offset))
186 return ioread8(port->membase + (offset)); \ 186
187 } else { \ 187#define SCI_OUT(size, offset, value) \
188 return ioread16(port->membase + (offset)); \ 188 iowrite##size(value, port->membase + (offset))
189 }
190#define SCI_OUT(size, offset, value) \
191 if ((size) == 8) { \
192 iowrite8(value, port->membase + (offset)); \
193 } else if ((size) == 16) { \
194 iowrite16(value, port->membase + (offset)); \
195 }
196 189
197#define CPU_SCIx_FNS(name, sci_offset, sci_size, scif_offset, scif_size)\ 190#define CPU_SCIx_FNS(name, sci_offset, sci_size, scif_offset, scif_size)\
198 static inline unsigned int sci_##name##_in(struct uart_port *port) \ 191 static inline unsigned int sci_##name##_in(struct uart_port *port) \
199 { \ 192 { \
200 if (port->type == PORT_SCIF || port->type == PORT_SCIFB) { \ 193 if (port->type == PORT_SCIF || port->type == PORT_SCIFB) { \
201 SCI_IN(scif_size, scif_offset) \ 194 return SCI_IN(scif_size, scif_offset); \
202 } else { /* PORT_SCI or PORT_SCIFA */ \ 195 } else { /* PORT_SCI or PORT_SCIFA */ \
203 SCI_IN(sci_size, sci_offset); \ 196 return SCI_IN(sci_size, sci_offset); \
204 } \ 197 } \
205 } \ 198 } \
206 static inline void sci_##name##_out(struct uart_port *port, unsigned int value) \ 199 static inline void sci_##name##_out(struct uart_port *port, unsigned int value) \
207 { \ 200 { \
208 if (port->type == PORT_SCIF || port->type == PORT_SCIFB) { \ 201 if (port->type == PORT_SCIF || port->type == PORT_SCIFB) { \
209 SCI_OUT(scif_size, scif_offset, value) \ 202 SCI_OUT(scif_size, scif_offset, value); \
210 } else { /* PORT_SCI or PORT_SCIFA */ \ 203 } else { /* PORT_SCI or PORT_SCIFA */ \
211 SCI_OUT(sci_size, sci_offset, value); \ 204 SCI_OUT(sci_size, sci_offset, value); \
212 } \ 205 } \
@@ -215,23 +208,13 @@
215#define CPU_SCIF_FNS(name, scif_offset, scif_size) \ 208#define CPU_SCIF_FNS(name, scif_offset, scif_size) \
216 static inline unsigned int sci_##name##_in(struct uart_port *port) \ 209 static inline unsigned int sci_##name##_in(struct uart_port *port) \
217 { \ 210 { \
218 SCI_IN(scif_size, scif_offset); \ 211 return SCI_IN(scif_size, scif_offset); \
219 } \ 212 } \
220 static inline void sci_##name##_out(struct uart_port *port, unsigned int value) \ 213 static inline void sci_##name##_out(struct uart_port *port, unsigned int value) \
221 { \ 214 { \
222 SCI_OUT(scif_size, scif_offset, value); \ 215 SCI_OUT(scif_size, scif_offset, value); \
223 } 216 }
224 217
225#define CPU_SCI_FNS(name, sci_offset, sci_size) \
226 static inline unsigned int sci_##name##_in(struct uart_port* port) \
227 { \
228 SCI_IN(sci_size, sci_offset); \
229 } \
230 static inline void sci_##name##_out(struct uart_port* port, unsigned int value) \
231 { \
232 SCI_OUT(sci_size, sci_offset, value); \
233 }
234
235#if defined(CONFIG_CPU_SH3) || \ 218#if defined(CONFIG_CPU_SH3) || \
236 defined(CONFIG_ARCH_SH73A0) || \ 219 defined(CONFIG_ARCH_SH73A0) || \
237 defined(CONFIG_ARCH_SH7367) || \ 220 defined(CONFIG_ARCH_SH7367) || \