msm_sdcc_dml.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * linux/drivers/mmc/host/msm_sdcc_dml.h - Qualcomm SDCC DML driver
  3. * header file
  4. *
  5. * Copyright (c) 2011, The Linux Foundation. All rights reserved.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 and
  9. * only version 2 as published by the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. */
  17. #ifndef _MSM_SDCC_DML_H
  18. #define _MSM_SDCC_DML_H
  19. #include <linux/types.h>
  20. #include <linux/mmc/host.h>
  21. #include "msm_sdcc.h"
  22. #ifdef CONFIG_MMC_MSM_SPS_SUPPORT
  23. /**
  24. * Initialize DML HW connected with SDCC core
  25. *
  26. * This function initialize DML HW.
  27. *
  28. * This function should only be called once
  29. * typically during driver probe.
  30. *
  31. * @host - Pointer to sdcc host structure
  32. *
  33. * @return - 0 if successful else negative value.
  34. *
  35. */
  36. int msmsdcc_dml_init(struct msmsdcc_host *host);
  37. /**
  38. * Start data transfer.
  39. *
  40. * This function configure DML HW registers with
  41. * data transfer direction and data transfer size.
  42. *
  43. * This function should be called after submitting
  44. * data transfer request to SPS HW and before kick
  45. * starting data transfer in SDCC core.
  46. *
  47. * @host - Pointer to sdcc host structure
  48. * @data - Pointer to mmc_data structure
  49. *
  50. */
  51. void msmsdcc_dml_start_xfer(struct msmsdcc_host *host, struct mmc_data *data);
  52. /**
  53. * Checks if DML HW is busy or not?
  54. *
  55. * @host - Pointer to sdcc host structure
  56. *
  57. * @return - 1 if DML HW is busy with data transfer
  58. * 0 if DML HW is IDLE.
  59. *
  60. */
  61. bool msmsdcc_is_dml_busy(struct msmsdcc_host *host);
  62. /**
  63. * Soft reset DML HW
  64. *
  65. * This function give soft reset to DML HW.
  66. *
  67. * This function should be called to reset DML HW
  68. * if data transfer error is detected.
  69. *
  70. * @host - Pointer to sdcc host structure
  71. *
  72. */
  73. void msmsdcc_dml_reset(struct msmsdcc_host *host);
  74. /**
  75. * Deinitialize DML HW connected with SDCC core
  76. *
  77. * This function resets DML HW and unmap DML
  78. * register region.
  79. *
  80. * This function should only be called once
  81. * typically during driver remove.
  82. *
  83. * @host - Pointer to sdcc host structure
  84. *
  85. */
  86. void msmsdcc_dml_exit(struct msmsdcc_host *host);
  87. #else
  88. static inline int msmsdcc_dml_init(struct msmsdcc_host *host) { return 0; }
  89. static inline int msmsdcc_dml_start_xfer(struct msmsdcc_host *host,
  90. struct mmc_data *data) { return 0; }
  91. static inline bool msmsdcc_is_dml_busy(
  92. struct msmsdcc_host *host) { return 0; }
  93. static inline void msmsdcc_dml_reset(struct msmsdcc_host *host) { }
  94. static inline void msmsdcc_dml_exit(struct msmsdcc_host *host) { }
  95. #endif /* CONFIG_MMC_MSM_SPS_SUPPORT */
  96. #endif /* _MSM_SDCC_DML_H */