blob: 0d0b37f9fea4a6d2fc8614c1938c5c2eac274eed [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/arch/sh/boards/sh03/setup.c
3 *
4 * Copyright (C) 2004 Interface Co.,Ltd. Saito.K
5 *
6 */
7
Linus Torvalds1da177e2005-04-16 15:20:36 -07008#include <linux/init.h>
9#include <linux/irq.h>
Paul Mundt711fa802006-10-03 13:14:04 +090010#include <linux/pci.h>
Paul Mundt3b4d9532007-02-13 15:42:28 +090011#include <linux/platform_device.h>
Paul Mundt8db806e2008-12-17 12:48:41 +090012#include <linux/ata_platform.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <asm/io.h>
Paul Mundt373e68b2006-09-27 15:41:24 +090014#include <asm/rtc.h>
Paul Mundt0764bff2008-07-29 22:10:01 +090015#include <mach-sh03/mach/io.h>
16#include <mach-sh03/mach/sh03.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#include <asm/addrspace.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018
Paul Mundt2c7834a2006-09-27 18:17:31 +090019static void __init init_sh03_IRQ(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070020{
Magnus Dammd59645d2007-08-03 14:23:35 +090021 plat_irq_setup_pins(IRQ_MODE_IRQ);
Linus Torvalds1da177e2005-04-16 15:20:36 -070022}
23
Paul Mundt373e68b2006-09-27 15:41:24 +090024static void __iomem *sh03_ioport_map(unsigned long port, unsigned int size)
Linus Torvalds1da177e2005-04-16 15:20:36 -070025{
26 if (PXSEG(port))
Paul Mundt373e68b2006-09-27 15:41:24 +090027 return (void __iomem *)port;
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
Paul Mundt959f85f2006-09-27 16:43:28 +090029 return (void __iomem *)(port + PCI_IO_BASE);
Paul Mundt373e68b2006-09-27 15:41:24 +090030}
Linus Torvalds1da177e2005-04-16 15:20:36 -070031
Paul Mundt2c7834a2006-09-27 18:17:31 +090032/* arch/sh/boards/sh03/rtc.c */
33void sh03_time_init(void);
34
35static void __init sh03_setup(char **cmdline_p)
36{
37 board_time_init = sh03_time_init;
38}
39
Paul Mundt8db806e2008-12-17 12:48:41 +090040static struct resource cf_ide_resources[3];
41
42static struct platform_device cf_ide_device = {
43 .name = "pata_platform",
44 .id = -1,
45 .num_resources = ARRAY_SIZE(cf_ide_resources),
46 .resource = cf_ide_resources,
47};
48
Paul Mundt3b4d9532007-02-13 15:42:28 +090049static struct resource heartbeat_resources[] = {
50 [0] = {
51 .start = 0xa0800000,
Paul Mundta1fd3062007-08-23 15:11:44 +090052 .end = 0xa0800000,
Paul Mundt3b4d9532007-02-13 15:42:28 +090053 .flags = IORESOURCE_MEM,
54 },
55};
56
57static struct platform_device heartbeat_device = {
58 .name = "heartbeat",
59 .id = -1,
60 .num_resources = ARRAY_SIZE(heartbeat_resources),
61 .resource = heartbeat_resources,
62};
63
64static struct platform_device *sh03_devices[] __initdata = {
65 &heartbeat_device,
Paul Mundt8db806e2008-12-17 12:48:41 +090066 &cf_ide_device,
Paul Mundt3b4d9532007-02-13 15:42:28 +090067};
68
69static int __init sh03_devices_setup(void)
70{
Paul Mundt8db806e2008-12-17 12:48:41 +090071 pgprot_t prot;
72 unsigned long paddrbase;
73 void *cf_ide_base;
74
75 /* open I/O area window */
76 paddrbase = virt_to_phys((void *)PA_AREA5_IO);
77 prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
78 cf_ide_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot);
79 if (!cf_ide_base) {
80 printk("allocate_cf_area : can't open CF I/O window!\n");
81 return -ENOMEM;
82 }
83
84 /* IDE cmd address : 0x1f0-0x1f7 and 0x3f6 */
85 cf_ide_resources[0].start = (unsigned long)cf_ide_base + 0x40;
86 cf_ide_resources[0].end = (unsigned long)cf_ide_base + 0x40 + 0x0f;
87 cf_ide_resources[0].flags = IORESOURCE_IO;
88 cf_ide_resources[1].start = (unsigned long)cf_ide_base + 0x2c;
89 cf_ide_resources[1].end = (unsigned long)cf_ide_base + 0x2c + 0x03;
90 cf_ide_resources[1].flags = IORESOURCE_IO;
91 cf_ide_resources[2].start = IRQ_FATA;
92 cf_ide_resources[2].flags = IORESOURCE_IRQ;
93
Paul Mundt3b4d9532007-02-13 15:42:28 +090094 return platform_add_devices(sh03_devices, ARRAY_SIZE(sh03_devices));
95}
96__initcall(sh03_devices_setup);
97
Paul Mundt82f81f42007-05-15 15:19:34 +090098static struct sh_machine_vector mv_sh03 __initmv = {
Paul Mundt2c7834a2006-09-27 18:17:31 +090099 .mv_name = "Interface (CTP/PCI-SH03)",
100 .mv_setup = sh03_setup,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101 .mv_nr_irqs = 48,
Paul Mundt373e68b2006-09-27 15:41:24 +0900102 .mv_ioport_map = sh03_ioport_map,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103 .mv_init_irq = init_sh03_IRQ,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104};