blob: bcc0fd4fdc2996c5347ef7e8f7755c498d4d62a6 [file] [log] [blame]
Rabin Vincent591d8dd2010-05-03 08:46:51 +01001/*
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>
Rabin Vincentfbf1ead2010-09-29 19:46:32 +053011#include <linux/irq.h>
Rabin Vincent591d8dd2010-05-03 08:46:51 +010012
13#include <asm/mach/map.h>
14
15#include <mach/hardware.h>
16#include <mach/devices.h>
17#include <mach/setup.h>
Linus Walleij4d4a4b02010-09-27 22:09:52 +010018#include <mach/irqs.h>
Rabin Vincent591d8dd2010-05-03 08:46:51 +010019
Rabin Vincentfbf1ead2010-09-29 19:46:32 +053020#include "devices-db5500.h"
21
Rabin Vincent591d8dd2010-05-03 08:46:51 +010022static struct map_desc u5500_io_desc[] __initdata = {
23 __IO_DEV_DESC(U5500_GPIO0_BASE, SZ_4K),
24 __IO_DEV_DESC(U5500_GPIO1_BASE, SZ_4K),
25 __IO_DEV_DESC(U5500_GPIO2_BASE, SZ_4K),
26 __IO_DEV_DESC(U5500_GPIO3_BASE, SZ_4K),
27 __IO_DEV_DESC(U5500_GPIO4_BASE, SZ_4K),
Linus Walleijd9e38042010-06-23 07:59:48 +010028 __IO_DEV_DESC(U5500_PRCMU_BASE, SZ_4K),
Rabin Vincent591d8dd2010-05-03 08:46:51 +010029};
30
Linus Walleij4d4a4b02010-09-27 22:09:52 +010031static struct resource mbox0_resources[] = {
32 {
33 .name = "mbox_peer",
34 .start = U5500_MBOX0_PEER_START,
35 .end = U5500_MBOX0_PEER_END,
36 .flags = IORESOURCE_MEM,
37 },
38 {
39 .name = "mbox_local",
40 .start = U5500_MBOX0_LOCAL_START,
41 .end = U5500_MBOX0_LOCAL_END,
42 .flags = IORESOURCE_MEM,
43 },
44 {
45 .name = "mbox_irq",
46 .start = MBOX_PAIR0_VIRT_IRQ,
47 .end = MBOX_PAIR0_VIRT_IRQ,
48 .flags = IORESOURCE_IRQ,
49 }
50};
51
52static struct resource mbox1_resources[] = {
53 {
54 .name = "mbox_peer",
55 .start = U5500_MBOX1_PEER_START,
56 .end = U5500_MBOX1_PEER_END,
57 .flags = IORESOURCE_MEM,
58 },
59 {
60 .name = "mbox_local",
61 .start = U5500_MBOX1_LOCAL_START,
62 .end = U5500_MBOX1_LOCAL_END,
63 .flags = IORESOURCE_MEM,
64 },
65 {
66 .name = "mbox_irq",
67 .start = MBOX_PAIR1_VIRT_IRQ,
68 .end = MBOX_PAIR1_VIRT_IRQ,
69 .flags = IORESOURCE_IRQ,
70 }
71};
72
73static struct resource mbox2_resources[] = {
74 {
75 .name = "mbox_peer",
76 .start = U5500_MBOX2_PEER_START,
77 .end = U5500_MBOX2_PEER_END,
78 .flags = IORESOURCE_MEM,
79 },
80 {
81 .name = "mbox_local",
82 .start = U5500_MBOX2_LOCAL_START,
83 .end = U5500_MBOX2_LOCAL_END,
84 .flags = IORESOURCE_MEM,
85 },
86 {
87 .name = "mbox_irq",
88 .start = MBOX_PAIR2_VIRT_IRQ,
89 .end = MBOX_PAIR2_VIRT_IRQ,
90 .flags = IORESOURCE_IRQ,
91 }
92};
93
94static struct platform_device mbox0_device = {
95 .id = 0,
96 .name = "mbox",
97 .resource = mbox0_resources,
98 .num_resources = ARRAY_SIZE(mbox0_resources),
99};
100
101static struct platform_device mbox1_device = {
102 .id = 1,
103 .name = "mbox",
104 .resource = mbox1_resources,
105 .num_resources = ARRAY_SIZE(mbox1_resources),
106};
107
108static struct platform_device mbox2_device = {
109 .id = 2,
110 .name = "mbox",
111 .resource = mbox2_resources,
112 .num_resources = ARRAY_SIZE(mbox2_resources),
113};
114
Rabin Vincent591d8dd2010-05-03 08:46:51 +0100115static struct platform_device *u5500_platform_devs[] __initdata = {
116 &u5500_gpio_devs[0],
117 &u5500_gpio_devs[1],
118 &u5500_gpio_devs[2],
119 &u5500_gpio_devs[3],
120 &u5500_gpio_devs[4],
121 &u5500_gpio_devs[5],
122 &u5500_gpio_devs[6],
123 &u5500_gpio_devs[7],
Linus Walleij4d4a4b02010-09-27 22:09:52 +0100124 &mbox0_device,
125 &mbox1_device,
126 &mbox2_device,
Rabin Vincent591d8dd2010-05-03 08:46:51 +0100127};
128
129void __init u5500_map_io(void)
130{
131 ux500_map_io();
132
133 iotable_init(u5500_io_desc, ARRAY_SIZE(u5500_io_desc));
134}
135
136void __init u5500_init_devices(void)
137{
Rabin Vincentfbf1ead2010-09-29 19:46:32 +0530138 db5500_add_rtc();
Rabin Vincent591d8dd2010-05-03 08:46:51 +0100139
140 platform_add_devices(u5500_platform_devs,
141 ARRAY_SIZE(u5500_platform_devs));
142}