diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2011-02-09 04:57:04 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-02-17 14:31:58 -0500 |
commit | 2780ad42f5fe6739882603c61c8decba6e50eaa2 (patch) | |
tree | 65d26144ecd8319d5d9243770d034ee4f1ba33ab /drivers | |
parent | e96fabd8791aad30a3c8a03919893ae3e2e3df25 (diff) |
tty: serial: altera_uart: Use port->regshift to store bus shift
Use the regshift member of struct uart_port to store the address stride
from platform data. This way we can save one dereference per call of
altera_uart_readl and altera_uart_writel.
This also allows us to use the driver without platform data, which is
needed for device tree support in the Nios2 port.
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/tty/serial/altera_uart.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/tty/serial/altera_uart.c b/drivers/tty/serial/altera_uart.c index dee7a0eb6ea1..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 | ||