dev-dwmci.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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/ioport.h>
  19. #include <linux/mmc/dw_mmc.h>
  20. #include <plat/devs.h>
  21. #include <mach/map.h>
  22. static int exynos4_dwmci_get_bus_wd(u32 slot_id)
  23. {
  24. return 4;
  25. }
  26. static int exynos4_dwmci_init(u32 slot_id, irq_handler_t handler, void *data)
  27. {
  28. return 0;
  29. }
  30. static struct resource exynos4_dwmci_resource[] = {
  31. [0] = DEFINE_RES_MEM(EXYNOS4_PA_DWMCI, SZ_4K),
  32. [1] = DEFINE_RES_IRQ(EXYNOS4_IRQ_DWMCI),
  33. };
  34. static struct dw_mci_board exynos4_dwci_pdata = {
  35. .num_slots = 1,
  36. .quirks = DW_MCI_QUIRK_BROKEN_CARD_DETECTION,
  37. .bus_hz = 80 * 1000 * 1000,
  38. .detect_delay_ms = 200,
  39. .init = exynos4_dwmci_init,
  40. .get_bus_wd = exynos4_dwmci_get_bus_wd,
  41. };
  42. static u64 exynos4_dwmci_dmamask = DMA_BIT_MASK(32);
  43. struct platform_device exynos4_device_dwmci = {
  44. .name = "dw_mmc",
  45. .id = -1,
  46. .num_resources = ARRAY_SIZE(exynos4_dwmci_resource),
  47. .resource = exynos4_dwmci_resource,
  48. .dev = {
  49. .dma_mask = &exynos4_dwmci_dmamask,
  50. .coherent_dma_mask = DMA_BIT_MASK(32),
  51. .platform_data = &exynos4_dwci_pdata,
  52. },
  53. };
  54. void __init exynos4_dwmci_set_platdata(struct dw_mci_board *pd)
  55. {
  56. struct dw_mci_board *npd;
  57. npd = s3c_set_platdata(pd, sizeof(struct dw_mci_board),
  58. &exynos4_device_dwmci);
  59. if (!npd->init)
  60. npd->init = exynos4_dwmci_init;
  61. if (!npd->get_bus_wd)
  62. npd->get_bus_wd = exynos4_dwmci_get_bus_wd;
  63. }