Rabin Vincent | 591d8dd | 2010-05-03 08:46:51 +0100 | [diff] [blame] | 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> |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame^] | 11 | #include <linux/irq.h> |
Rabin Vincent | 591d8dd | 2010-05-03 08:46:51 +0100 | [diff] [blame] | 12 | |
| 13 | #include <asm/mach/map.h> |
| 14 | |
| 15 | #include <mach/hardware.h> |
| 16 | #include <mach/devices.h> |
| 17 | #include <mach/setup.h> |
Linus Walleij | 4d4a4b0 | 2010-09-27 22:09:52 +0100 | [diff] [blame] | 18 | #include <mach/irqs.h> |
Rabin Vincent | 591d8dd | 2010-05-03 08:46:51 +0100 | [diff] [blame] | 19 | |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame^] | 20 | #include "devices-db5500.h" |
| 21 | |
Rabin Vincent | 591d8dd | 2010-05-03 08:46:51 +0100 | [diff] [blame] | 22 | static 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 Walleij | d9e3804 | 2010-06-23 07:59:48 +0100 | [diff] [blame] | 28 | __IO_DEV_DESC(U5500_PRCMU_BASE, SZ_4K), |
Rabin Vincent | 591d8dd | 2010-05-03 08:46:51 +0100 | [diff] [blame] | 29 | }; |
| 30 | |
Linus Walleij | 4d4a4b0 | 2010-09-27 22:09:52 +0100 | [diff] [blame] | 31 | static 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 | |
| 52 | static 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 | |
| 73 | static 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 | |
| 94 | static struct platform_device mbox0_device = { |
| 95 | .id = 0, |
| 96 | .name = "mbox", |
| 97 | .resource = mbox0_resources, |
| 98 | .num_resources = ARRAY_SIZE(mbox0_resources), |
| 99 | }; |
| 100 | |
| 101 | static struct platform_device mbox1_device = { |
| 102 | .id = 1, |
| 103 | .name = "mbox", |
| 104 | .resource = mbox1_resources, |
| 105 | .num_resources = ARRAY_SIZE(mbox1_resources), |
| 106 | }; |
| 107 | |
| 108 | static 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 Vincent | 591d8dd | 2010-05-03 08:46:51 +0100 | [diff] [blame] | 115 | static 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 Walleij | 4d4a4b0 | 2010-09-27 22:09:52 +0100 | [diff] [blame] | 124 | &mbox0_device, |
| 125 | &mbox1_device, |
| 126 | &mbox2_device, |
Rabin Vincent | 591d8dd | 2010-05-03 08:46:51 +0100 | [diff] [blame] | 127 | }; |
| 128 | |
| 129 | void __init u5500_map_io(void) |
| 130 | { |
| 131 | ux500_map_io(); |
| 132 | |
| 133 | iotable_init(u5500_io_desc, ARRAY_SIZE(u5500_io_desc)); |
| 134 | } |
| 135 | |
| 136 | void __init u5500_init_devices(void) |
| 137 | { |
Rabin Vincent | fbf1ead | 2010-09-29 19:46:32 +0530 | [diff] [blame^] | 138 | db5500_add_rtc(); |
Rabin Vincent | 591d8dd | 2010-05-03 08:46:51 +0100 | [diff] [blame] | 139 | |
| 140 | platform_add_devices(u5500_platform_devs, |
| 141 | ARRAY_SIZE(u5500_platform_devs)); |
| 142 | } |