2 * Copyright (C) ST-Ericsson SA 2010
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
5 * License terms: GNU General Public License (GPL) version 2
8 #include <linux/platform_device.h>
9 #include <linux/amba/bus.h>
11 #include <linux/irq.h>
13 #include <asm/mach/map.h>
15 #include <plat/gpio.h>
17 #include <mach/hardware.h>
18 #include <mach/devices.h>
19 #include <mach/setup.h>
20 #include <mach/irqs.h>
22 #include "devices-db5500.h"
24 static struct map_desc u5500_io_desc[] __initdata = {
25 __IO_DEV_DESC(U5500_GPIO0_BASE, SZ_4K),
26 __IO_DEV_DESC(U5500_GPIO1_BASE, SZ_4K),
27 __IO_DEV_DESC(U5500_GPIO2_BASE, SZ_4K),
28 __IO_DEV_DESC(U5500_GPIO3_BASE, SZ_4K),
29 __IO_DEV_DESC(U5500_GPIO4_BASE, SZ_4K),
30 __IO_DEV_DESC(U5500_PRCMU_BASE, SZ_4K),
33 static struct resource mbox0_resources[] = {
36 .start = U5500_MBOX0_PEER_START,
37 .end = U5500_MBOX0_PEER_END,
38 .flags = IORESOURCE_MEM,
42 .start = U5500_MBOX0_LOCAL_START,
43 .end = U5500_MBOX0_LOCAL_END,
44 .flags = IORESOURCE_MEM,
48 .start = MBOX_PAIR0_VIRT_IRQ,
49 .end = MBOX_PAIR0_VIRT_IRQ,
50 .flags = IORESOURCE_IRQ,
54 static struct resource mbox1_resources[] = {
57 .start = U5500_MBOX1_PEER_START,
58 .end = U5500_MBOX1_PEER_END,
59 .flags = IORESOURCE_MEM,
63 .start = U5500_MBOX1_LOCAL_START,
64 .end = U5500_MBOX1_LOCAL_END,
65 .flags = IORESOURCE_MEM,
69 .start = MBOX_PAIR1_VIRT_IRQ,
70 .end = MBOX_PAIR1_VIRT_IRQ,
71 .flags = IORESOURCE_IRQ,
75 static struct resource mbox2_resources[] = {
78 .start = U5500_MBOX2_PEER_START,
79 .end = U5500_MBOX2_PEER_END,
80 .flags = IORESOURCE_MEM,
84 .start = U5500_MBOX2_LOCAL_START,
85 .end = U5500_MBOX2_LOCAL_END,
86 .flags = IORESOURCE_MEM,
90 .start = MBOX_PAIR2_VIRT_IRQ,
91 .end = MBOX_PAIR2_VIRT_IRQ,
92 .flags = IORESOURCE_IRQ,
96 static struct platform_device mbox0_device = {
99 .resource = mbox0_resources,
100 .num_resources = ARRAY_SIZE(mbox0_resources),
103 static struct platform_device mbox1_device = {
106 .resource = mbox1_resources,
107 .num_resources = ARRAY_SIZE(mbox1_resources),
110 static struct platform_device mbox2_device = {
113 .resource = mbox2_resources,
114 .num_resources = ARRAY_SIZE(mbox2_resources),
117 static struct platform_device *u5500_platform_devs[] __initdata = {
123 static resource_size_t __initdata db5500_gpio_base[] = {
124 U5500_GPIOBANK0_BASE,
125 U5500_GPIOBANK1_BASE,
126 U5500_GPIOBANK2_BASE,
127 U5500_GPIOBANK3_BASE,
128 U5500_GPIOBANK4_BASE,
129 U5500_GPIOBANK5_BASE,
130 U5500_GPIOBANK6_BASE,
131 U5500_GPIOBANK7_BASE,
134 static void __init db5500_add_gpios(void)
136 struct nmk_gpio_platform_data pdata = {
137 /* No custom data yet */
140 dbx500_add_gpios(ARRAY_AND_SIZE(db5500_gpio_base),
141 IRQ_DB5500_GPIO0, &pdata);
144 void __init u5500_map_io(void)
148 iotable_init(u5500_io_desc, ARRAY_SIZE(u5500_io_desc));
151 void __init u5500_init_devices(void)
157 platform_add_devices(u5500_platform_devs,
158 ARRAY_SIZE(u5500_platform_devs));