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_UART0_BASE
, SZ_4K
),
26 __IO_DEV_DESC(U5500_UART2_BASE
, SZ_4K
),
27 __IO_DEV_DESC(U5500_GIC_CPU_BASE
, SZ_4K
),
28 __IO_DEV_DESC(U5500_GIC_DIST_BASE
, SZ_4K
),
29 __IO_DEV_DESC(U5500_L2CC_BASE
, SZ_4K
),
30 __IO_DEV_DESC(U5500_TWD_BASE
, SZ_4K
),
31 __IO_DEV_DESC(U5500_MTU0_BASE
, SZ_4K
),
32 __IO_DEV_DESC(U5500_SCU_BASE
, SZ_4K
),
33 __IO_DEV_DESC(U5500_BACKUPRAM0_BASE
, SZ_8K
),
35 __IO_DEV_DESC(U5500_GPIO0_BASE
, SZ_4K
),
36 __IO_DEV_DESC(U5500_GPIO1_BASE
, SZ_4K
),
37 __IO_DEV_DESC(U5500_GPIO2_BASE
, SZ_4K
),
38 __IO_DEV_DESC(U5500_GPIO3_BASE
, SZ_4K
),
39 __IO_DEV_DESC(U5500_GPIO4_BASE
, SZ_4K
),
40 __IO_DEV_DESC(U5500_PRCMU_BASE
, SZ_4K
),
43 static struct resource mbox0_resources
[] = {
46 .start
= U5500_MBOX0_PEER_START
,
47 .end
= U5500_MBOX0_PEER_END
,
48 .flags
= IORESOURCE_MEM
,
52 .start
= U5500_MBOX0_LOCAL_START
,
53 .end
= U5500_MBOX0_LOCAL_END
,
54 .flags
= IORESOURCE_MEM
,
58 .start
= MBOX_PAIR0_VIRT_IRQ
,
59 .end
= MBOX_PAIR0_VIRT_IRQ
,
60 .flags
= IORESOURCE_IRQ
,
64 static struct resource mbox1_resources
[] = {
67 .start
= U5500_MBOX1_PEER_START
,
68 .end
= U5500_MBOX1_PEER_END
,
69 .flags
= IORESOURCE_MEM
,
73 .start
= U5500_MBOX1_LOCAL_START
,
74 .end
= U5500_MBOX1_LOCAL_END
,
75 .flags
= IORESOURCE_MEM
,
79 .start
= MBOX_PAIR1_VIRT_IRQ
,
80 .end
= MBOX_PAIR1_VIRT_IRQ
,
81 .flags
= IORESOURCE_IRQ
,
85 static struct resource mbox2_resources
[] = {
88 .start
= U5500_MBOX2_PEER_START
,
89 .end
= U5500_MBOX2_PEER_END
,
90 .flags
= IORESOURCE_MEM
,
94 .start
= U5500_MBOX2_LOCAL_START
,
95 .end
= U5500_MBOX2_LOCAL_END
,
96 .flags
= IORESOURCE_MEM
,
100 .start
= MBOX_PAIR2_VIRT_IRQ
,
101 .end
= MBOX_PAIR2_VIRT_IRQ
,
102 .flags
= IORESOURCE_IRQ
,
106 static struct platform_device mbox0_device
= {
109 .resource
= mbox0_resources
,
110 .num_resources
= ARRAY_SIZE(mbox0_resources
),
113 static struct platform_device mbox1_device
= {
116 .resource
= mbox1_resources
,
117 .num_resources
= ARRAY_SIZE(mbox1_resources
),
120 static struct platform_device mbox2_device
= {
123 .resource
= mbox2_resources
,
124 .num_resources
= ARRAY_SIZE(mbox2_resources
),
127 static struct platform_device
*u5500_platform_devs
[] __initdata
= {
133 static resource_size_t __initdata db5500_gpio_base
[] = {
134 U5500_GPIOBANK0_BASE
,
135 U5500_GPIOBANK1_BASE
,
136 U5500_GPIOBANK2_BASE
,
137 U5500_GPIOBANK3_BASE
,
138 U5500_GPIOBANK4_BASE
,
139 U5500_GPIOBANK5_BASE
,
140 U5500_GPIOBANK6_BASE
,
141 U5500_GPIOBANK7_BASE
,
144 static void __init
db5500_add_gpios(void)
146 struct nmk_gpio_platform_data pdata
= {
147 /* No custom data yet */
150 dbx500_add_gpios(ARRAY_AND_SIZE(db5500_gpio_base
),
151 IRQ_DB5500_GPIO0
, &pdata
);
154 void __init
u5500_map_io(void)
156 iotable_init(u5500_io_desc
, ARRAY_SIZE(u5500_io_desc
));
159 void __init
u5500_init_devices(void)
165 platform_add_devices(u5500_platform_devs
,
166 ARRAY_SIZE(u5500_platform_devs
));