diff options
author | Yoichi Yuasa <yuasa@hh.iij4u.or.jp> | 2005-06-04 18:43:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-04 20:13:01 -0400 |
commit | eae936e21bd726f9d9555f2262d439fbcd61dccf (patch) | |
tree | c18cb14144fedeb20bd65ff1c3262c047da58c9e | |
parent | f26d583e41aedad8159acf9533fa287d7209dfbf (diff) |
[PATCH] serial: update NEC VR4100 series serial support
- Changed the return value of unknown type to NULL.
- Deleted the NULL check of dev_id in siu_interrupt().
- Deleted the NULL check of port->membase in siu_shutdown().
- Added the NULL check of port->membase to siu_startup().
- Removed early_uart_ops. Now using vr41xx_siu standerd one.
- Changed KSEG1ADDR() in siu_console_setup() to ioremap().
- When uart_add_one_port() failed, changed to set NULL to port->dev.
Signed-off-by: Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | drivers/serial/vr41xx_siu.c | 66 |
1 files changed, 9 insertions, 57 deletions
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c index 5d2ceb623e6f..1f985327b0d4 100644 --- a/drivers/serial/vr41xx_siu.c +++ b/drivers/serial/vr41xx_siu.c | |||
@@ -234,7 +234,7 @@ static inline const char *siu_type_name(struct uart_port *port) | |||
234 | return "DSIU"; | 234 | return "DSIU"; |
235 | } | 235 | } |
236 | 236 | ||
237 | return "unknown"; | 237 | return NULL; |
238 | } | 238 | } |
239 | 239 | ||
240 | static unsigned int siu_tx_empty(struct uart_port *port) | 240 | static unsigned int siu_tx_empty(struct uart_port *port) |
@@ -482,9 +482,6 @@ static irqreturn_t siu_interrupt(int irq, void *dev_id, struct pt_regs *regs) | |||
482 | struct uart_port *port; | 482 | struct uart_port *port; |
483 | uint8_t iir, lsr; | 483 | uint8_t iir, lsr; |
484 | 484 | ||
485 | if (dev_id == NULL) | ||
486 | return IRQ_NONE; | ||
487 | |||
488 | port = (struct uart_port *)dev_id; | 485 | port = (struct uart_port *)dev_id; |
489 | 486 | ||
490 | iir = siu_read(port, UART_IIR); | 487 | iir = siu_read(port, UART_IIR); |
@@ -507,6 +504,9 @@ static int siu_startup(struct uart_port *port) | |||
507 | { | 504 | { |
508 | int retval; | 505 | int retval; |
509 | 506 | ||
507 | if (port->membase == NULL) | ||
508 | return -ENODEV; | ||
509 | |||
510 | siu_clear_fifo(port); | 510 | siu_clear_fifo(port); |
511 | 511 | ||
512 | (void)siu_read(port, UART_LSR); | 512 | (void)siu_read(port, UART_LSR); |
@@ -545,9 +545,6 @@ static void siu_shutdown(struct uart_port *port) | |||
545 | unsigned long flags; | 545 | unsigned long flags; |
546 | uint8_t lcr; | 546 | uint8_t lcr; |
547 | 547 | ||
548 | if (port->membase == NULL) | ||
549 | return; | ||
550 | |||
551 | siu_write(port, UART_IER, 0); | 548 | siu_write(port, UART_IER, 0); |
552 | 549 | ||
553 | spin_lock_irqsave(&port->lock, flags); | 550 | spin_lock_irqsave(&port->lock, flags); |
@@ -802,53 +799,6 @@ static int siu_init_ports(void) | |||
802 | 799 | ||
803 | #ifdef CONFIG_SERIAL_VR41XX_CONSOLE | 800 | #ifdef CONFIG_SERIAL_VR41XX_CONSOLE |
804 | 801 | ||
805 | static void early_set_termios(struct uart_port *port, struct termios *new, | ||
806 | struct termios *old) | ||
807 | { | ||
808 | tcflag_t c_cflag; | ||
809 | uint8_t lcr; | ||
810 | unsigned int baud, quot; | ||
811 | |||
812 | c_cflag = new->c_cflag; | ||
813 | switch (c_cflag & CSIZE) { | ||
814 | case CS5: | ||
815 | lcr = UART_LCR_WLEN5; | ||
816 | break; | ||
817 | case CS6: | ||
818 | lcr = UART_LCR_WLEN6; | ||
819 | break; | ||
820 | case CS7: | ||
821 | lcr = UART_LCR_WLEN7; | ||
822 | break; | ||
823 | default: | ||
824 | lcr = UART_LCR_WLEN8; | ||
825 | break; | ||
826 | } | ||
827 | |||
828 | if (c_cflag & CSTOPB) | ||
829 | lcr |= UART_LCR_STOP; | ||
830 | if (c_cflag & PARENB) | ||
831 | lcr |= UART_LCR_PARITY; | ||
832 | if ((c_cflag & PARODD) != PARODD) | ||
833 | lcr |= UART_LCR_EPAR; | ||
834 | if (c_cflag & CMSPAR) | ||
835 | lcr |= UART_LCR_SPAR; | ||
836 | |||
837 | baud = uart_get_baud_rate(port, new, old, 0, port->uartclk/16); | ||
838 | quot = uart_get_divisor(port, baud); | ||
839 | |||
840 | siu_write(port, UART_LCR, lcr | UART_LCR_DLAB); | ||
841 | |||
842 | siu_write(port, UART_DLL, (uint8_t)quot); | ||
843 | siu_write(port, UART_DLM, (uint8_t)(quot >> 8)); | ||
844 | |||
845 | siu_write(port, UART_LCR, lcr); | ||
846 | } | ||
847 | |||
848 | static struct uart_ops early_uart_ops = { | ||
849 | .set_termios = early_set_termios, | ||
850 | }; | ||
851 | |||
852 | #define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) | 802 | #define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) |
853 | 803 | ||
854 | static void wait_for_xmitr(struct uart_port *port) | 804 | static void wait_for_xmitr(struct uart_port *port) |
@@ -915,7 +865,7 @@ static int siu_console_setup(struct console *con, char *options) | |||
915 | if (port->membase == NULL) { | 865 | if (port->membase == NULL) { |
916 | if (port->mapbase == 0) | 866 | if (port->mapbase == 0) |
917 | return -ENODEV; | 867 | return -ENODEV; |
918 | port->membase = (unsigned char __iomem *)KSEG1ADDR(port->mapbase); | 868 | port->membase = ioremap(port->mapbase, siu_port_size(port)); |
919 | } | 869 | } |
920 | 870 | ||
921 | vr41xx_select_siu_interface(SIU_INTERFACE_RS232C); | 871 | vr41xx_select_siu_interface(SIU_INTERFACE_RS232C); |
@@ -949,7 +899,7 @@ static int __devinit siu_console_init(void) | |||
949 | 899 | ||
950 | for (i = 0; i < num; i++) { | 900 | for (i = 0; i < num; i++) { |
951 | port = &siu_uart_ports[i]; | 901 | port = &siu_uart_ports[i]; |
952 | port->ops = &early_uart_ops; | 902 | port->ops = &siu_uart_ops; |
953 | } | 903 | } |
954 | 904 | ||
955 | register_console(&siu_console); | 905 | register_console(&siu_console); |
@@ -994,8 +944,10 @@ static int siu_probe(struct device *dev) | |||
994 | port->dev = dev; | 944 | port->dev = dev; |
995 | 945 | ||
996 | retval = uart_add_one_port(&siu_uart_driver, port); | 946 | retval = uart_add_one_port(&siu_uart_driver, port); |
997 | if (retval) | 947 | if (retval < 0) { |
948 | port->dev = NULL; | ||
998 | break; | 949 | break; |
950 | } | ||
999 | } | 951 | } |
1000 | 952 | ||
1001 | if (i == 0 && retval < 0) { | 953 | if (i == 0 && retval < 0) { |