platform-mxc_rtc.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright (C) 2010-2011 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_rtc_data_entry_single(soc, _devid) \
  12. { \
  13. .devid = _devid, \
  14. .iobase = soc ## _RTC_BASE_ADDR, \
  15. .irq = soc ## _INT_RTC, \
  16. }
  17. #ifdef CONFIG_SOC_IMX31
  18. const struct imx_mxc_rtc_data imx31_mxc_rtc_data __initconst =
  19. imx_mxc_rtc_data_entry_single(MX31, "imx21-rtc");
  20. #endif /* ifdef CONFIG_SOC_IMX31 */
  21. #ifdef CONFIG_SOC_IMX35
  22. const struct imx_mxc_rtc_data imx35_mxc_rtc_data __initconst =
  23. imx_mxc_rtc_data_entry_single(MX35, "imx21-rtc");
  24. #endif /* ifdef CONFIG_SOC_IMX35 */
  25. struct platform_device *__init imx_add_mxc_rtc(
  26. const struct imx_mxc_rtc_data *data)
  27. {
  28. struct resource res[] = {
  29. {
  30. .start = data->iobase,
  31. .end = data->iobase + SZ_16K - 1,
  32. .flags = IORESOURCE_MEM,
  33. }, {
  34. .start = data->irq,
  35. .end = data->irq,
  36. .flags = IORESOURCE_IRQ,
  37. },
  38. };
  39. return imx_add_platform_device(data->devid, -1,
  40. res, ARRAY_SIZE(res), NULL, 0);
  41. }