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 
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 
imx_add_mxc_rnga(const struct imx_mxc_rnga_data * data)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 
imxXX_add_mxc_rnga(void)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 	return PTR_ERR_OR_ZERO(ret);
52 }
53 arch_initcall(imxXX_add_mxc_rnga);
54