diff options
author | Magnus Damm <damm@opensource.se> | 2012-05-02 08:47:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-05-02 17:07:28 -0400 |
commit | 28bf4cf22dcd936f93dd6063696b1accdc1d5207 (patch) | |
tree | 41989eb154c5e941f75fb134190e2359815fa8d4 /drivers/tty | |
parent | 6b4160313c239d61c3907b2aaaeeec156911c9d1 (diff) |
serial8250: Use dl_read()/dl_write() on RM9K
Convert the 8250 RM9K support code to make
use of the new dl_read()/dl_write() callbacks.
Signed-off-by: Magnus Damm <damm@opensource.se>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/serial/8250/8250.c | 62 |
1 files changed, 29 insertions, 33 deletions
diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c index 2d62c89195e9..cc398b1bcebf 100644 --- a/drivers/tty/serial/8250/8250.c +++ b/drivers/tty/serial/8250/8250.c | |||
@@ -297,25 +297,6 @@ static void default_dl_write(struct uart_8250_port *up, int value) | |||
297 | serial_out(up, UART_DLM, value >> 8 & 0xff); | 297 | serial_out(up, UART_DLM, value >> 8 & 0xff); |
298 | } | 298 | } |
299 | 299 | ||
300 | #if defined(CONFIG_SERIAL_8250_RM9K) | ||
301 | static int _serial_dl_read(struct uart_8250_port *up) | ||
302 | { | ||
303 | return (up->port.iotype == UPIO_RM9000) ? | ||
304 | (((__raw_readl(up->port.membase + 0x10) << 8) | | ||
305 | (__raw_readl(up->port.membase + 0x08) & 0xff)) & 0xffff) : | ||
306 | default_dl_read(up); | ||
307 | } | ||
308 | |||
309 | static void _serial_dl_write(struct uart_8250_port *up, int value) | ||
310 | { | ||
311 | if (up->port.iotype == UPIO_RM9000) { | ||
312 | __raw_writel(value, up->port.membase + 0x08); | ||
313 | __raw_writel(value >> 8, up->port.membase + 0x10); | ||
314 | } else { | ||
315 | default_dl_write(up, value); | ||
316 | } | ||
317 | } | ||
318 | #else | ||
319 | static int _serial_dl_read(struct uart_8250_port *up) | 300 | static int _serial_dl_read(struct uart_8250_port *up) |
320 | { | 301 | { |
321 | return default_dl_read(up); | 302 | return default_dl_read(up); |
@@ -325,7 +306,6 @@ static void _serial_dl_write(struct uart_8250_port *up, int value) | |||
325 | { | 306 | { |
326 | default_dl_write(up, value); | 307 | default_dl_write(up, value); |
327 | } | 308 | } |
328 | #endif | ||
329 | 309 | ||
330 | #ifdef CONFIG_MIPS_ALCHEMY | 310 | #ifdef CONFIG_MIPS_ALCHEMY |
331 | 311 | ||
@@ -373,7 +353,7 @@ static void au_serial_dl_write(struct uart_8250_port *up, int value) | |||
373 | 353 | ||
374 | #endif | 354 | #endif |
375 | 355 | ||
376 | #if defined(CONFIG_SERIAL_8250_RM9K) | 356 | #ifdef CONFIG_SERIAL_8250_RM9K |
377 | 357 | ||
378 | static const u8 | 358 | static const u8 |
379 | regmap_in[8] = { | 359 | regmap_in[8] = { |
@@ -397,28 +377,36 @@ static const u8 | |||
397 | [UART_SCR] = 0x2c | 377 | [UART_SCR] = 0x2c |
398 | }; | 378 | }; |
399 | 379 | ||
400 | static inline int map_8250_in_reg(struct uart_port *p, int offset) | 380 | static unsigned int rm9k_serial_in(struct uart_port *p, int offset) |
401 | { | 381 | { |
402 | if (p->iotype != UPIO_RM9000) | 382 | offset = regmap_in[offset] << p->regshift; |
403 | return offset; | 383 | return readl(p->membase + offset); |
404 | return regmap_in[offset]; | ||
405 | } | 384 | } |
406 | 385 | ||
407 | static inline int map_8250_out_reg(struct uart_port *p, int offset) | 386 | static void rm9k_serial_out(struct uart_port *p, int offset, int value) |
408 | { | 387 | { |
409 | if (p->iotype != UPIO_RM9000) | 388 | offset = regmap_out[offset] << p->regshift; |
410 | return offset; | 389 | writel(value, p->membase + offset); |
411 | return regmap_out[offset]; | ||
412 | } | 390 | } |
413 | 391 | ||
414 | #else | 392 | static int rm9k_serial_dl_read(struct uart_8250_port *up) |
393 | { | ||
394 | return ((__raw_readl(up->port.membase + 0x10) << 8) | | ||
395 | (__raw_readl(up->port.membase + 0x08) & 0xff)) & 0xffff; | ||
396 | } | ||
397 | |||
398 | static void rm9k_serial_dl_write(struct uart_8250_port *up, int value) | ||
399 | { | ||
400 | __raw_writel(value, up->port.membase + 0x08); | ||
401 | __raw_writel(value >> 8, up->port.membase + 0x10); | ||
402 | } | ||
403 | |||
404 | #endif | ||
415 | 405 | ||
416 | /* sane hardware needs no mapping */ | 406 | /* sane hardware needs no mapping */ |
417 | #define map_8250_in_reg(up, offset) (offset) | 407 | #define map_8250_in_reg(up, offset) (offset) |
418 | #define map_8250_out_reg(up, offset) (offset) | 408 | #define map_8250_out_reg(up, offset) (offset) |
419 | 409 | ||
420 | #endif | ||
421 | |||
422 | static unsigned int hub6_serial_in(struct uart_port *p, int offset) | 410 | static unsigned int hub6_serial_in(struct uart_port *p, int offset) |
423 | { | 411 | { |
424 | offset = map_8250_in_reg(p, offset) << p->regshift; | 412 | offset = map_8250_in_reg(p, offset) << p->regshift; |
@@ -490,12 +478,20 @@ static void set_io_from_upio(struct uart_port *p) | |||
490 | p->serial_out = mem_serial_out; | 478 | p->serial_out = mem_serial_out; |
491 | break; | 479 | break; |
492 | 480 | ||
493 | case UPIO_RM9000: | ||
494 | case UPIO_MEM32: | 481 | case UPIO_MEM32: |
495 | p->serial_in = mem32_serial_in; | 482 | p->serial_in = mem32_serial_in; |
496 | p->serial_out = mem32_serial_out; | 483 | p->serial_out = mem32_serial_out; |
497 | break; | 484 | break; |
498 | 485 | ||
486 | #ifdef CONFIG_SERIAL_8250_RM9K | ||
487 | case UPIO_RM9000: | ||
488 | p->serial_in = rm9k_serial_in; | ||
489 | p->serial_out = rm9k_serial_out; | ||
490 | up->dl_read = rm9k_serial_dl_read; | ||
491 | up->dl_write = rm9k_serial_dl_write; | ||
492 | break; | ||
493 | #endif | ||
494 | |||
499 | #ifdef CONFIG_MIPS_ALCHEMY | 495 | #ifdef CONFIG_MIPS_ALCHEMY |
500 | case UPIO_AU: | 496 | case UPIO_AU: |
501 | p->serial_in = au_serial_in; | 497 | p->serial_in = au_serial_in; |