From 75d35213777e2b278db57a420efbce2bdb61da93 Mon Sep 17 00:00:00 2001 From: Haavard Skinnemoen Date: Wed, 4 Oct 2006 16:02:08 +0200 Subject: [PATCH] atmel_serial: Pass fixed register mappings through platform_data In order to initialize the serial console early, the atmel_serial driver had to do a hack where it compared the physical address of the port with an address known to be permanently mapped, and used it as a virtual address. This got around the limitation that ioremap() isn't always available when the console is being initalized. This patch removes that hack and replaces it with a new "regs" field in struct atmel_uart_data that the board-specific code can initialize to a fixed virtual mapping for platform devices where this is possible. It also initializes the DBGU's regs field with the address the driver used to check against. On AVR32, the "regs" field is initialized from the physical base address when this it can be accessed through a permanently 1:1 mapped segment, i.e. the P4 segment. If regs is NULL, the console initialization is delayed until the "real" driver is up and running and ioremap() can be used. Signed-off-by: Haavard Skinnemoen Acked-by: Andrew Victor Signed-off-by: Linus Torvalds --- drivers/serial/atmel_serial.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c index 2f9d99bb958..34212df3980 100644 --- a/drivers/serial/atmel_serial.c +++ b/drivers/serial/atmel_serial.c @@ -694,8 +694,9 @@ static void __devinit atmel_init_port(struct atmel_uart_port *atmel_port, struct port->mapbase = pdev->resource[0].start; port->irq = pdev->resource[1].start; - if (port->mapbase == AT91_VA_BASE_SYS + AT91_DBGU) /* Part of system perpherals - already mapped */ - port->membase = (void __iomem *) port->mapbase; + if (data->regs) + /* Already mapped by setup code */ + port->membase = data->regs; else { port->flags |= UPF_IOREMAP; port->membase = NULL; -- cgit v1.2.3-70-g09d2