GNU Linux-libre 4.19.207-gnu1
[releases.git] / drivers / tty / serial / 8250 / 8250_hub6.c
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  *  Copyright (C) 2005 Russell King.
4  *  Data taken from include/asm-i386/serial.h
5  */
6 #include <linux/module.h>
7 #include <linux/init.h>
8 #include <linux/serial_8250.h>
9
10 #define HUB6(card, port)                                                \
11         {                                                               \
12                 .iobase         = 0x302,                                \
13                 .irq            = 3,                                    \
14                 .uartclk        = 1843200,                              \
15                 .iotype         = UPIO_HUB6,                            \
16                 .flags          = UPF_BOOT_AUTOCONF,                    \
17                 .hub6           = (card) << 6 | (port) << 3 | 1,        \
18         }
19
20 static struct plat_serial8250_port hub6_data[] = {
21         HUB6(0, 0),
22         HUB6(0, 1),
23         HUB6(0, 2),
24         HUB6(0, 3),
25         HUB6(0, 4),
26         HUB6(0, 5),
27         HUB6(1, 0),
28         HUB6(1, 1),
29         HUB6(1, 2),
30         HUB6(1, 3),
31         HUB6(1, 4),
32         HUB6(1, 5),
33         { },
34 };
35
36 static struct platform_device hub6_device = {
37         .name                   = "serial8250",
38         .id                     = PLAT8250_DEV_HUB6,
39         .dev                    = {
40                 .platform_data  = hub6_data,
41         },
42 };
43
44 static int __init hub6_init(void)
45 {
46         return platform_device_register(&hub6_device);
47 }
48
49 module_init(hub6_init);
50
51 MODULE_AUTHOR("Russell King");
52 MODULE_DESCRIPTION("8250 serial probe module for Hub6 cards");
53 MODULE_LICENSE("GPL");