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_uart_io_desc[] __initdata = {
25 __IO_DEV_DESC(U5500_UART0_BASE, SZ_4K),
26 __IO_DEV_DESC(U5500_UART2_BASE, SZ_4K),
29 static struct map_desc u5500_io_desc[] __initdata = {
30 __IO_DEV_DESC(U5500_GIC_CPU_BASE, SZ_4K),
31 __IO_DEV_DESC(U5500_GIC_DIST_BASE, SZ_4K),
32 __IO_DEV_DESC(U5500_L2CC_BASE, SZ_4K),
33 __IO_DEV_DESC(U5500_TWD_BASE, SZ_4K),
34 __IO_DEV_DESC(U5500_MTU0_BASE, SZ_4K),
35 __IO_DEV_DESC(U5500_SCU_BASE, SZ_4K),
36 __IO_DEV_DESC(U5500_BACKUPRAM0_BASE, SZ_8K),
38 __IO_DEV_DESC(U5500_GPIO0_BASE, SZ_4K),
39 __IO_DEV_DESC(U5500_GPIO1_BASE, SZ_4K),
40 __IO_DEV_DESC(U5500_GPIO2_BASE, SZ_4K),
41 __IO_DEV_DESC(U5500_GPIO3_BASE, SZ_4K),
42 __IO_DEV_DESC(U5500_GPIO4_BASE, SZ_4K),
43 __IO_DEV_DESC(U5500_PRCMU_BASE, SZ_4K),
46 static struct resource mbox0_resources[] = {
49 .start = U5500_MBOX0_PEER_START,
50 .end = U5500_MBOX0_PEER_END,
51 .flags = IORESOURCE_MEM,
55 .start = U5500_MBOX0_LOCAL_START,
56 .end = U5500_MBOX0_LOCAL_END,
57 .flags = IORESOURCE_MEM,
61 .start = MBOX_PAIR0_VIRT_IRQ,
62 .end = MBOX_PAIR0_VIRT_IRQ,
63 .flags = IORESOURCE_IRQ,
67 static struct resource mbox1_resources[] = {
70 .start = U5500_MBOX1_PEER_START,
71 .end = U5500_MBOX1_PEER_END,
72 .flags = IORESOURCE_MEM,
76 .start = U5500_MBOX1_LOCAL_START,
77 .end = U5500_MBOX1_LOCAL_END,
78 .flags = IORESOURCE_MEM,
82 .start = MBOX_PAIR1_VIRT_IRQ,
83 .end = MBOX_PAIR1_VIRT_IRQ,
84 .flags = IORESOURCE_IRQ,
88 static struct resource mbox2_resources[] = {
91 .start = U5500_MBOX2_PEER_START,
92 .end = U5500_MBOX2_PEER_END,
93 .flags = IORESOURCE_MEM,
97 .start = U5500_MBOX2_LOCAL_START,
98 .end = U5500_MBOX2_LOCAL_END,
99 .flags = IORESOURCE_MEM,
103 .start = MBOX_PAIR2_VIRT_IRQ,
104 .end = MBOX_PAIR2_VIRT_IRQ,
105 .flags = IORESOURCE_IRQ,
109 static struct platform_device mbox0_device = {
112 .resource = mbox0_resources,
113 .num_resources = ARRAY_SIZE(mbox0_resources),
116 static struct platform_device mbox1_device = {
119 .resource = mbox1_resources,
120 .num_resources = ARRAY_SIZE(mbox1_resources),
123 static struct platform_device mbox2_device = {
126 .resource = mbox2_resources,
127 .num_resources = ARRAY_SIZE(mbox2_resources),
130 static struct platform_device *u5500_platform_devs[] __initdata = {
136 static resource_size_t __initdata db5500_gpio_base[] = {
137 U5500_GPIOBANK0_BASE,
138 U5500_GPIOBANK1_BASE,
139 U5500_GPIOBANK2_BASE,
140 U5500_GPIOBANK3_BASE,
141 U5500_GPIOBANK4_BASE,
142 U5500_GPIOBANK5_BASE,
143 U5500_GPIOBANK6_BASE,
144 U5500_GPIOBANK7_BASE,
147 static void __init db5500_add_gpios(void)
149 struct nmk_gpio_platform_data pdata = {
150 /* No custom data yet */
153 dbx500_add_gpios(ARRAY_AND_SIZE(db5500_gpio_base),
154 IRQ_DB5500_GPIO0, &pdata);
157 void __init u5500_map_io(void)
160 * Map the UARTs early so that the DEBUG_LL stuff continues to work.
162 iotable_init(u5500_uart_io_desc, ARRAY_SIZE(u5500_uart_io_desc));
166 iotable_init(u5500_io_desc, ARRAY_SIZE(u5500_io_desc));
169 void __init u5500_init_devices(void)
175 platform_add_devices(u5500_platform_devs,
176 ARRAY_SIZE(u5500_platform_devs));