diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-11-12 05:49:34 -0500 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-11-19 15:54:35 -0500 |
commit | fed3d35b06bf3f6a3383c2637d054823c563200b (patch) | |
tree | a787cffeb9f3b82d5be819a69e7eaec53e152e0b /arch/arm/plat-mxc/devices | |
parent | 6a697e3d310d79ea0e385975c57084ce22b04b36 (diff) |
ARM: mx3: dynamically allocate mxc_rnga devices
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'arch/arm/plat-mxc/devices')
-rw-r--r-- | arch/arm/plat-mxc/devices/Kconfig | 4 | ||||
-rw-r--r-- | arch/arm/plat-mxc/devices/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/plat-mxc/devices/platform-mxc_rnga.c | 56 |
3 files changed, 61 insertions, 0 deletions
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig index 1be447638a92..f34c13998cbc 100644 --- a/arch/arm/plat-mxc/devices/Kconfig +++ b/arch/arm/plat-mxc/devices/Kconfig | |||
@@ -62,6 +62,10 @@ config IMX_HAVE_PLATFORM_MXC_NAND | |||
62 | config IMX_HAVE_PLATFORM_MXC_PWM | 62 | config IMX_HAVE_PLATFORM_MXC_PWM |
63 | bool | 63 | bool |
64 | 64 | ||
65 | config IMX_HAVE_PLATFORM_MXC_RNGA | ||
66 | bool | ||
67 | select ARCH_HAS_RNGA | ||
68 | |||
65 | config IMX_HAVE_PLATFORM_MXC_W1 | 69 | config IMX_HAVE_PLATFORM_MXC_W1 |
66 | bool | 70 | bool |
67 | 71 | ||
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile index f1c3767d29d1..91fdd6c58b5b 100644 --- a/arch/arm/plat-mxc/devices/Makefile +++ b/arch/arm/plat-mxc/devices/Makefile | |||
@@ -19,5 +19,6 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_EHCI) += platform-mxc-ehci.o | |||
19 | obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_MMC) += platform-mxc-mmc.o | 19 | obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_MMC) += platform-mxc-mmc.o |
20 | obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o | 20 | obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o |
21 | obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_PWM) += platform-mxc_pwm.o | 21 | obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_PWM) += platform-mxc_pwm.o |
22 | obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_RNGA) += platform-mxc_rnga.o | ||
22 | obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o | 23 | obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o |
23 | obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o | 24 | obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o |
diff --git a/arch/arm/plat-mxc/devices/platform-mxc_rnga.c b/arch/arm/plat-mxc/devices/platform-mxc_rnga.c new file mode 100644 index 000000000000..b4b7612b6e17 --- /dev/null +++ b/arch/arm/plat-mxc/devices/platform-mxc_rnga.c | |||
@@ -0,0 +1,56 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Pengutronix | ||
3 | * Uwe Kleine-Koenig <u.kleine-koenig@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 <mach/hardware.h> | ||
10 | #include <mach/devices-common.h> | ||
11 | |||
12 | struct imx_mxc_rnga_data { | ||
13 | resource_size_t iobase; | ||
14 | }; | ||
15 | |||
16 | #define imx_mxc_rnga_data_entry_single(soc) \ | ||
17 | { \ | ||
18 | .iobase = soc ## _RNGA_BASE_ADDR, \ | ||
19 | } | ||
20 | |||
21 | #ifdef CONFIG_SOC_IMX31 | ||
22 | static const struct imx_mxc_rnga_data imx31_mxc_rnga_data __initconst = | ||
23 | imx_mxc_rnga_data_entry_single(MX31); | ||
24 | #endif /* ifdef CONFIG_SOC_IMX31 */ | ||
25 | |||
26 | static struct platform_device *__init imx_add_mxc_rnga( | ||
27 | const struct imx_mxc_rnga_data *data) | ||
28 | { | ||
29 | struct resource res[] = { | ||
30 | { | ||
31 | .start = data->iobase, | ||
32 | .end = data->iobase + SZ_16K - 1, | ||
33 | .flags = IORESOURCE_MEM, | ||
34 | }, | ||
35 | }; | ||
36 | return imx_add_platform_device("mxc_rnga", -1, | ||
37 | res, ARRAY_SIZE(res), NULL, 0); | ||
38 | } | ||
39 | |||
40 | static int __init imxXX_add_mxc_rnga(void) | ||
41 | { | ||
42 | struct platform_device *ret; | ||
43 | |||
44 | #if defined(CONFIG_SOC_IMX31) | ||
45 | if (cpu_is_mx31()) | ||
46 | ret = imx_add_mxc_rnga(&imx31_mxc_rnga_data); | ||
47 | else | ||
48 | #endif /* if defined(CONFIG_SOC_IMX31) */ | ||
49 | ret = ERR_PTR(-ENODEV); | ||
50 | |||
51 | if (IS_ERR(ret)) | ||
52 | return PTR_ERR(ret); | ||
53 | |||
54 | return 0; | ||
55 | } | ||
56 | arch_initcall(imxXX_add_mxc_rnga); | ||