1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Registration of Lasat UART platform device.
5 * Copyright (C) 2007 Brian Murphy <brian@murphy.dk>
7 #include <linux/errno.h>
8 #include <linux/init.h>
9 #include <linux/ioport.h>
10 #include <linux/platform_device.h>
11 #include <linux/serial_8250.h>
13 #include <asm/lasat/lasat.h>
14 #include <asm/lasat/serial.h>
16 static struct resource lasat_serial_res
[2] __initdata
;
18 static struct plat_serial8250_port lasat_serial8250_port
[] = {
21 .flags
= UPF_IOREMAP
| UPF_BOOT_AUTOCONF
|
27 static __init
int lasat_uart_add(void)
29 struct platform_device
*pdev
;
32 pdev
= platform_device_alloc("serial8250", -1);
36 if (!IS_LASAT_200()) {
37 lasat_serial_res
[0].start
= KSEG1ADDR(LASAT_UART_REGS_BASE_100
);
38 lasat_serial_res
[0].end
= lasat_serial_res
[0].start
+ LASAT_UART_REGS_SHIFT_100
* 8 - 1;
39 lasat_serial_res
[0].flags
= IORESOURCE_MEM
;
40 lasat_serial_res
[1].start
= LASATINT_UART_100
;
41 lasat_serial_res
[1].end
= LASATINT_UART_100
;
42 lasat_serial_res
[1].flags
= IORESOURCE_IRQ
;
44 lasat_serial8250_port
[0].mapbase
= LASAT_UART_REGS_BASE_100
;
45 lasat_serial8250_port
[0].uartclk
= LASAT_BASE_BAUD_100
* 16;
46 lasat_serial8250_port
[0].regshift
= LASAT_UART_REGS_SHIFT_100
;
47 lasat_serial8250_port
[0].irq
= LASATINT_UART_100
;
49 lasat_serial_res
[0].start
= KSEG1ADDR(LASAT_UART_REGS_BASE_200
);
50 lasat_serial_res
[0].end
= lasat_serial_res
[0].start
+ LASAT_UART_REGS_SHIFT_200
* 8 - 1;
51 lasat_serial_res
[0].flags
= IORESOURCE_MEM
;
52 lasat_serial_res
[1].start
= LASATINT_UART_200
;
53 lasat_serial_res
[1].end
= LASATINT_UART_200
;
54 lasat_serial_res
[1].flags
= IORESOURCE_IRQ
;
56 lasat_serial8250_port
[0].mapbase
= LASAT_UART_REGS_BASE_200
;
57 lasat_serial8250_port
[0].uartclk
= LASAT_BASE_BAUD_200
* 16;
58 lasat_serial8250_port
[0].regshift
= LASAT_UART_REGS_SHIFT_200
;
59 lasat_serial8250_port
[0].irq
= LASATINT_UART_200
;
62 pdev
->id
= PLAT8250_DEV_PLATFORM
;
63 pdev
->dev
.platform_data
= lasat_serial8250_port
;
65 retval
= platform_device_add_resources(pdev
, lasat_serial_res
, ARRAY_SIZE(lasat_serial_res
));
69 retval
= platform_device_add(pdev
);
76 platform_device_put(pdev
);
80 device_initcall(lasat_uart_add
);