| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  * linux/arch/sh/boards/sh03/setup.c | 
 | 3 |  * | 
 | 4 |  * Copyright (C) 2004  Interface Co.,Ltd. Saito.K | 
 | 5 |  * | 
 | 6 |  */ | 
 | 7 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | #include <linux/init.h> | 
 | 9 | #include <linux/irq.h> | 
| Paul Mundt | 711fa80 | 2006-10-03 13:14:04 +0900 | [diff] [blame] | 10 | #include <linux/pci.h> | 
| Paul Mundt | 3b4d953 | 2007-02-13 15:42:28 +0900 | [diff] [blame] | 11 | #include <linux/platform_device.h> | 
| Paul Mundt | 8db806e | 2008-12-17 12:48:41 +0900 | [diff] [blame] | 12 | #include <linux/ata_platform.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #include <asm/io.h> | 
| Paul Mundt | 373e68b | 2006-09-27 15:41:24 +0900 | [diff] [blame] | 14 | #include <asm/rtc.h> | 
| Paul Mundt | 0764bff | 2008-07-29 22:10:01 +0900 | [diff] [blame] | 15 | #include <mach-sh03/mach/io.h> | 
 | 16 | #include <mach-sh03/mach/sh03.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | #include <asm/addrspace.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 |  | 
| Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 19 | static void __init init_sh03_IRQ(void) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | { | 
| Magnus Damm | d59645d | 2007-08-03 14:23:35 +0900 | [diff] [blame] | 21 | 	plat_irq_setup_pins(IRQ_MODE_IRQ); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | } | 
 | 23 |  | 
| Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 24 | /* arch/sh/boards/sh03/rtc.c */ | 
 | 25 | void sh03_time_init(void); | 
 | 26 |  | 
 | 27 | static void __init sh03_setup(char **cmdline_p) | 
 | 28 | { | 
 | 29 | 	board_time_init = sh03_time_init; | 
 | 30 | } | 
 | 31 |  | 
| Paul Mundt | 2ea40de | 2008-12-22 03:25:04 +0900 | [diff] [blame] | 32 | static struct resource cf_ide_resources[] = { | 
 | 33 | 	[0] = { | 
 | 34 | 		.start  = 0x1f0, | 
 | 35 | 		.end    = 0x1f0 + 8, | 
 | 36 | 		.flags  = IORESOURCE_IO, | 
 | 37 | 	}, | 
 | 38 | 	[1] = { | 
 | 39 | 		.start  = 0x1f0 + 0x206, | 
 | 40 | 		.end    = 0x1f0 +8 + 0x206 + 8, | 
 | 41 | 		.flags  = IORESOURCE_IO, | 
 | 42 | 	}, | 
 | 43 | 	[2] = { | 
 | 44 | 		.start  = IRL2_IRQ, | 
 | 45 | 		.flags  = IORESOURCE_IRQ, | 
 | 46 | 	}, | 
 | 47 | }; | 
| Paul Mundt | 8db806e | 2008-12-17 12:48:41 +0900 | [diff] [blame] | 48 |  | 
 | 49 | static struct platform_device cf_ide_device = { | 
 | 50 | 	.name		= "pata_platform", | 
 | 51 | 	.id		= -1, | 
 | 52 | 	.num_resources	= ARRAY_SIZE(cf_ide_resources), | 
 | 53 | 	.resource	= cf_ide_resources, | 
 | 54 | }; | 
 | 55 |  | 
| Paul Mundt | 3b4d953 | 2007-02-13 15:42:28 +0900 | [diff] [blame] | 56 | static struct resource heartbeat_resources[] = { | 
 | 57 | 	[0] = { | 
 | 58 | 		.start	= 0xa0800000, | 
| Paul Mundt | a1fd306 | 2007-08-23 15:11:44 +0900 | [diff] [blame] | 59 | 		.end	= 0xa0800000, | 
| Paul Mundt | 3b4d953 | 2007-02-13 15:42:28 +0900 | [diff] [blame] | 60 | 		.flags	= IORESOURCE_MEM, | 
 | 61 | 	}, | 
 | 62 | }; | 
 | 63 |  | 
 | 64 | static struct platform_device heartbeat_device = { | 
 | 65 | 	.name		= "heartbeat", | 
 | 66 | 	.id		= -1, | 
 | 67 | 	.num_resources	= ARRAY_SIZE(heartbeat_resources), | 
 | 68 | 	.resource	= heartbeat_resources, | 
 | 69 | }; | 
 | 70 |  | 
 | 71 | static struct platform_device *sh03_devices[] __initdata = { | 
 | 72 | 	&heartbeat_device, | 
| Paul Mundt | 8db806e | 2008-12-17 12:48:41 +0900 | [diff] [blame] | 73 | 	&cf_ide_device, | 
| Paul Mundt | 3b4d953 | 2007-02-13 15:42:28 +0900 | [diff] [blame] | 74 | }; | 
 | 75 |  | 
 | 76 | static int __init sh03_devices_setup(void) | 
 | 77 | { | 
| Paul Mundt | 8db806e | 2008-12-17 12:48:41 +0900 | [diff] [blame] | 78 | 	pgprot_t prot; | 
 | 79 | 	unsigned long paddrbase; | 
 | 80 | 	void *cf_ide_base; | 
 | 81 |  | 
 | 82 | 	/* open I/O area window */ | 
 | 83 | 	paddrbase = virt_to_phys((void *)PA_AREA5_IO); | 
 | 84 | 	prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16); | 
 | 85 | 	cf_ide_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot); | 
 | 86 | 	if (!cf_ide_base) { | 
 | 87 | 		printk("allocate_cf_area : can't open CF I/O window!\n"); | 
 | 88 | 		return -ENOMEM; | 
 | 89 | 	} | 
 | 90 |  | 
 | 91 | 	/* IDE cmd address : 0x1f0-0x1f7 and 0x3f6 */ | 
| Paul Mundt | 2ea40de | 2008-12-22 03:25:04 +0900 | [diff] [blame] | 92 | 	cf_ide_resources[0].start += (unsigned long)cf_ide_base; | 
 | 93 | 	cf_ide_resources[0].end   += (unsigned long)cf_ide_base; | 
 | 94 | 	cf_ide_resources[1].start += (unsigned long)cf_ide_base; | 
 | 95 | 	cf_ide_resources[1].end   += (unsigned long)cf_ide_base; | 
| Paul Mundt | 8db806e | 2008-12-17 12:48:41 +0900 | [diff] [blame] | 96 |  | 
| Paul Mundt | 3b4d953 | 2007-02-13 15:42:28 +0900 | [diff] [blame] | 97 | 	return platform_add_devices(sh03_devices, ARRAY_SIZE(sh03_devices)); | 
 | 98 | } | 
 | 99 | __initcall(sh03_devices_setup); | 
 | 100 |  | 
| Paul Mundt | 82f81f4 | 2007-05-15 15:19:34 +0900 | [diff] [blame] | 101 | static struct sh_machine_vector mv_sh03 __initmv = { | 
| Paul Mundt | 2c7834a | 2006-09-27 18:17:31 +0900 | [diff] [blame] | 102 | 	.mv_name		= "Interface (CTP/PCI-SH03)", | 
 | 103 | 	.mv_setup		= sh03_setup, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | 	.mv_nr_irqs		= 48, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 105 | 	.mv_init_irq		= init_sh03_IRQ, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 106 | }; |