1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright (C) 2010 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_w1_data_entry_single(soc)				\
10 	{								\
11 		.iobase = soc ## _OWIRE_BASE_ADDR,			\
12 	}
13 
14 #ifdef CONFIG_SOC_IMX21
15 const struct imx_mxc_w1_data imx21_mxc_w1_data __initconst =
16 	imx_mxc_w1_data_entry_single(MX21);
17 #endif /* ifdef CONFIG_SOC_IMX21 */
18 
19 #ifdef CONFIG_SOC_IMX27
20 const struct imx_mxc_w1_data imx27_mxc_w1_data __initconst =
21 	imx_mxc_w1_data_entry_single(MX27);
22 #endif /* ifdef CONFIG_SOC_IMX27 */
23 
24 #ifdef CONFIG_SOC_IMX31
25 const struct imx_mxc_w1_data imx31_mxc_w1_data __initconst =
26 	imx_mxc_w1_data_entry_single(MX31);
27 #endif /* ifdef CONFIG_SOC_IMX31 */
28 
29 #ifdef CONFIG_SOC_IMX35
30 const struct imx_mxc_w1_data imx35_mxc_w1_data __initconst =
31 	imx_mxc_w1_data_entry_single(MX35);
32 #endif /* ifdef CONFIG_SOC_IMX35 */
33 
imx_add_mxc_w1(const struct imx_mxc_w1_data * data)34 struct platform_device *__init imx_add_mxc_w1(
35 		const struct imx_mxc_w1_data *data)
36 {
37 	struct resource res[] = {
38 		{
39 			.start = data->iobase,
40 			.end = data->iobase + SZ_4K - 1,
41 			.flags = IORESOURCE_MEM,
42 		},
43 	};
44 
45 	return imx_add_platform_device("mxc_w1", 0,
46 			res, ARRAY_SIZE(res), NULL, 0);
47 }
48