platform-esdhc.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (C) 2010 Pengutronix, Wolfram Sang <w.sang@pengutronix.de>
  3. *
  4. * This program is free software; you can redistribute it and/or modify it under
  5. * the terms of the GNU General Public License version 2 as published by the
  6. * Free Software Foundation.
  7. */
  8. #include <mach/hardware.h>
  9. #include <mach/devices-common.h>
  10. #include <mach/esdhc.h>
  11. #define imx_esdhc_imx_data_entry_single(soc, _id, hwid) \
  12. { \
  13. .id = _id, \
  14. .iobase = soc ## _ESDHC ## hwid ## _BASE_ADDR, \
  15. .irq = soc ## _INT_ESDHC ## hwid, \
  16. }
  17. #define imx_esdhc_imx_data_entry(soc, id, hwid) \
  18. [id] = imx_esdhc_imx_data_entry_single(soc, id, hwid)
  19. #ifdef CONFIG_ARCH_MX25
  20. const struct imx_esdhc_imx_data imx25_esdhc_data[] __initconst = {
  21. #define imx25_esdhc_data_entry(_id, _hwid) \
  22. imx_esdhc_imx_data_entry(MX25, _id, _hwid)
  23. imx25_esdhc_data_entry(0, 1),
  24. imx25_esdhc_data_entry(1, 2),
  25. };
  26. #endif /* ifdef CONFIG_ARCH_MX25 */
  27. #ifdef CONFIG_ARCH_MX35
  28. const struct imx_esdhc_imx_data imx35_esdhc_data[] __initconst = {
  29. #define imx35_esdhc_data_entry(_id, _hwid) \
  30. imx_esdhc_imx_data_entry(MX35, _id, _hwid)
  31. imx35_esdhc_data_entry(0, 1),
  32. imx35_esdhc_data_entry(1, 2),
  33. imx35_esdhc_data_entry(2, 3),
  34. };
  35. #endif /* ifdef CONFIG_ARCH_MX35 */
  36. #ifdef CONFIG_ARCH_MX51
  37. const struct imx_esdhc_imx_data imx51_esdhc_data[] __initconst = {
  38. #define imx51_esdhc_data_entry(_id, _hwid) \
  39. imx_esdhc_imx_data_entry(MX51, _id, _hwid)
  40. imx51_esdhc_data_entry(0, 1),
  41. imx51_esdhc_data_entry(1, 2),
  42. imx51_esdhc_data_entry(2, 3),
  43. imx51_esdhc_data_entry(3, 4),
  44. };
  45. #endif /* ifdef CONFIG_ARCH_MX51 */
  46. struct platform_device *__init imx_add_esdhc(
  47. const struct imx_esdhc_imx_data *data,
  48. const struct esdhc_platform_data *pdata)
  49. {
  50. struct resource res[] = {
  51. {
  52. .start = data->iobase,
  53. .end = data->iobase + SZ_16K - 1,
  54. .flags = IORESOURCE_MEM,
  55. }, {
  56. .start = data->irq,
  57. .end = data->irq,
  58. .flags = IORESOURCE_IRQ,
  59. },
  60. };
  61. return imx_add_platform_device("sdhci-esdhc-imx", data->id, res,
  62. ARRAY_SIZE(res), pdata, sizeof(*pdata));
  63. }