blob: 4d9276c27d6f309bba9be58bb2ae773c9725bc81 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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>
Russell King382b44802009-12-24 12:52:44 +000014#include <asm/hardware/dec21285.h>
15
16#include "common.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070017
Russell Kingcba774a2007-09-30 17:39:05 +010018static 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
31static 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
38static 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
Linus Torvalds1da177e2005-04-16 15:20:36 -070051static 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
71static struct platform_device serial_device = {
72 .name = "serial8250",
Russell King6df29de2005-09-08 16:04:41 +010073 .id = PLAT8250_DEV_PLATFORM,
Linus Torvalds1da177e2005-04-16 15:20:36 -070074 .dev = {
75 .platform_data = serial_platform_data,
76 },
Russell Kingcba774a2007-09-30 17:39:05 +010077 .resource = serial_resources,
78 .num_resources = ARRAY_SIZE(serial_resources),
Linus Torvalds1da177e2005-04-16 15:20:36 -070079};
80
81static int __init footbridge_isa_init(void)
82{
Russell King382b44802009-12-24 12:52:44 +000083 int err = 0;
Russell Kingcba774a2007-09-30 17:39:05 +010084
Russell King382b44802009-12-24 12:52:44 +000085 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 }
Russell Kingcba774a2007-09-30 17:39:05 +010095 err = platform_device_register(&serial_device);
96 if (err)
97 printk(KERN_ERR "Unable to register serial device: %d\n", err);
98 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070099}
100
101arch_initcall(footbridge_isa_init);