dev-dwmci.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * linux/arch/arm/mach-exynos4/dev-dwmci.c
  3. *
  4. * Copyright (c) 2011 Samsung Electronics Co., Ltd.
  5. * http://www.samsung.com
  6. *
  7. * Platform device for Synopsys DesignWare Mobile Storage IP
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. */
  14. #include <linux/kernel.h>
  15. #include <linux/dma-mapping.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/mmc/dw_mmc.h>
  19. #include <plat/devs.h>
  20. #include <mach/map.h>
  21. static int exynos4_dwmci_get_bus_wd(u32 slot_id)
  22. {
  23. return 4;
  24. }
  25. static int exynos4_dwmci_init(u32 slot_id, irq_handler_t handler, void *data)
  26. {
  27. return 0;
  28. }
  29. static struct resource exynos4_dwmci_resource[] = {
  30. [0] = {
  31. .start = EXYNOS4_PA_DWMCI,
  32. .end = EXYNOS4_PA_DWMCI + SZ_4K - 1,
  33. .flags = IORESOURCE_MEM,
  34. },
  35. [1] = {
  36. .start = IRQ_DWMCI,
  37. .end = IRQ_DWMCI,
  38. .flags = IORESOURCE_IRQ,
  39. }
  40. };
  41. static struct dw_mci_board exynos4_dwci_pdata = {
  42. .num_slots = 1,
  43. .quirks = DW_MCI_QUIRK_BROKEN_CARD_DETECTION,
  44. .bus_hz = 80 * 1000 * 1000,
  45. .detect_delay_ms = 200,
  46. .init = exynos4_dwmci_init,
  47. .get_bus_wd = exynos4_dwmci_get_bus_wd,
  48. };
  49. static u64 exynos4_dwmci_dmamask = DMA_BIT_MASK(32);
  50. struct platform_device exynos4_device_dwmci = {
  51. .name = "dw_mmc",
  52. .id = -1,
  53. .num_resources = ARRAY_SIZE(exynos4_dwmci_resource),
  54. .resource = exynos4_dwmci_resource,
  55. .dev = {
  56. .dma_mask = &exynos4_dwmci_dmamask,
  57. .coherent_dma_mask = DMA_BIT_MASK(32),
  58. .platform_data = &exynos4_dwci_pdata,
  59. },
  60. };
  61. void __init exynos4_dwmci_set_platdata(struct dw_mci_board *pd)
  62. {
  63. struct dw_mci_board *npd;
  64. npd = s3c_set_platdata(pd, sizeof(struct dw_mci_board),
  65. &exynos4_device_dwmci);
  66. if (!npd->init)
  67. npd->init = exynos4_dwmci_init;
  68. if (!npd->get_bus_wd)
  69. npd->get_bus_wd = exynos4_dwmci_get_bus_wd;
  70. }