diff options
author | Shawn Guo <shawn.guo@freescale.com> | 2010-12-09 10:12:46 -0500 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-12-20 11:30:24 -0500 |
commit | dc38ad4052a50b9e73fdcc970ecdd4f69ee9d97a (patch) | |
tree | ec28c5e9afacaca46ee2ab96cbef939eefe254bc /arch/arm/mach-mxs/devices | |
parent | faff3dc947738ce7c905a4a2936a089d3fa9ddda (diff) |
ARM: mxs: Dynamically allocate duart devices
Dynamically allocate duart devices for MX23 and MX28.
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mxs/devices')
-rw-r--r-- | arch/arm/mach-mxs/devices/platform-duart.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/arch/arm/mach-mxs/devices/platform-duart.c b/arch/arm/mach-mxs/devices/platform-duart.c new file mode 100644 index 000000000000..2fe0df5b0aad --- /dev/null +++ b/arch/arm/mach-mxs/devices/platform-duart.c | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009-2010 Pengutronix | ||
3 | * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> | ||
4 | * | ||
5 | * Copyright 2010 Freescale Semiconductor, Inc. All Rights Reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it under | ||
8 | * the terms of the GNU General Public License version 2 as published by the | ||
9 | * Free Software Foundation. | ||
10 | */ | ||
11 | #include <mach/mx23.h> | ||
12 | #include <mach/mx28.h> | ||
13 | #include <mach/devices-common.h> | ||
14 | |||
15 | #define mxs_duart_data_entry(soc) \ | ||
16 | { \ | ||
17 | .iobase = soc ## _DUART_BASE_ADDR, \ | ||
18 | .irq = soc ## _INT_DUART, \ | ||
19 | } | ||
20 | |||
21 | #ifdef CONFIG_SOC_IMX23 | ||
22 | const struct mxs_duart_data mx23_duart_data __initconst = | ||
23 | mxs_duart_data_entry(MX23); | ||
24 | #endif | ||
25 | |||
26 | #ifdef CONFIG_SOC_IMX28 | ||
27 | const struct mxs_duart_data mx28_duart_data __initconst = | ||
28 | mxs_duart_data_entry(MX28); | ||
29 | #endif | ||
30 | |||
31 | struct platform_device *__init mxs_add_duart( | ||
32 | const struct mxs_duart_data *data) | ||
33 | { | ||
34 | struct resource res[] = { | ||
35 | { | ||
36 | .start = data->iobase, | ||
37 | .end = data->iobase + SZ_8K - 1, | ||
38 | .flags = IORESOURCE_MEM, | ||
39 | }, { | ||
40 | .start = data->irq, | ||
41 | .end = data->irq, | ||
42 | .flags = IORESOURCE_IRQ, | ||
43 | }, | ||
44 | }; | ||
45 | |||
46 | return mxs_add_platform_device("mxs-duart", 0, res, ARRAY_SIZE(res), | ||
47 | NULL, 0); | ||
48 | } | ||