platform-duart.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (C) 2009-2010 Pengutronix
  3. * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
  4. *
  5. * Copyright 2010 Freescale Semiconductor, Inc. All Rights Reserved.
  6. *
  7. * This program is free software; you can redistribute it and/or modify it under
  8. * the terms of the GNU General Public License version 2 as published by the
  9. * Free Software Foundation.
  10. */
  11. #include <mach/mx23.h>
  12. #include <mach/mx28.h>
  13. #include <mach/devices-common.h>
  14. #define mxs_duart_data_entry(soc) \
  15. { \
  16. .iobase = soc ## _DUART_BASE_ADDR, \
  17. .irq = soc ## _INT_DUART, \
  18. }
  19. #ifdef CONFIG_SOC_IMX23
  20. const struct mxs_duart_data mx23_duart_data __initconst =
  21. mxs_duart_data_entry(MX23);
  22. #endif
  23. #ifdef CONFIG_SOC_IMX28
  24. const struct mxs_duart_data mx28_duart_data __initconst =
  25. mxs_duart_data_entry(MX28);
  26. #endif
  27. struct platform_device *__init mxs_add_duart(
  28. const struct mxs_duart_data *data)
  29. {
  30. struct resource res[] = {
  31. {
  32. .start = data->iobase,
  33. .end = data->iobase + SZ_8K - 1,
  34. .flags = IORESOURCE_MEM,
  35. }, {
  36. .start = data->irq,
  37. .end = data->irq,
  38. .flags = IORESOURCE_IRQ,
  39. },
  40. };
  41. return mxs_add_platform_device("mxs-duart", 0, res, ARRAY_SIZE(res),
  42. NULL, 0);
  43. }