platform-imx2-wdt.c 1.7 KB

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