]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/sh/boards/board-urquell.c
d5caeabf46e0dfe1ad939ecd4e91d9ef162f4185
[linux-2.6-omap-h63xx.git] / arch / sh / boards / board-urquell.c
1 /*
2  * Renesas Technology Corp. SH7786 Urquell Support.
3  *
4  * Copyright (C) 2008  Kuninori Morimoto <morimoto.kuninori@renesas.com>
5  * Copyright (C) 2008  Yoshihiro Shimoda
6  *
7  * This file is subject to the terms and conditions of the GNU General Public
8  * License.  See the file "COPYING" in the main directory of this archive
9  * for more details.
10  */
11 #include <linux/init.h>
12 #include <linux/platform_device.h>
13 #include <linux/fb.h>
14 #include <linux/mtd/physmap.h>
15 #include <linux/delay.h>
16 #include <linux/gpio.h>
17 #include <linux/irq.h>
18 #include <mach/urquell.h>
19 #include <cpu/sh7786.h>
20 #include <asm/heartbeat.h>
21 #include <asm/sizes.h>
22
23 static struct resource heartbeat_resources[] = {
24         [0] = {
25                 .start  = BOARDREG(SLEDR),
26                 .end    = BOARDREG(SLEDR),
27                 .flags  = IORESOURCE_MEM,
28         },
29 };
30
31 static struct heartbeat_data heartbeat_data = {
32         .regsize = 16,
33 };
34
35 static struct platform_device heartbeat_device = {
36         .name           = "heartbeat",
37         .id             = -1,
38         .dev    = {
39                 .platform_data  = &heartbeat_data,
40         },
41         .num_resources  = ARRAY_SIZE(heartbeat_resources),
42         .resource       = heartbeat_resources,
43 };
44
45 static struct mtd_partition nor_flash_partitions[] = {
46         {
47                 .name           = "loader",
48                 .offset         = 0x00000000,
49                 .size           = SZ_512K,
50                 .mask_flags     = MTD_WRITEABLE,        /* Read-only */
51         },
52         {
53                 .name           = "bootenv",
54                 .offset         = MTDPART_OFS_APPEND,
55                 .size           = SZ_512K,
56                 .mask_flags     = MTD_WRITEABLE,        /* Read-only */
57         },
58         {
59                 .name           = "kernel",
60                 .offset         = MTDPART_OFS_APPEND,
61                 .size           = SZ_4M,
62         },
63         {
64                 .name           = "data",
65                 .offset         = MTDPART_OFS_APPEND,
66                 .size           = MTDPART_SIZ_FULL,
67         },
68 };
69
70 static struct physmap_flash_data nor_flash_data = {
71         .width          = 2,
72         .parts          = nor_flash_partitions,
73         .nr_parts       = ARRAY_SIZE(nor_flash_partitions),
74 };
75
76 static struct resource nor_flash_resources[] = {
77         [0] = {
78                 .start  = NOR_FLASH_ADDR,
79                 .end    = NOR_FLASH_ADDR + NOR_FLASH_SIZE - 1,
80                 .flags  = IORESOURCE_MEM,
81         }
82 };
83
84 static struct platform_device nor_flash_device = {
85         .name           = "physmap-flash",
86         .dev            = {
87                 .platform_data  = &nor_flash_data,
88         },
89         .num_resources  = ARRAY_SIZE(nor_flash_resources),
90         .resource       = nor_flash_resources,
91 };
92
93 static struct platform_device *urquell_devices[] __initdata = {
94         &heartbeat_device,
95         &nor_flash_device,
96 };
97
98 static int __init urquell_devices_setup(void)
99 {
100         /* USB */
101         gpio_request(GPIO_FN_USB_OVC0,  NULL);
102         gpio_request(GPIO_FN_USB_PENC0, NULL);
103
104         return platform_add_devices(urquell_devices,
105                                     ARRAY_SIZE(urquell_devices));
106 }
107 device_initcall(urquell_devices_setup);
108
109 static void urquell_power_off(void)
110 {
111         __raw_writew(0xa5a5, UBOARDREG(SRSTR));
112 }
113
114 /* Initialize the board */
115 static void __init urquell_setup(char **cmdline_p)
116 {
117         printk(KERN_INFO "Renesas Technology Corp. Urquell support.\n");
118
119         pm_power_off = urquell_power_off;
120 }
121
122 /*
123  * The Machine Vector
124  */
125 static struct sh_machine_vector mv_urquell __initmv = {
126         .mv_name        = "Urquell",
127         .mv_setup       = urquell_setup,
128 };