Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6
[pandora-kernel.git] / arch / arm / mach-ux500 / cpu-db5500.c
1 /*
2  * Copyright (C) ST-Ericsson SA 2010
3  *
4  * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5  * License terms: GNU General Public License (GPL) version 2
6  */
7
8 #include <linux/platform_device.h>
9 #include <linux/amba/bus.h>
10 #include <linux/io.h>
11
12 #include <asm/mach/map.h>
13
14 #include <mach/hardware.h>
15 #include <mach/devices.h>
16 #include <mach/setup.h>
17 #include <mach/irqs.h>
18
19 static struct map_desc u5500_io_desc[] __initdata = {
20         __IO_DEV_DESC(U5500_GPIO0_BASE, SZ_4K),
21         __IO_DEV_DESC(U5500_GPIO1_BASE, SZ_4K),
22         __IO_DEV_DESC(U5500_GPIO2_BASE, SZ_4K),
23         __IO_DEV_DESC(U5500_GPIO3_BASE, SZ_4K),
24         __IO_DEV_DESC(U5500_GPIO4_BASE, SZ_4K),
25         __IO_DEV_DESC(U5500_PRCMU_BASE, SZ_4K),
26 };
27
28 static struct resource mbox0_resources[] = {
29         {
30                 .name = "mbox_peer",
31                 .start = U5500_MBOX0_PEER_START,
32                 .end = U5500_MBOX0_PEER_END,
33                 .flags = IORESOURCE_MEM,
34         },
35         {
36                 .name = "mbox_local",
37                 .start = U5500_MBOX0_LOCAL_START,
38                 .end = U5500_MBOX0_LOCAL_END,
39                 .flags = IORESOURCE_MEM,
40         },
41         {
42                 .name = "mbox_irq",
43                 .start = MBOX_PAIR0_VIRT_IRQ,
44                 .end = MBOX_PAIR0_VIRT_IRQ,
45                 .flags = IORESOURCE_IRQ,
46         }
47 };
48
49 static struct resource mbox1_resources[] = {
50         {
51                 .name = "mbox_peer",
52                 .start = U5500_MBOX1_PEER_START,
53                 .end = U5500_MBOX1_PEER_END,
54                 .flags = IORESOURCE_MEM,
55         },
56         {
57                 .name = "mbox_local",
58                 .start = U5500_MBOX1_LOCAL_START,
59                 .end = U5500_MBOX1_LOCAL_END,
60                 .flags = IORESOURCE_MEM,
61         },
62         {
63                 .name = "mbox_irq",
64                 .start = MBOX_PAIR1_VIRT_IRQ,
65                 .end = MBOX_PAIR1_VIRT_IRQ,
66                 .flags = IORESOURCE_IRQ,
67         }
68 };
69
70 static struct resource mbox2_resources[] = {
71         {
72                 .name = "mbox_peer",
73                 .start = U5500_MBOX2_PEER_START,
74                 .end = U5500_MBOX2_PEER_END,
75                 .flags = IORESOURCE_MEM,
76         },
77         {
78                 .name = "mbox_local",
79                 .start = U5500_MBOX2_LOCAL_START,
80                 .end = U5500_MBOX2_LOCAL_END,
81                 .flags = IORESOURCE_MEM,
82         },
83         {
84                 .name = "mbox_irq",
85                 .start = MBOX_PAIR2_VIRT_IRQ,
86                 .end = MBOX_PAIR2_VIRT_IRQ,
87                 .flags = IORESOURCE_IRQ,
88         }
89 };
90
91 static struct platform_device mbox0_device = {
92         .id = 0,
93         .name = "mbox",
94         .resource = mbox0_resources,
95         .num_resources = ARRAY_SIZE(mbox0_resources),
96 };
97
98 static struct platform_device mbox1_device = {
99         .id = 1,
100         .name = "mbox",
101         .resource = mbox1_resources,
102         .num_resources = ARRAY_SIZE(mbox1_resources),
103 };
104
105 static struct platform_device mbox2_device = {
106         .id = 2,
107         .name = "mbox",
108         .resource = mbox2_resources,
109         .num_resources = ARRAY_SIZE(mbox2_resources),
110 };
111
112 static struct platform_device *u5500_platform_devs[] __initdata = {
113         &u5500_gpio_devs[0],
114         &u5500_gpio_devs[1],
115         &u5500_gpio_devs[2],
116         &u5500_gpio_devs[3],
117         &u5500_gpio_devs[4],
118         &u5500_gpio_devs[5],
119         &u5500_gpio_devs[6],
120         &u5500_gpio_devs[7],
121         &mbox0_device,
122         &mbox1_device,
123         &mbox2_device,
124 };
125
126 void __init u5500_map_io(void)
127 {
128         ux500_map_io();
129
130         iotable_init(u5500_io_desc, ARRAY_SIZE(u5500_io_desc));
131 }
132
133 void __init u5500_init_devices(void)
134 {
135         ux500_init_devices();
136
137         platform_add_devices(u5500_platform_devs,
138                              ARRAY_SIZE(u5500_platform_devs));
139 }