aboutsummaryrefslogtreecommitdiff
path: root/drivers/mmc/host/msm_sdcc_dml.h
blob: bee58d18412c2385059dee2ca0115a349c764419 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
 *  linux/drivers/mmc/host/msm_sdcc_dml.h - Qualcomm SDCC DML driver
 *					    header file
 *
 * Copyright (c) 2011, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */

#ifndef _MSM_SDCC_DML_H
#define _MSM_SDCC_DML_H

#include <linux/types.h>
#include <linux/mmc/host.h>

#include "msm_sdcc.h"

#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
/**
 * Initialize DML HW connected with SDCC core
 *
 * This function initialize DML HW.
 *
 * This function should only be called once
 * typically during driver probe.
 *
 * @host - Pointer to sdcc host structure
 *
 * @return - 0 if successful else negative value.
 *
 */
int msmsdcc_dml_init(struct msmsdcc_host *host);

/**
 * Start data transfer.
 *
 * This function configure DML HW registers with
 * data transfer direction and data transfer size.
 *
 * This function should be called after submitting
 * data transfer request to SPS HW and before kick
 * starting data transfer in SDCC core.
 *
 * @host - Pointer to sdcc host structure
 * @data - Pointer to mmc_data structure
 *
 */
void msmsdcc_dml_start_xfer(struct msmsdcc_host *host, struct mmc_data *data);

/**
 * Checks if DML HW is busy or not?
 *
 * @host - Pointer to sdcc host structure
 *
 * @return - 1 if DML HW is busy with data transfer
 *           0 if DML HW is IDLE.
 *
 */
bool msmsdcc_is_dml_busy(struct msmsdcc_host *host);

/**
 * Soft reset DML HW
 *
 * This function give soft reset to DML HW.
 *
 * This function should be called to reset DML HW
 * if data transfer error is detected.
 *
 * @host - Pointer to sdcc host structure
 *
 */
void msmsdcc_dml_reset(struct msmsdcc_host *host);

/**
 * Deinitialize DML HW connected with SDCC core
 *
 * This function resets DML HW and unmap DML
 * register region.
 *
 * This function should only be called once
 * typically during driver remove.
 *
 * @host - Pointer to sdcc host structure
 *
 */
void msmsdcc_dml_exit(struct msmsdcc_host *host);
#else
static inline int msmsdcc_dml_init(struct msmsdcc_host *host) { return 0; }
static inline int msmsdcc_dml_start_xfer(struct msmsdcc_host *host,
				struct mmc_data *data) { return 0; }
static inline bool msmsdcc_is_dml_busy(
				struct msmsdcc_host *host) { return 0; }
static inline void msmsdcc_dml_reset(struct msmsdcc_host *host) { }
static inline void msmsdcc_dml_exit(struct msmsdcc_host *host) { }
#endif /* CONFIG_MMC_MSM_SPS_SUPPORT */

#endif /* _MSM_SDCC_DML_H */