| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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> | 
| Russell King | 382b448 | 2009-12-24 12:52:44 +0000 | [diff] [blame] | 14 | #include <asm/hardware/dec21285.h> | 
 | 15 |  | 
 | 16 | #include "common.h" | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 |  | 
| Russell King | cba774a | 2007-09-30 17:39:05 +0100 | [diff] [blame] | 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 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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", | 
| Russell King | 6df29de | 2005-09-08 16:04:41 +0100 | [diff] [blame] | 73 | 	.id			= PLAT8250_DEV_PLATFORM, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | 	.dev			= { | 
 | 75 | 		.platform_data	= serial_platform_data, | 
 | 76 | 	}, | 
| Russell King | cba774a | 2007-09-30 17:39:05 +0100 | [diff] [blame] | 77 | 	.resource		= serial_resources, | 
 | 78 | 	.num_resources		= ARRAY_SIZE(serial_resources), | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | }; | 
 | 80 |  | 
 | 81 | static int __init footbridge_isa_init(void) | 
 | 82 | { | 
| Russell King | 382b448 | 2009-12-24 12:52:44 +0000 | [diff] [blame] | 83 | 	int err = 0; | 
| Russell King | cba774a | 2007-09-30 17:39:05 +0100 | [diff] [blame] | 84 |  | 
| Russell King | 382b448 | 2009-12-24 12:52:44 +0000 | [diff] [blame] | 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 | 	} | 
| Russell King | cba774a | 2007-09-30 17:39:05 +0100 | [diff] [blame] | 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; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | } | 
 | 100 |  | 
 | 101 | arch_initcall(footbridge_isa_init); |