blob: 88c18b720d63722a8d4732fe35aa6a60ba63a905 [file] [log] [blame]
Uwe Kleine-Königae71a562010-10-29 10:56:07 +02001/*
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 */
Shawn Guo50f2de62012-09-14 14:14:45 +08009#include "../hardware.h"
Shawn Guoe0557c02012-09-13 15:51:15 +080010#include "devices-common.h"
Uwe Kleine-Königae71a562010-10-29 10:56:07 +020011
12#define imx_mxc_w1_data_entry_single(soc) \
13 { \
14 .iobase = soc ## _OWIRE_BASE_ADDR, \
15 }
16
17#ifdef CONFIG_SOC_IMX21
18const struct imx_mxc_w1_data imx21_mxc_w1_data __initconst =
19 imx_mxc_w1_data_entry_single(MX21);
20#endif /* ifdef CONFIG_SOC_IMX21 */
21
22#ifdef CONFIG_SOC_IMX27
23const struct imx_mxc_w1_data imx27_mxc_w1_data __initconst =
24 imx_mxc_w1_data_entry_single(MX27);
25#endif /* ifdef CONFIG_SOC_IMX27 */
26
Uwe Kleine-Königa528bc82010-11-12 10:11:42 +010027#ifdef CONFIG_SOC_IMX31
Uwe Kleine-Königae71a562010-10-29 10:56:07 +020028const struct imx_mxc_w1_data imx31_mxc_w1_data __initconst =
29 imx_mxc_w1_data_entry_single(MX31);
Uwe Kleine-Königa528bc82010-11-12 10:11:42 +010030#endif /* ifdef CONFIG_SOC_IMX31 */
Uwe Kleine-Königae71a562010-10-29 10:56:07 +020031
Uwe Kleine-Königa528bc82010-11-12 10:11:42 +010032#ifdef CONFIG_SOC_IMX35
Uwe Kleine-Königae71a562010-10-29 10:56:07 +020033const struct imx_mxc_w1_data imx35_mxc_w1_data __initconst =
34 imx_mxc_w1_data_entry_single(MX35);
Uwe Kleine-Königa528bc82010-11-12 10:11:42 +010035#endif /* ifdef CONFIG_SOC_IMX35 */
Uwe Kleine-Königae71a562010-10-29 10:56:07 +020036
37struct platform_device *__init imx_add_mxc_w1(
38 const struct imx_mxc_w1_data *data)
39{
40 struct resource res[] = {
41 {
42 .start = data->iobase,
43 .end = data->iobase + SZ_4K - 1,
44 .flags = IORESOURCE_MEM,
45 },
46 };
47
48 return imx_add_platform_device("mxc_w1", 0,
49 res, ARRAY_SIZE(res), NULL, 0);
50}