This client driver allows you to use a GPIO pin as a source for PPS
[linux-2.6/next.git] / arch / sh / boards / board-sh2007.c
blobb90b78f6a829cdf09d2c2e540d2f4208353c3a11
1 /*
2 * SH-2007 board support.
4 * Copyright (C) 2003, 2004 SUGIOKA Toshinobu
5 * Copyright (C) 2010 Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
6 */
7 #include <linux/init.h>
8 #include <linux/irq.h>
9 #include <linux/smsc911x.h>
10 #include <linux/platform_device.h>
11 #include <linux/ata_platform.h>
12 #include <linux/io.h>
13 #include <asm/machvec.h>
14 #include <mach/sh2007.h>
16 struct smsc911x_platform_config smc911x_info = {
17 .flags = SMSC911X_USE_32BIT,
18 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
19 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
22 static struct resource smsc9118_0_resources[] = {
23 [0] = {
24 .start = SMC0_BASE,
25 .end = SMC0_BASE + 0xff,
26 .flags = IORESOURCE_MEM,
28 [1] = {
29 .start = evt2irq(0x240),
30 .end = evt2irq(0x240),
31 .flags = IORESOURCE_IRQ,
35 static struct resource smsc9118_1_resources[] = {
36 [0] = {
37 .start = SMC1_BASE,
38 .end = SMC1_BASE + 0xff,
39 .flags = IORESOURCE_MEM,
41 [1] = {
42 .start = evt2irq(0x280),
43 .end = evt2irq(0x280),
44 .flags = IORESOURCE_IRQ,
48 static struct platform_device smsc9118_0_device = {
49 .name = "smsc911x",
50 .id = 0,
51 .num_resources = ARRAY_SIZE(smsc9118_0_resources),
52 .resource = smsc9118_0_resources,
53 .dev = {
54 .platform_data = &smc911x_info,
58 static struct platform_device smsc9118_1_device = {
59 .name = "smsc911x",
60 .id = 1,
61 .num_resources = ARRAY_SIZE(smsc9118_1_resources),
62 .resource = smsc9118_1_resources,
63 .dev = {
64 .platform_data = &smc911x_info,
68 static struct resource cf_resources[] = {
69 [0] = {
70 .start = CF_BASE + CF_OFFSET,
71 .end = CF_BASE + CF_OFFSET + 0x0f,
72 .flags = IORESOURCE_MEM,
74 [1] = {
75 .start = CF_BASE + CF_OFFSET + 0x206,
76 .end = CF_BASE + CF_OFFSET + 0x20f,
77 .flags = IORESOURCE_MEM,
79 [2] = {
80 .start = evt2irq(0x2c0),
81 .end = evt2irq(0x2c0),
82 .flags = IORESOURCE_IRQ,
86 static struct platform_device cf_device = {
87 .name = "pata_platform",
88 .id = 0,
89 .num_resources = ARRAY_SIZE(cf_resources),
90 .resource = cf_resources,
93 static struct platform_device *sh2007_devices[] __initdata = {
94 &smsc9118_0_device,
95 &smsc9118_1_device,
96 &cf_device,
99 static int __init sh2007_io_init(void)
101 platform_add_devices(sh2007_devices, ARRAY_SIZE(sh2007_devices));
102 return 0;
104 subsys_initcall(sh2007_io_init);
106 static void __init sh2007_init_irq(void)
108 plat_irq_setup_pins(IRQ_MODE_IRQ);
112 * Initialize the board
114 static void __init sh2007_setup(char **cmdline_p)
116 printk(KERN_INFO "SH-2007 Setup...");
118 /* setup wait control registers for area 5 */
119 __raw_writel(CS5BCR_D, CS5BCR);
120 __raw_writel(CS5WCR_D, CS5WCR);
121 __raw_writel(CS5PCR_D, CS5PCR);
123 printk(KERN_INFO " done.\n");
127 * The Machine Vector
129 struct sh_machine_vector mv_sh2007 __initmv = {
130 .mv_setup = sh2007_setup,
131 .mv_name = "sh2007",
132 .mv_init_irq = sh2007_init_irq,