diff options
Diffstat (limited to 'arch/arm/mach-ux500/devices.c')
-rw-r--r-- | arch/arm/mach-ux500/devices.c | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/arch/arm/mach-ux500/devices.c b/arch/arm/mach-ux500/devices.c new file mode 100644 index 000000000000..8a268893cb7f --- /dev/null +++ b/arch/arm/mach-ux500/devices.c | |||
@@ -0,0 +1,88 @@ | |||
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/kernel.h> | ||
9 | #include <linux/platform_device.h> | ||
10 | #include <linux/interrupt.h> | ||
11 | #include <linux/io.h> | ||
12 | #include <linux/amba/bus.h> | ||
13 | |||
14 | #include <mach/hardware.h> | ||
15 | #include <mach/setup.h> | ||
16 | |||
17 | #define __MEM_4K_RESOURCE(x) \ | ||
18 | .res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM} | ||
19 | |||
20 | struct amba_device ux500_pl031_device = { | ||
21 | .dev = { | ||
22 | .init_name = "pl031", | ||
23 | }, | ||
24 | .res = { | ||
25 | .start = UX500_RTC_BASE, | ||
26 | .end = UX500_RTC_BASE + SZ_4K - 1, | ||
27 | .flags = IORESOURCE_MEM, | ||
28 | }, | ||
29 | .irq = {IRQ_RTC_RTT, NO_IRQ}, | ||
30 | }; | ||
31 | |||
32 | struct amba_device ux500_uart0_device = { | ||
33 | .dev = { .init_name = "uart0" }, | ||
34 | __MEM_4K_RESOURCE(UX500_UART0_BASE), | ||
35 | .irq = {IRQ_UART0, NO_IRQ}, | ||
36 | }; | ||
37 | |||
38 | struct amba_device ux500_uart1_device = { | ||
39 | .dev = { .init_name = "uart1" }, | ||
40 | __MEM_4K_RESOURCE(UX500_UART1_BASE), | ||
41 | .irq = {IRQ_UART1, NO_IRQ}, | ||
42 | }; | ||
43 | |||
44 | struct amba_device ux500_uart2_device = { | ||
45 | .dev = { .init_name = "uart2" }, | ||
46 | __MEM_4K_RESOURCE(UX500_UART2_BASE), | ||
47 | .irq = {IRQ_UART2, NO_IRQ}, | ||
48 | }; | ||
49 | |||
50 | #define UX500_I2C_RESOURCES(id, size) \ | ||
51 | static struct resource ux500_i2c##id##_resources[] = { \ | ||
52 | [0] = { \ | ||
53 | .start = UX500_I2C##id##_BASE, \ | ||
54 | .end = UX500_I2C##id##_BASE + size - 1, \ | ||
55 | .flags = IORESOURCE_MEM, \ | ||
56 | }, \ | ||
57 | [1] = { \ | ||
58 | .start = IRQ_I2C##id, \ | ||
59 | .end = IRQ_I2C##id, \ | ||
60 | .flags = IORESOURCE_IRQ \ | ||
61 | } \ | ||
62 | } | ||
63 | |||
64 | UX500_I2C_RESOURCES(1, SZ_4K); | ||
65 | UX500_I2C_RESOURCES(2, SZ_4K); | ||
66 | UX500_I2C_RESOURCES(3, SZ_4K); | ||
67 | |||
68 | #define UX500_I2C_PDEVICE(cid) \ | ||
69 | struct platform_device ux500_i2c##cid##_device = { \ | ||
70 | .name = "nmk-i2c", \ | ||
71 | .id = cid, \ | ||
72 | .num_resources = 2, \ | ||
73 | .resource = ux500_i2c##cid##_resources, \ | ||
74 | } | ||
75 | |||
76 | UX500_I2C_PDEVICE(1); | ||
77 | UX500_I2C_PDEVICE(2); | ||
78 | UX500_I2C_PDEVICE(3); | ||
79 | |||
80 | void __init amba_add_devices(struct amba_device *devs[], int num) | ||
81 | { | ||
82 | int i; | ||
83 | |||
84 | for (i = 0; i < num; i++) { | ||
85 | struct amba_device *d = devs[i]; | ||
86 | amba_device_register(d, &iomem_resource); | ||
87 | } | ||
88 | } | ||