Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/drivers/mmc/host/msm_sdcc_dml.h - Qualcomm SDCC DML driver |
| 3 | * header file |
| 4 | * |
Duy Truong | 790f06d | 2013-02-13 16:38:12 -0800 | [diff] [blame] | 5 | * Copyright (c) 2011, The Linux Foundation. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 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 | |
| 18 | #ifndef _MSM_SDCC_DML_H |
| 19 | #define _MSM_SDCC_DML_H |
| 20 | |
| 21 | #include <linux/types.h> |
| 22 | #include <linux/mmc/host.h> |
| 23 | |
| 24 | #include "msm_sdcc.h" |
| 25 | |
| 26 | #ifdef CONFIG_MMC_MSM_SPS_SUPPORT |
| 27 | /** |
| 28 | * Initialize DML HW connected with SDCC core |
| 29 | * |
| 30 | * This function initialize DML HW. |
| 31 | * |
| 32 | * This function should only be called once |
| 33 | * typically during driver probe. |
| 34 | * |
| 35 | * @host - Pointer to sdcc host structure |
| 36 | * |
| 37 | * @return - 0 if successful else negative value. |
| 38 | * |
| 39 | */ |
| 40 | int msmsdcc_dml_init(struct msmsdcc_host *host); |
| 41 | |
| 42 | /** |
| 43 | * Start data transfer. |
| 44 | * |
| 45 | * This function configure DML HW registers with |
| 46 | * data transfer direction and data transfer size. |
| 47 | * |
| 48 | * This function should be called after submitting |
| 49 | * data transfer request to SPS HW and before kick |
| 50 | * starting data transfer in SDCC core. |
| 51 | * |
| 52 | * @host - Pointer to sdcc host structure |
| 53 | * @data - Pointer to mmc_data structure |
| 54 | * |
| 55 | */ |
| 56 | void msmsdcc_dml_start_xfer(struct msmsdcc_host *host, struct mmc_data *data); |
| 57 | |
| 58 | /** |
| 59 | * Checks if DML HW is busy or not? |
| 60 | * |
| 61 | * @host - Pointer to sdcc host structure |
| 62 | * |
| 63 | * @return - 1 if DML HW is busy with data transfer |
| 64 | * 0 if DML HW is IDLE. |
| 65 | * |
| 66 | */ |
| 67 | bool msmsdcc_is_dml_busy(struct msmsdcc_host *host); |
| 68 | |
| 69 | /** |
| 70 | * Soft reset DML HW |
| 71 | * |
| 72 | * This function give soft reset to DML HW. |
| 73 | * |
| 74 | * This function should be called to reset DML HW |
| 75 | * if data transfer error is detected. |
| 76 | * |
| 77 | * @host - Pointer to sdcc host structure |
| 78 | * |
| 79 | */ |
| 80 | void msmsdcc_dml_reset(struct msmsdcc_host *host); |
| 81 | |
| 82 | /** |
| 83 | * Deinitialize DML HW connected with SDCC core |
| 84 | * |
| 85 | * This function resets DML HW and unmap DML |
| 86 | * register region. |
| 87 | * |
| 88 | * This function should only be called once |
| 89 | * typically during driver remove. |
| 90 | * |
| 91 | * @host - Pointer to sdcc host structure |
| 92 | * |
| 93 | */ |
| 94 | void msmsdcc_dml_exit(struct msmsdcc_host *host); |
| 95 | #else |
| 96 | static inline int msmsdcc_dml_init(struct msmsdcc_host *host) { return 0; } |
| 97 | static inline int msmsdcc_dml_start_xfer(struct msmsdcc_host *host, |
| 98 | struct mmc_data *data) { return 0; } |
| 99 | static inline bool msmsdcc_is_dml_busy( |
| 100 | struct msmsdcc_host *host) { return 0; } |
| 101 | static inline void msmsdcc_dml_reset(struct msmsdcc_host *host) { } |
| 102 | static inline void msmsdcc_dml_exit(struct msmsdcc_host *host) { } |
| 103 | #endif /* CONFIG_MMC_MSM_SPS_SUPPORT */ |
| 104 | |
| 105 | #endif /* _MSM_SDCC_DML_H */ |