platform-imx2-wdt.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 <asm/sizes.h>
  10. #include <mach/hardware.h>
  11. #include <mach/devices-common.h>
  12. #define imx_imx2_wdt_data_entry_single(soc, _size) \
  13. { \
  14. .iobase = soc ## _WDOG_BASE_ADDR, \
  15. .iosize = _size, \
  16. }
  17. #ifdef CONFIG_SOC_IMX21
  18. const struct imx_imx2_wdt_data imx21_imx2_wdt_data __initconst =
  19. imx_imx2_wdt_data_entry_single(MX21, SZ_4K);
  20. #endif /* ifdef CONFIG_SOC_IMX21 */
  21. #ifdef CONFIG_SOC_IMX25
  22. const struct imx_imx2_wdt_data imx25_imx2_wdt_data __initconst =
  23. imx_imx2_wdt_data_entry_single(MX25, SZ_16K);
  24. #endif /* ifdef CONFIG_SOC_IMX25 */
  25. #ifdef CONFIG_SOC_IMX27
  26. const struct imx_imx2_wdt_data imx27_imx2_wdt_data __initconst =
  27. imx_imx2_wdt_data_entry_single(MX27, SZ_4K);
  28. #endif /* ifdef CONFIG_SOC_IMX27 */
  29. #ifdef CONFIG_SOC_IMX31
  30. const struct imx_imx2_wdt_data imx31_imx2_wdt_data __initconst =
  31. imx_imx2_wdt_data_entry_single(MX31, SZ_16K);
  32. #endif /* ifdef CONFIG_SOC_IMX31 */
  33. #ifdef CONFIG_SOC_IMX35
  34. const struct imx_imx2_wdt_data imx35_imx2_wdt_data __initconst =
  35. imx_imx2_wdt_data_entry_single(MX35, SZ_16K);
  36. #endif /* ifdef CONFIG_SOC_IMX35 */
  37. #ifdef CONFIG_SOC_IMX51
  38. const struct imx_imx2_wdt_data imx51_imx2_wdt_data __initconst =
  39. imx_imx2_wdt_data_entry_single(MX51, SZ_16K);
  40. #endif /* ifdef CONFIG_SOC_IMX51 */
  41. struct platform_device *__init imx_add_imx2_wdt(
  42. const struct imx_imx2_wdt_data *data)
  43. {
  44. struct resource res[] = {
  45. {
  46. .start = data->iobase,
  47. .end = data->iobase + data->iosize - 1,
  48. .flags = IORESOURCE_MEM,
  49. },
  50. };
  51. return imx_add_platform_device("imx2-wdt", 0,
  52. res, ARRAY_SIZE(res), NULL, 0);
  53. }