2 * Registration of Lasat UART platform device.
4 * Copyright (C) 2007 Brian Murphy <brian@murphy.dk>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #include <linux/errno.h>
21 #include <linux/init.h>
22 #include <linux/ioport.h>
23 #include <linux/platform_device.h>
24 #include <linux/serial_8250.h>
26 #include <asm/bootinfo.h>
27 #include <asm/lasat/lasat.h>
28 #include <asm/lasat/serial.h>
30 static struct resource lasat_serial_res
[2] __initdata
;
32 static struct plat_serial8250_port lasat_serial8250_port
[] = {
35 .flags
= UPF_IOREMAP
| UPF_BOOT_AUTOCONF
|
41 static __init
int lasat_uart_add(void)
43 struct platform_device
*pdev
;
46 pdev
= platform_device_alloc("serial8250", -1);
50 if (mips_machtype
== MACH_LASAT_100
) {
51 lasat_serial_res
[0].start
= KSEG1ADDR(LASAT_UART_REGS_BASE_100
);
52 lasat_serial_res
[0].end
= lasat_serial_res
[0].start
+ LASAT_UART_REGS_SHIFT_100
* 8 - 1;
53 lasat_serial_res
[0].flags
= IORESOURCE_MEM
;
54 lasat_serial_res
[1].start
= LASATINT_UART_100
;
55 lasat_serial_res
[1].end
= LASATINT_UART_100
;
56 lasat_serial_res
[1].flags
= IORESOURCE_IRQ
;
58 lasat_serial8250_port
[0].mapbase
= LASAT_UART_REGS_BASE_100
;
59 lasat_serial8250_port
[0].uartclk
= LASAT_BASE_BAUD_100
* 16;
60 lasat_serial8250_port
[0].regshift
= LASAT_UART_REGS_SHIFT_100
;
61 lasat_serial8250_port
[0].irq
= LASATINT_UART_100
;
63 lasat_serial_res
[0].start
= KSEG1ADDR(LASAT_UART_REGS_BASE_200
);
64 lasat_serial_res
[0].end
= lasat_serial_res
[0].start
+ LASAT_UART_REGS_SHIFT_200
* 8 - 1;
65 lasat_serial_res
[0].flags
= IORESOURCE_MEM
;
66 lasat_serial_res
[1].start
= LASATINT_UART_200
;
67 lasat_serial_res
[1].end
= LASATINT_UART_200
;
68 lasat_serial_res
[1].flags
= IORESOURCE_IRQ
;
70 lasat_serial8250_port
[0].mapbase
= LASAT_UART_REGS_BASE_200
;
71 lasat_serial8250_port
[0].uartclk
= LASAT_BASE_BAUD_200
* 16;
72 lasat_serial8250_port
[0].regshift
= LASAT_UART_REGS_SHIFT_200
;
73 lasat_serial8250_port
[0].irq
= LASATINT_UART_200
;
76 pdev
->id
= PLAT8250_DEV_PLATFORM
;
77 pdev
->dev
.platform_data
= lasat_serial8250_port
;
79 retval
= platform_device_add_resources(pdev
, lasat_serial_res
, ARRAY_SIZE(lasat_serial_res
));
83 retval
= platform_device_add(pdev
);
90 platform_device_put(pdev
);
94 device_initcall(lasat_uart_add
);