platform-auart.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright (C) 2010 Pengutronix
  3. * Sascha Hauer <s.hauer@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/mx23.h>
  11. #include <mach/mx28.h>
  12. #include <mach/devices-common.h>
  13. #define mxs_auart_data_entry_single(soc, _id, hwid) \
  14. { \
  15. .id = _id, \
  16. .iobase = soc ## _AUART ## hwid ## _BASE_ADDR, \
  17. .irq = soc ## _INT_AUART ## hwid, \
  18. }
  19. #define mxs_auart_data_entry(soc, _id, hwid) \
  20. [_id] = mxs_auart_data_entry_single(soc, _id, hwid)
  21. #ifdef CONFIG_SOC_IMX23
  22. const struct mxs_auart_data mx23_auart_data[] __initconst = {
  23. #define mx23_auart_data_entry(_id, hwid) \
  24. mxs_auart_data_entry(MX23, _id, hwid)
  25. mx23_auart_data_entry(0, 1),
  26. mx23_auart_data_entry(1, 2),
  27. };
  28. #endif
  29. #ifdef CONFIG_SOC_IMX28
  30. const struct mxs_auart_data mx28_auart_data[] __initconst = {
  31. #define mx28_auart_data_entry(_id) \
  32. mxs_auart_data_entry(MX28, _id, _id)
  33. mx28_auart_data_entry(0),
  34. mx28_auart_data_entry(1),
  35. mx28_auart_data_entry(2),
  36. mx28_auart_data_entry(3),
  37. mx28_auart_data_entry(4),
  38. };
  39. #endif
  40. struct platform_device *__init mxs_add_auart(
  41. const struct mxs_auart_data *data)
  42. {
  43. struct resource res[] = {
  44. {
  45. .start = data->iobase,
  46. .end = data->iobase + SZ_8K - 1,
  47. .flags = IORESOURCE_MEM,
  48. }, {
  49. .start = data->irq,
  50. .end = data->irq,
  51. .flags = IORESOURCE_IRQ,
  52. },
  53. };
  54. return mxs_add_platform_device_dmamask("mxs-auart", data->id,
  55. res, ARRAY_SIZE(res), NULL, 0,
  56. DMA_BIT_MASK(32));
  57. }