Merge branch 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
[firefly-linux-kernel-4.4.55.git] / arch / arm / mach-footbridge / isa.c
1 /*
2  *  linux/arch/arm/mach-footbridge/isa.c
3  *
4  *  Copyright (C) 2004 Russell King.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10 #include <linux/init.h>
11 #include <linux/serial_8250.h>
12
13 #include <asm/irq.h>
14 #include <asm/hardware/dec21285.h>
15
16 #include "common.h"
17
18 static struct resource rtc_resources[] = {
19         [0] = {
20                 .start  = 0x70,
21                 .end    = 0x73,
22                 .flags  = IORESOURCE_IO,
23         },
24         [1] = {
25                 .start  = IRQ_ISA_RTC_ALARM,
26                 .end    = IRQ_ISA_RTC_ALARM,
27                 .flags  = IORESOURCE_IRQ,
28         }
29 };
30
31 static struct platform_device rtc_device = {
32         .name           = "rtc_cmos",
33         .id             = -1,
34         .resource       = rtc_resources,
35         .num_resources  = ARRAY_SIZE(rtc_resources),
36 };
37
38 static struct resource serial_resources[] = {
39         [0] = {
40                 .start  = 0x3f8,
41                 .end    = 0x3ff,
42                 .flags  = IORESOURCE_IO,
43         },
44         [1] = {
45                 .start  = 0x2f8,
46                 .end    = 0x2ff,
47                 .flags  = IORESOURCE_IO,
48         },
49 };
50
51 static struct plat_serial8250_port serial_platform_data[] = {
52         {
53                 .iobase         = 0x3f8,
54                 .irq            = IRQ_ISA_UART,
55                 .uartclk        = 1843200,
56                 .regshift       = 0,
57                 .iotype         = UPIO_PORT,
58                 .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
59         },
60         {
61                 .iobase         = 0x2f8,
62                 .irq            = IRQ_ISA_UART2,
63                 .uartclk        = 1843200,
64                 .regshift       = 0,
65                 .iotype         = UPIO_PORT,
66                 .flags          = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
67         },
68         { },
69 };
70
71 static struct platform_device serial_device = {
72         .name                   = "serial8250",
73         .id                     = PLAT8250_DEV_PLATFORM,
74         .dev                    = {
75                 .platform_data  = serial_platform_data,
76         },
77         .resource               = serial_resources,
78         .num_resources          = ARRAY_SIZE(serial_resources),
79 };
80
81 static int __init footbridge_isa_init(void)
82 {
83         int err = 0;
84
85         if (!footbridge_cfn_mode())
86                 return 0;
87
88         /* Personal server doesn't have RTC */
89         if (!machine_is_personal_server()) {
90                 isa_rtc_init();
91                 err = platform_device_register(&rtc_device);
92                 if (err)
93                         printk(KERN_ERR "Unable to register RTC device: %d\n", err);
94         }
95         err = platform_device_register(&serial_device);
96         if (err)
97                 printk(KERN_ERR "Unable to register serial device: %d\n", err);
98         return 0;
99 }
100
101 arch_initcall(footbridge_isa_init);