platform-sdhci-esdhc-imx.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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_sdhci_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_sdhci_esdhc_imx_data_entry(soc, id, hwid) \
  18. [id] = imx_sdhci_esdhc_imx_data_entry_single(soc, id, hwid)
  19. #ifdef CONFIG_SOC_IMX25
  20. const struct imx_sdhci_esdhc_imx_data
  21. imx25_sdhci_esdhc_imx_data[] __initconst = {
  22. #define imx25_sdhci_esdhc_imx_data_entry(_id, _hwid) \
  23. imx_sdhci_esdhc_imx_data_entry(MX25, _id, _hwid)
  24. imx25_sdhci_esdhc_imx_data_entry(0, 1),
  25. imx25_sdhci_esdhc_imx_data_entry(1, 2),
  26. };
  27. #endif /* ifdef CONFIG_SOC_IMX25 */
  28. #ifdef CONFIG_SOC_IMX35
  29. const struct imx_sdhci_esdhc_imx_data
  30. imx35_sdhci_esdhc_imx_data[] __initconst = {
  31. #define imx35_sdhci_esdhc_imx_data_entry(_id, _hwid) \
  32. imx_sdhci_esdhc_imx_data_entry(MX35, _id, _hwid)
  33. imx35_sdhci_esdhc_imx_data_entry(0, 1),
  34. imx35_sdhci_esdhc_imx_data_entry(1, 2),
  35. imx35_sdhci_esdhc_imx_data_entry(2, 3),
  36. };
  37. #endif /* ifdef CONFIG_SOC_IMX35 */
  38. #ifdef CONFIG_SOC_IMX51
  39. const struct imx_sdhci_esdhc_imx_data
  40. imx51_sdhci_esdhc_imx_data[] __initconst = {
  41. #define imx51_sdhci_esdhc_imx_data_entry(_id, _hwid) \
  42. imx_sdhci_esdhc_imx_data_entry(MX51, _id, _hwid)
  43. imx51_sdhci_esdhc_imx_data_entry(0, 1),
  44. imx51_sdhci_esdhc_imx_data_entry(1, 2),
  45. imx51_sdhci_esdhc_imx_data_entry(2, 3),
  46. imx51_sdhci_esdhc_imx_data_entry(3, 4),
  47. };
  48. #endif /* ifdef CONFIG_SOC_IMX51 */
  49. struct platform_device *__init imx_add_sdhci_esdhc_imx(
  50. const struct imx_sdhci_esdhc_imx_data *data,
  51. const struct esdhc_platform_data *pdata)
  52. {
  53. struct resource res[] = {
  54. {
  55. .start = data->iobase,
  56. .end = data->iobase + SZ_16K - 1,
  57. .flags = IORESOURCE_MEM,
  58. }, {
  59. .start = data->irq,
  60. .end = data->irq,
  61. .flags = IORESOURCE_IRQ,
  62. },
  63. };
  64. return imx_add_platform_device("sdhci-esdhc-imx", data->id, res,
  65. ARRAY_SIZE(res), pdata, sizeof(*pdata));
  66. }