aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2016-06-24 06:49:57 -0400
committerShawn Guo <shawnguo@kernel.org>2016-06-27 22:26:34 -0400
commitc9ee94965dce7b66964c5f0b0db892055757d608 (patch)
tree9172521013d3755639b67c458f373db701e7f81a
parent6f98cb22e4089c3eb63ff86fac010291a0e30241 (diff)
ARM: imx: deconstruct mxc_rnga initialization
The rnga platform device is initialized for all imx31 machines from its own initcall, but is never initialized anywhere else. This moves the platform device creation into both the imx31 dt and non-dt machine init sequences, which has basically the exact same effect as before, but makes it more obvious what is going on, while reducing the amount of code and removing the last user of cpu_is_mx31(). Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
-rw-r--r--arch/arm/mach-imx/Kconfig4
-rw-r--r--arch/arm/mach-imx/devices/Kconfig4
-rw-r--r--arch/arm/mach-imx/devices/platform-mxc_rnga.c53
-rw-r--r--arch/arm/mach-imx/imx31-dt.c12
-rw-r--r--arch/arm/mach-imx/mm-imx3.c6
5 files changed, 18 insertions, 61 deletions
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index dd905b9602a0..7816321d7a99 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -44,9 +44,6 @@ config MXC_USE_EPIT
44 uses the same clocks as the GPT. Anyway, on some systems the GPT 44 uses the same clocks as the GPT. Anyway, on some systems the GPT
45 may be in use for other purposes. 45 may be in use for other purposes.
46 46
47config ARCH_HAS_RNGA
48 bool
49
50config HAVE_IMX_ANATOP 47config HAVE_IMX_ANATOP
51 bool 48 bool
52 49
@@ -90,7 +87,6 @@ config SOC_IMX27
90config SOC_IMX31 87config SOC_IMX31
91 bool 88 bool
92 select CPU_V6 89 select CPU_V6
93 select IMX_HAVE_PLATFORM_MXC_RNGA
94 select MXC_AVIC 90 select MXC_AVIC
95 select SMP_ON_UP if SMP 91 select SMP_ON_UP if SMP
96 92
diff --git a/arch/arm/mach-imx/devices/Kconfig b/arch/arm/mach-imx/devices/Kconfig
index 3a552989248e..6ffe57267233 100644
--- a/arch/arm/mach-imx/devices/Kconfig
+++ b/arch/arm/mach-imx/devices/Kconfig
@@ -57,10 +57,6 @@ config IMX_HAVE_PLATFORM_MXC_MMC
57config IMX_HAVE_PLATFORM_MXC_NAND 57config IMX_HAVE_PLATFORM_MXC_NAND
58 bool 58 bool
59 59
60config IMX_HAVE_PLATFORM_MXC_RNGA
61 bool
62 select ARCH_HAS_RNGA
63
64config IMX_HAVE_PLATFORM_MXC_RTC 60config IMX_HAVE_PLATFORM_MXC_RTC
65 bool 61 bool
66 62
diff --git a/arch/arm/mach-imx/devices/platform-mxc_rnga.c b/arch/arm/mach-imx/devices/platform-mxc_rnga.c
deleted file mode 100644
index 851fbc8af7a9..000000000000
--- a/arch/arm/mach-imx/devices/platform-mxc_rnga.c
+++ /dev/null
@@ -1,53 +0,0 @@
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 "../hardware.h"
10#include "devices-common.h"
11
12struct 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
22static 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
26static 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
40static 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 return PTR_ERR_OR_ZERO(ret);
52}
53arch_initcall(imxXX_add_mxc_rnga);
diff --git a/arch/arm/mach-imx/imx31-dt.c b/arch/arm/mach-imx/imx31-dt.c
index 32100222a017..62e6b4fb5370 100644
--- a/arch/arm/mach-imx/imx31-dt.c
+++ b/arch/arm/mach-imx/imx31-dt.c
@@ -28,10 +28,22 @@ static void __init imx31_dt_timer_init(void)
28 mx31_clocks_init_dt(); 28 mx31_clocks_init_dt();
29} 29}
30 30
31/* FIXME: replace with DT binding */
32static const struct resource imx31_rnga_res[] __initconst = {
33 DEFINE_RES_MEM(MX31_RNGA_BASE_ADDR, SZ_16K),
34};
35
36static void __init imx31_dt_mach_init(void)
37{
38 platform_device_register_simple("mxc_rnga", -1, imx31_rnga_res,
39 ARRAY_SIZE(imx31_rnga_res));
40}
41
31DT_MACHINE_START(IMX31_DT, "Freescale i.MX31 (Device Tree Support)") 42DT_MACHINE_START(IMX31_DT, "Freescale i.MX31 (Device Tree Support)")
32 .map_io = mx31_map_io, 43 .map_io = mx31_map_io,
33 .init_early = imx31_init_early, 44 .init_early = imx31_init_early,
34 .init_irq = mx31_init_irq, 45 .init_irq = mx31_init_irq,
35 .init_time = imx31_dt_timer_init, 46 .init_time = imx31_dt_timer_init,
47 .init_machine = imx31_dt_mach_init,
36 .dt_compat = imx31_dt_board_compat, 48 .dt_compat = imx31_dt_board_compat,
37MACHINE_END 49MACHINE_END
diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c
index 0884ca90d15a..3b135cd4b043 100644
--- a/arch/arm/mach-imx/mm-imx3.c
+++ b/arch/arm/mach-imx/mm-imx3.c
@@ -167,6 +167,10 @@ static const struct resource imx31_audmux_res[] __initconst = {
167 DEFINE_RES_MEM(MX31_AUDMUX_BASE_ADDR, SZ_16K), 167 DEFINE_RES_MEM(MX31_AUDMUX_BASE_ADDR, SZ_16K),
168}; 168};
169 169
170static const struct resource imx31_rnga_res[] __initconst = {
171 DEFINE_RES_MEM(MX31_RNGA_BASE_ADDR, SZ_16K),
172};
173
170void __init imx31_soc_init(void) 174void __init imx31_soc_init(void)
171{ 175{
172 int to_version = mx31_revision() >> 4; 176 int to_version = mx31_revision() >> 4;
@@ -195,6 +199,8 @@ void __init imx31_soc_init(void)
195 199
196 platform_device_register_simple("imx31-audmux", 0, imx31_audmux_res, 200 platform_device_register_simple("imx31-audmux", 0, imx31_audmux_res,
197 ARRAY_SIZE(imx31_audmux_res)); 201 ARRAY_SIZE(imx31_audmux_res));
202 platform_device_register_simple("mxc_rnga", -1, imx31_rnga_res,
203 ARRAY_SIZE(imx31_rnga_res));
198} 204}
199#endif /* ifdef CONFIG_SOC_IMX31 */ 205#endif /* ifdef CONFIG_SOC_IMX31 */
200 206