diff options
Diffstat (limited to 'drivers/tty/serial/altera_uart.c')
-rw-r--r-- | drivers/tty/serial/altera_uart.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c index 721216292a50..3a573528555e 100644 --- a/drivers/tty/serial/altera_uart.c +++ b/drivers/tty/serial/altera_uart.c | |||
@@ -86,16 +86,12 @@ struct altera_uart { | |||
86 | 86 | ||
87 | static u32 altera_uart_readl(struct uart_port *port, int reg) | 87 | static u32 altera_uart_readl(struct uart_port *port, int reg) |
88 | { | 88 | { |
89 | struct altera_uart_platform_uart *platp = port->private_data; | 89 | return readl(port->membase + (reg << port->regshift)); |
90 | |||
91 | return readl(port->membase + (reg << platp->bus_shift)); | ||
92 | } | 90 | } |
93 | 91 | ||
94 | static void altera_uart_writel(struct uart_port *port, u32 dat, int reg) | 92 | static void altera_uart_writel(struct uart_port *port, u32 dat, int reg) |
95 | { | 93 | { |
96 | struct altera_uart_platform_uart *platp = port->private_data; | 94 | writel(dat, port->membase + (reg << port->regshift)); |
97 | |||
98 | writel(dat, port->membase + (reg << platp->bus_shift)); | ||
99 | } | 95 | } |
100 | 96 | ||
101 | static unsigned int altera_uart_tx_empty(struct uart_port *port) | 97 | static unsigned int altera_uart_tx_empty(struct uart_port *port) |
@@ -546,13 +542,17 @@ static int __devinit altera_uart_probe(struct platform_device *pdev) | |||
546 | if (!port->membase) | 542 | if (!port->membase) |
547 | return -ENOMEM; | 543 | return -ENOMEM; |
548 | 544 | ||
545 | if (platp) | ||
546 | port->regshift = platp->bus_shift; | ||
547 | else | ||
548 | port->regshift = 0; | ||
549 | |||
549 | port->line = i; | 550 | port->line = i; |
550 | port->type = PORT_ALTERA_UART; | 551 | port->type = PORT_ALTERA_UART; |
551 | port->iotype = SERIAL_IO_MEM; | 552 | port->iotype = SERIAL_IO_MEM; |
552 | port->uartclk = platp->uartclk; | 553 | port->uartclk = platp->uartclk; |
553 | port->ops = &altera_uart_ops; | 554 | port->ops = &altera_uart_ops; |
554 | port->flags = UPF_BOOT_AUTOCONF; | 555 | port->flags = UPF_BOOT_AUTOCONF; |
555 | port->private_data = platp; | ||
556 | 556 | ||
557 | uart_add_one_port(&altera_uart_driver, port); | 557 | uart_add_one_port(&altera_uart_driver, port); |
558 | 558 | ||
@@ -561,9 +561,15 @@ static int __devinit altera_uart_probe(struct platform_device *pdev) | |||
561 | 561 | ||
562 | static int __devexit altera_uart_remove(struct platform_device *pdev) | 562 | static int __devexit altera_uart_remove(struct platform_device *pdev) |
563 | { | 563 | { |
564 | struct uart_port *port = &altera_uart_ports[pdev->id].port; | 564 | struct uart_port *port; |
565 | int i = pdev->id; | ||
565 | 566 | ||
567 | if (i == -1) | ||
568 | i = 0; | ||
569 | |||
570 | port = &altera_uart_ports[i].port; | ||
566 | uart_remove_one_port(&altera_uart_driver, port); | 571 | uart_remove_one_port(&altera_uart_driver, port); |
572 | |||
567 | return 0; | 573 | return 0; |
568 | } | 574 | } |
569 | 575 | ||