Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
[linux-2.6] / arch / sh / boards / mach-rsk / devices-rsk7203.c
1 /*
2  * Renesas Technology Europe RSK+ 7203 Support.
3  *
4  * Copyright (C) 2008 Paul Mundt
5  *
6  * This file is subject to the terms and conditions of the GNU General Public
7  * License.  See the file "COPYING" in the main directory of this archive
8  * for more details.
9  */
10 #include <linux/init.h>
11 #include <linux/types.h>
12 #include <linux/platform_device.h>
13 #include <linux/interrupt.h>
14 #include <linux/mtd/mtd.h>
15 #include <linux/mtd/partitions.h>
16 #include <linux/mtd/physmap.h>
17 #include <linux/mtd/map.h>
18 #include <linux/smc911x.h>
19 #include <linux/gpio.h>
20 #include <linux/leds.h>
21 #include <asm/machvec.h>
22 #include <asm/io.h>
23 #include <cpu/sh7203.h>
24
25 static struct smc911x_platdata smc911x_info = {
26         .flags          = SMC911X_USE_16BIT,
27         .irq_flags      = IRQF_TRIGGER_LOW,
28 };
29
30 static struct resource smc911x_resources[] = {
31         [0] = {
32                 .start          = 0x24000000,
33                 .end            = 0x24000000 + 0x100,
34                 .flags          = IORESOURCE_MEM,
35         },
36         [1] = {
37                 .start          = 64,
38                 .end            = 64,
39                 .flags          = IORESOURCE_IRQ,
40         },
41 };
42
43 static struct platform_device smc911x_device = {
44         .name           = "smc911x",
45         .id             = -1,
46         .num_resources  = ARRAY_SIZE(smc911x_resources),
47         .resource       = smc911x_resources,
48         .dev            = {
49                 .platform_data = &smc911x_info,
50         },
51 };
52
53 static struct gpio_led rsk7203_gpio_leds[] = {
54         {
55                 .name                   = "green",
56                 .gpio                   = GPIO_PE10,
57                 .active_low             = 1,
58         }, {
59                 .name                   = "orange",
60                 .default_trigger        = "nand-disk",
61                 .gpio                   = GPIO_PE12,
62                 .active_low             = 1,
63         }, {
64                 .name                   = "red:timer",
65                 .default_trigger        = "timer",
66                 .gpio                   = GPIO_PC14,
67                 .active_low             = 1,
68         }, {
69                 .name                   = "red:heartbeat",
70                 .default_trigger        = "heartbeat",
71                 .gpio                   = GPIO_PE11,
72                 .active_low             = 1,
73         },
74 };
75
76 static struct gpio_led_platform_data rsk7203_gpio_leds_info = {
77         .leds           = rsk7203_gpio_leds,
78         .num_leds       = ARRAY_SIZE(rsk7203_gpio_leds),
79 };
80
81 static struct platform_device led_device = {
82         .name           = "leds-gpio",
83         .id             = -1,
84         .dev            = {
85                 .platform_data  = &rsk7203_gpio_leds_info,
86         },
87 };
88
89 static struct platform_device *rsk7203_devices[] __initdata = {
90         &smc911x_device,
91         &led_device,
92 };
93
94 static int __init rsk7203_devices_setup(void)
95 {
96         /* Select pins for SCIF0 */
97         gpio_request(GPIO_FN_TXD0, NULL);
98         gpio_request(GPIO_FN_RXD0, NULL);
99
100         return platform_add_devices(rsk7203_devices,
101                                     ARRAY_SIZE(rsk7203_devices));
102 }
103 device_initcall(rsk7203_devices_setup);