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