platform-mxs-mmc.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (C) 2010 Pengutronix
  3. * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
  4. *
  5. * Copyright 2011 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 <linux/compiler.h>
  12. #include <linux/err.h>
  13. #include <linux/init.h>
  14. #include <mach/mx23.h>
  15. #include <mach/mx28.h>
  16. #include <mach/devices-common.h>
  17. #define mxs_mxs_mmc_data_entry_single(soc, _id, hwid) \
  18. { \
  19. .id = _id, \
  20. .iobase = soc ## _SSP ## hwid ## _BASE_ADDR, \
  21. .dma = soc ## _DMA_SSP ## hwid, \
  22. .irq_err = soc ## _INT_SSP ## hwid ## _ERROR, \
  23. .irq_dma = soc ## _INT_SSP ## hwid ## _DMA, \
  24. }
  25. #define mxs_mxs_mmc_data_entry(soc, _id, hwid) \
  26. [_id] = mxs_mxs_mmc_data_entry_single(soc, _id, hwid)
  27. #ifdef CONFIG_SOC_IMX23
  28. const struct mxs_mxs_mmc_data mx23_mxs_mmc_data[] __initconst = {
  29. mxs_mxs_mmc_data_entry(MX23, 0, 1),
  30. mxs_mxs_mmc_data_entry(MX23, 1, 2),
  31. };
  32. #endif
  33. #ifdef CONFIG_SOC_IMX28
  34. const struct mxs_mxs_mmc_data mx28_mxs_mmc_data[] __initconst = {
  35. mxs_mxs_mmc_data_entry(MX28, 0, 0),
  36. mxs_mxs_mmc_data_entry(MX28, 1, 1),
  37. mxs_mxs_mmc_data_entry(MX28, 2, 2),
  38. mxs_mxs_mmc_data_entry(MX28, 3, 3),
  39. };
  40. #endif
  41. struct platform_device *__init mxs_add_mxs_mmc(
  42. const struct mxs_mxs_mmc_data *data,
  43. const struct mxs_mmc_platform_data *pdata)
  44. {
  45. struct resource res[] = {
  46. {
  47. .start = data->iobase,
  48. .end = data->iobase + SZ_8K - 1,
  49. .flags = IORESOURCE_MEM,
  50. }, {
  51. .start = data->dma,
  52. .end = data->dma,
  53. .flags = IORESOURCE_DMA,
  54. }, {
  55. .start = data->irq_err,
  56. .end = data->irq_err,
  57. .flags = IORESOURCE_IRQ,
  58. }, {
  59. .start = data->irq_dma,
  60. .end = data->irq_dma,
  61. .flags = IORESOURCE_IRQ,
  62. },
  63. };
  64. return mxs_add_platform_device("mxs-mmc", data->id,
  65. res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
  66. }