MIPS: IP32: ip32-platform is not a module.
[linux-drm-fsl-dcu.git] / arch / mips / sgi-ip32 / ip32-platform.c
1 /*
2  * This file is subject to the terms and conditions of the GNU General Public
3  * License.  See the file "COPYING" in the main directory of this archive
4  * for more details.
5  *
6  * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
7  */
8 #include <linux/init.h>
9 #include <linux/platform_device.h>
10 #include <linux/serial_8250.h>
11
12 #include <asm/ip32/mace.h>
13 #include <asm/ip32/ip32_ints.h>
14
15 #define MACEISA_SERIAL1_OFFS   offsetof(struct sgi_mace, isa.serial1)
16 #define MACEISA_SERIAL2_OFFS   offsetof(struct sgi_mace, isa.serial2)
17
18 #define MACE_PORT(offset,_irq)                                          \
19 {                                                                       \
20         .mapbase        = MACE_BASE + offset,                           \
21         .irq            = _irq,                                         \
22         .uartclk        = 1843200,                                      \
23         .iotype         = UPIO_MEM,                                     \
24         .flags          = UPF_SKIP_TEST|UPF_IOREMAP,                    \
25         .regshift       = 8,                                            \
26 }
27
28 static struct plat_serial8250_port uart8250_data[] = {
29         MACE_PORT(MACEISA_SERIAL1_OFFS, MACEISA_SERIAL1_IRQ),
30         MACE_PORT(MACEISA_SERIAL2_OFFS, MACEISA_SERIAL2_IRQ),
31         { },
32 };
33
34 static struct platform_device uart8250_device = {
35         .name                   = "serial8250",
36         .id                     = PLAT8250_DEV_PLATFORM,
37         .dev                    = {
38                 .platform_data  = uart8250_data,
39         },
40 };
41
42 static int __init uart8250_init(void)
43 {
44         return platform_device_register(&uart8250_device);
45 }
46
47 device_initcall(uart8250_init);
48
49 static __init int meth_devinit(void)
50 {
51         struct platform_device *pd;
52         int ret;
53
54         pd = platform_device_alloc("meth", -1);
55         if (!pd)
56                 return -ENOMEM;
57
58         ret = platform_device_add(pd);
59         if (ret)
60                 platform_device_put(pd);
61
62         return ret;
63 }
64
65 device_initcall(meth_devinit);
66
67 static __init int sgio2audio_devinit(void)
68 {
69         struct platform_device *pd;
70         int ret;
71
72         pd = platform_device_alloc("sgio2audio", -1);
73         if (!pd)
74                 return -ENOMEM;
75
76         ret = platform_device_add(pd);
77         if (ret)
78                 platform_device_put(pd);
79
80         return ret;
81 }
82
83 device_initcall(sgio2audio_devinit);
84
85 static __init int sgio2btns_devinit(void)
86 {
87         return IS_ERR(platform_device_register_simple("sgibtns", -1, NULL, 0));
88 }
89
90 device_initcall(sgio2btns_devinit);
91
92 static struct resource sgio2_cmos_rsrc[] = {
93         {
94                 .start = 0x70,
95                 .end   = 0x71,
96                 .flags = IORESOURCE_IO
97         }
98 };
99
100 static __init int sgio2_cmos_devinit(void)
101 {
102         return IS_ERR(platform_device_register_simple("rtc_cmos", -1,
103                                                       sgio2_cmos_rsrc, 1));
104 }
105
106 device_initcall(sgio2_cmos_devinit);