platform-mxc_w1.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. #define imx_mxc_w1_data_entry_single(soc) \
  12. { \
  13. .iobase = soc ## _OWIRE_BASE_ADDR, \
  14. }
  15. #ifdef CONFIG_SOC_IMX21
  16. const struct imx_mxc_w1_data imx21_mxc_w1_data __initconst =
  17. imx_mxc_w1_data_entry_single(MX21);
  18. #endif /* ifdef CONFIG_SOC_IMX21 */
  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. #ifdef CONFIG_SOC_IMX31
  24. const struct imx_mxc_w1_data imx31_mxc_w1_data __initconst =
  25. imx_mxc_w1_data_entry_single(MX31);
  26. #endif /* ifdef CONFIG_SOC_IMX31 */
  27. #ifdef CONFIG_SOC_IMX35
  28. const struct imx_mxc_w1_data imx35_mxc_w1_data __initconst =
  29. imx_mxc_w1_data_entry_single(MX35);
  30. #endif /* ifdef CONFIG_SOC_IMX35 */
  31. struct platform_device *__init imx_add_mxc_w1(
  32. const struct imx_mxc_w1_data *data)
  33. {
  34. struct resource res[] = {
  35. {
  36. .start = data->iobase,
  37. .end = data->iobase + SZ_4K - 1,
  38. .flags = IORESOURCE_MEM,
  39. },
  40. };
  41. return imx_add_platform_device("mxc_w1", 0,
  42. res, ARRAY_SIZE(res), NULL, 0);
  43. }