mmc.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. *
  3. * arch/arm/mach-u300/mmc.c
  4. *
  5. *
  6. * Copyright (C) 2009 ST-Ericsson SA
  7. * License terms: GNU General Public License (GPL) version 2
  8. *
  9. * Author: Linus Walleij <linus.walleij@stericsson.com>
  10. * Author: Johan Lundin
  11. * Author: Jonas Aaberg <jonas.aberg@stericsson.com>
  12. */
  13. #include <linux/device.h>
  14. #include <linux/amba/bus.h>
  15. #include <linux/mmc/host.h>
  16. #include <linux/gpio.h>
  17. #include <linux/dmaengine.h>
  18. #include <linux/amba/mmci.h>
  19. #include <linux/slab.h>
  20. #include <mach/coh901318.h>
  21. #include <mach/dma_channels.h>
  22. #include "mmc.h"
  23. #include "padmux.h"
  24. static struct mmci_platform_data mmc0_plat_data = {
  25. /*
  26. * Do not set ocr_mask or voltage translation function,
  27. * we have a regulator we can control instead.
  28. */
  29. /* Nominally 2.85V on our platform */
  30. .f_max = 24000000,
  31. .gpio_wp = -1,
  32. .gpio_cd = U300_GPIO_PIN_MMC_CD,
  33. .cd_invert = true,
  34. .capabilities = MMC_CAP_MMC_HIGHSPEED |
  35. MMC_CAP_SD_HIGHSPEED | MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
  36. #ifdef CONFIG_COH901318
  37. .dma_filter = coh901318_filter_id,
  38. .dma_rx_param = (void *) U300_DMA_MMCSD_RX_TX,
  39. /* Don't specify a TX channel, this RX channel is bidirectional */
  40. #endif
  41. };
  42. int __devinit mmc_init(struct amba_device *adev)
  43. {
  44. struct device *mmcsd_device = &adev->dev;
  45. struct pmx *pmx;
  46. int ret = 0;
  47. mmcsd_device->platform_data = &mmc0_plat_data;
  48. /*
  49. * Setup padmuxing for MMC. Since this must always be
  50. * compiled into the kernel, pmx is never released.
  51. */
  52. pmx = pmx_get(mmcsd_device, U300_APP_PMX_MMC_SETTING);
  53. if (IS_ERR(pmx))
  54. pr_warning("Could not get padmux handle\n");
  55. else {
  56. ret = pmx_activate(mmcsd_device, pmx);
  57. if (IS_ERR_VALUE(ret))
  58. pr_warning("Could not activate padmuxing\n");
  59. }
  60. return ret;
  61. }