[PATCH 3/4] nios2/serial_altera.c: switch to ressources
franck.jullien at gmail.com
franck.jullien at gmail.com
Mon Jul 25 15:50:19 EDT 2011
From: Franck Jullien <franck.jullien at gmail.com>
Signed-off-by: Franck Jullien <franck.jullien at gmail.com>
---
drivers/serial/serial_altera.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/serial/serial_altera.c b/drivers/serial/serial_altera.c
index 54c7178..c0a8356 100644
--- a/drivers/serial/serial_altera.c
+++ b/drivers/serial/serial_altera.c
@@ -29,7 +29,7 @@
static int altera_serial_setbaudrate(struct console_device *cdev, int baudrate)
{
- struct nios_uart *uart = (struct nios_uart *)cdev->dev->map_base;
+ struct nios_uart *uart = (struct nios_uart *)dev_request_mem_region(cdev->dev, 0);
uint16_t div;
div = (CPU_FREQ / baudrate) - 1;
@@ -40,7 +40,7 @@ static int altera_serial_setbaudrate(struct console_device *cdev, int baudrate)
static void altera_serial_putc(struct console_device *cdev, char c)
{
- struct nios_uart *uart = (struct nios_uart *)cdev->dev->map_base;
+ struct nios_uart *uart = (struct nios_uart *)dev_request_mem_region(cdev->dev, 0);
while ((readw(&uart->status) & NIOS_UART_TRDY) == 0);
@@ -49,14 +49,14 @@ static void altera_serial_putc(struct console_device *cdev, char c)
static int altera_serial_tstc(struct console_device *cdev)
{
- struct nios_uart *uart = (struct nios_uart *)cdev->dev->map_base;
+ struct nios_uart *uart = (struct nios_uart *)dev_request_mem_region(cdev->dev, 0);
return readw(&uart->status) & NIOS_UART_RRDY;
}
static int altera_serial_getc(struct console_device *cdev)
{
- struct nios_uart *uart = (struct nios_uart *)cdev->dev->map_base;
+ struct nios_uart *uart = (struct nios_uart *)dev_request_mem_region(cdev->dev, 0);
while (altera_serial_tstc(cdev) == 0);
--
1.7.1
More information about the barebox
mailing list