diff options
Diffstat (limited to 'arch/arm/mach-mxs/devices/platform-auart.c')
-rw-r--r-- | arch/arm/mach-mxs/devices/platform-auart.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/arch/arm/mach-mxs/devices/platform-auart.c b/arch/arm/mach-mxs/devices/platform-auart.c new file mode 100644 index 000000000000..796606cce0ce --- /dev/null +++ b/arch/arm/mach-mxs/devices/platform-auart.c | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Pengutronix | ||
3 | * Sascha Hauer <s.hauer@pengutronix.de> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it under | ||
6 | * the terms of the GNU General Public License version 2 as published by the | ||
7 | * Free Software Foundation. | ||
8 | */ | ||
9 | #include <asm/sizes.h> | ||
10 | #include <mach/mx23.h> | ||
11 | #include <mach/mx28.h> | ||
12 | #include <mach/devices-common.h> | ||
13 | |||
14 | #define mxs_auart_data_entry_single(soc, _id, hwid) \ | ||
15 | { \ | ||
16 | .id = _id, \ | ||
17 | .iobase = soc ## _AUART ## hwid ## _BASE_ADDR, \ | ||
18 | .irq = soc ## _INT_AUART ## hwid, \ | ||
19 | } | ||
20 | |||
21 | #define mxs_auart_data_entry(soc, _id, hwid) \ | ||
22 | [_id] = mxs_auart_data_entry_single(soc, _id, hwid) | ||
23 | |||
24 | #ifdef CONFIG_SOC_IMX23 | ||
25 | const struct mxs_auart_data mx23_auart_data[] __initconst = { | ||
26 | #define mx23_auart_data_entry(_id, hwid) \ | ||
27 | mxs_auart_data_entry(MX23, _id, hwid) | ||
28 | mx23_auart_data_entry(0, 1), | ||
29 | mx23_auart_data_entry(1, 2), | ||
30 | }; | ||
31 | #endif | ||
32 | |||
33 | #ifdef CONFIG_SOC_IMX28 | ||
34 | const struct mxs_auart_data mx28_auart_data[] __initconst = { | ||
35 | #define mx28_auart_data_entry(_id) \ | ||
36 | mxs_auart_data_entry(MX28, _id, _id) | ||
37 | mx28_auart_data_entry(0), | ||
38 | mx28_auart_data_entry(1), | ||
39 | mx28_auart_data_entry(2), | ||
40 | mx28_auart_data_entry(3), | ||
41 | mx28_auart_data_entry(4), | ||
42 | }; | ||
43 | #endif | ||
44 | |||
45 | struct platform_device *__init mxs_add_auart( | ||
46 | const struct mxs_auart_data *data) | ||
47 | { | ||
48 | struct resource res[] = { | ||
49 | { | ||
50 | .start = data->iobase, | ||
51 | .end = data->iobase + SZ_8K - 1, | ||
52 | .flags = IORESOURCE_MEM, | ||
53 | }, { | ||
54 | .start = data->irq, | ||
55 | .end = data->irq, | ||
56 | .flags = IORESOURCE_IRQ, | ||
57 | }, | ||
58 | }; | ||
59 | |||
60 | return mxs_add_platform_device_dmamask("mxs-auart", data->id, | ||
61 | res, ARRAY_SIZE(res), NULL, 0, | ||
62 | DMA_BIT_MASK(32)); | ||
63 | } | ||
64 | |||