• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright (C) 2010-2011 Pengutronix
4  * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
5  */
6 #include "../hardware.h"
7 #include "devices-common.h"
8 
9 #define imx_mxc_rtc_data_entry_single(soc, _devid)			\
10 	{								\
11 		.devid = _devid,					\
12 		.iobase = soc ## _RTC_BASE_ADDR,			\
13 		.irq = soc ## _INT_RTC,					\
14 	}
15 
16 #ifdef CONFIG_SOC_IMX31
17 const struct imx_mxc_rtc_data imx31_mxc_rtc_data __initconst =
18 	imx_mxc_rtc_data_entry_single(MX31, "imx21-rtc");
19 #endif /* ifdef CONFIG_SOC_IMX31 */
20 
21 #ifdef CONFIG_SOC_IMX35
22 const struct imx_mxc_rtc_data imx35_mxc_rtc_data __initconst =
23 	imx_mxc_rtc_data_entry_single(MX35, "imx21-rtc");
24 #endif /* ifdef CONFIG_SOC_IMX35 */
25 
imx_add_mxc_rtc(const struct imx_mxc_rtc_data * data)26 struct platform_device *__init imx_add_mxc_rtc(
27 		const struct imx_mxc_rtc_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 			.start = data->irq,
36 			.end = data->irq,
37 			.flags = IORESOURCE_IRQ,
38 		},
39 	};
40 
41 	return imx_add_platform_device(data->devid, -1,
42 			res, ARRAY_SIZE(res), NULL, 0);
43 }
44