summaryrefslogtreecommitdiff
path: root/drivers/ram/k3-ddrss/lpddr4_32bit_sanity.h
blob: a7529cb99edeab65a21d73adfa7be6b613e0d54e (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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
/* SPDX-License-Identifier: BSD-3-Clause */
/*
 * Cadence DDR Driver
 *
 * Copyright (C) 2012-2021 Cadence Design Systems, Inc.
 * Copyright (C) 2018-2021 Texas Instruments Incorporated - http://www.ti.com/
 */




#ifndef LPDDR4_32BIT_SANITY_H
#define LPDDR4_32BIT_SANITY_H

#include "cdn_errno.h"
#include "cdn_stdtypes.h"
#include <lpddr4_if.h>
#ifdef __cplusplus
extern "C" {
#endif

static inline uint32_t lpddr4_intr_sanityfunction1(const lpddr4_privatedata *pD, const lpddr4_intr_ctlinterrupt intr, const bool *irqStatus);
static inline uint32_t lpddr4_intr_sanityfunction2(const lpddr4_privatedata *pD, const lpddr4_intr_ctlinterrupt intr);
static inline uint32_t lpddr4_intr_sanityfunction3(const lpddr4_privatedata *pD, const lpddr4_intr_phyindepinterrupt intr, const bool *irqStatus);
static inline uint32_t lpddr4_intr_sanityfunction4(const lpddr4_privatedata *pD, const lpddr4_intr_phyindepinterrupt intr);

#define LPDDR4_INTR_CheckCtlIntSF lpddr4_intr_sanityfunction1
#define LPDDR4_INTR_AckCtlIntSF lpddr4_intr_sanityfunction2
#define LPDDR4_INTR_CheckPhyIndepIntSF lpddr4_intr_sanityfunction3
#define LPDDR4_INTR_AckPhyIndepIntSF lpddr4_intr_sanityfunction4

static inline uint32_t lpddr4_intr_sanityfunction1(const lpddr4_privatedata *pD, const lpddr4_intr_ctlinterrupt intr, const bool *irqStatus)
{
	uint32_t ret = 0;

	if (pD == NULL) {
		ret = CDN_EINVAL;
	} else if (irqStatus == NULL) {
		ret = CDN_EINVAL;
	} else if (
		(intr != LPDDR4_INTR_RESET_DONE) &&
		(intr != LPDDR4_INTR_BUS_ACCESS_ERROR) &&
		(intr != LPDDR4_INTR_MULTIPLE_BUS_ACCESS_ERROR) &&
		(intr != LPDDR4_INTR_ECC_MULTIPLE_CORR_ERROR) &&
		(intr != LPDDR4_INTR_ECC_MULTIPLE_UNCORR_ERROR) &&
		(intr != LPDDR4_INTR_ECC_WRITEBACK_EXEC_ERROR) &&
		(intr != LPDDR4_INTR_ECC_SCRUB_DONE) &&
		(intr != LPDDR4_INTR_ECC_SCRUB_ERROR) &&
		(intr != LPDDR4_INTR_PORT_COMMAND_ERROR) &&
		(intr != LPDDR4_INTR_MC_INIT_DONE) &&
		(intr != LPDDR4_INTR_LP_DONE) &&
		(intr != LPDDR4_INTR_BIST_DONE) &&
		(intr != LPDDR4_INTR_WRAP_ERROR) &&
		(intr != LPDDR4_INTR_INVALID_BURST_ERROR) &&
		(intr != LPDDR4_INTR_RDLVL_ERROR) &&
		(intr != LPDDR4_INTR_RDLVL_GATE_ERROR) &&
		(intr != LPDDR4_INTR_WRLVL_ERROR) &&
		(intr != LPDDR4_INTR_CA_TRAINING_ERROR) &&
		(intr != LPDDR4_INTR_DFI_UPDATE_ERROR) &&
		(intr != LPDDR4_INTR_MRR_ERROR) &&
		(intr != LPDDR4_INTR_PHY_MASTER_ERROR) &&
		(intr != LPDDR4_INTR_WRLVL_REQ) &&
		(intr != LPDDR4_INTR_RDLVL_REQ) &&
		(intr != LPDDR4_INTR_RDLVL_GATE_REQ) &&
		(intr != LPDDR4_INTR_CA_TRAINING_REQ) &&
		(intr != LPDDR4_INTR_LEVELING_DONE) &&
		(intr != LPDDR4_INTR_PHY_ERROR) &&
		(intr != LPDDR4_INTR_MR_READ_DONE) &&
		(intr != LPDDR4_INTR_TEMP_CHANGE) &&
		(intr != LPDDR4_INTR_TEMP_ALERT) &&
		(intr != LPDDR4_INTR_SW_DQS_COMPLETE) &&
		(intr != LPDDR4_INTR_DQS_OSC_BV_UPDATED) &&
		(intr != LPDDR4_INTR_DQS_OSC_OVERFLOW) &&
		(intr != LPDDR4_INTR_DQS_OSC_VAR_OUT) &&
		(intr != LPDDR4_INTR_MR_WRITE_DONE) &&
		(intr != LPDDR4_INTR_INHIBIT_DRAM_DONE) &&
		(intr != LPDDR4_INTR_DFI_INIT_STATE) &&
		(intr != LPDDR4_INTR_DLL_RESYNC_DONE) &&
		(intr != LPDDR4_INTR_TDFI_TO) &&
		(intr != LPDDR4_INTR_DFS_DONE) &&
		(intr != LPDDR4_INTR_DFS_STATUS) &&
		(intr != LPDDR4_INTR_REFRESH_STATUS) &&
		(intr != LPDDR4_INTR_ZQ_STATUS) &&
		(intr != LPDDR4_INTR_SW_REQ_MODE) &&
		(intr != LPDDR4_INTR_LOR_BITS)
		) {
		ret = CDN_EINVAL;
	} else {
	}

	return ret;
}

static inline uint32_t lpddr4_intr_sanityfunction2(const lpddr4_privatedata *pD, const lpddr4_intr_ctlinterrupt intr)
{
	uint32_t ret = 0;

	if (pD == NULL) {
		ret = CDN_EINVAL;
	} else if (
		(intr != LPDDR4_INTR_RESET_DONE) &&
		(intr != LPDDR4_INTR_BUS_ACCESS_ERROR) &&
		(intr != LPDDR4_INTR_MULTIPLE_BUS_ACCESS_ERROR) &&
		(intr != LPDDR4_INTR_ECC_MULTIPLE_CORR_ERROR) &&
		(intr != LPDDR4_INTR_ECC_MULTIPLE_UNCORR_ERROR) &&
		(intr != LPDDR4_INTR_ECC_WRITEBACK_EXEC_ERROR) &&
		(intr != LPDDR4_INTR_ECC_SCRUB_DONE) &&
		(intr != LPDDR4_INTR_ECC_SCRUB_ERROR) &&
		(intr != LPDDR4_INTR_PORT_COMMAND_ERROR) &&
		(intr != LPDDR4_INTR_MC_INIT_DONE) &&
		(intr != LPDDR4_INTR_LP_DONE) &&
		(intr != LPDDR4_INTR_BIST_DONE) &&
		(intr != LPDDR4_INTR_WRAP_ERROR) &&
		(intr != LPDDR4_INTR_INVALID_BURST_ERROR) &&
		(intr != LPDDR4_INTR_RDLVL_ERROR) &&
		(intr != LPDDR4_INTR_RDLVL_GATE_ERROR) &&
		(intr != LPDDR4_INTR_WRLVL_ERROR) &&
		(intr != LPDDR4_INTR_CA_TRAINING_ERROR) &&
		(intr != LPDDR4_INTR_DFI_UPDATE_ERROR) &&
		(intr != LPDDR4_INTR_MRR_ERROR) &&
		(intr != LPDDR4_INTR_PHY_MASTER_ERROR) &&
		(intr != LPDDR4_INTR_WRLVL_REQ) &&
		(intr != LPDDR4_INTR_RDLVL_REQ) &&
		(intr != LPDDR4_INTR_RDLVL_GATE_REQ) &&
		(intr != LPDDR4_INTR_CA_TRAINING_REQ) &&
		(intr != LPDDR4_INTR_LEVELING_DONE) &&
		(intr != LPDDR4_INTR_PHY_ERROR) &&
		(intr != LPDDR4_INTR_MR_READ_DONE) &&
		(intr != LPDDR4_INTR_TEMP_CHANGE) &&
		(intr != LPDDR4_INTR_TEMP_ALERT) &&
		(intr != LPDDR4_INTR_SW_DQS_COMPLETE) &&
		(intr != LPDDR4_INTR_DQS_OSC_BV_UPDATED) &&
		(intr != LPDDR4_INTR_DQS_OSC_OVERFLOW) &&
		(intr != LPDDR4_INTR_DQS_OSC_VAR_OUT) &&
		(intr != LPDDR4_INTR_MR_WRITE_DONE) &&
		(intr != LPDDR4_INTR_INHIBIT_DRAM_DONE) &&
		(intr != LPDDR4_INTR_DFI_INIT_STATE) &&
		(intr != LPDDR4_INTR_DLL_RESYNC_DONE) &&
		(intr != LPDDR4_INTR_TDFI_TO) &&
		(intr != LPDDR4_INTR_DFS_DONE) &&
		(intr != LPDDR4_INTR_DFS_STATUS) &&
		(intr != LPDDR4_INTR_REFRESH_STATUS) &&
		(intr != LPDDR4_INTR_ZQ_STATUS) &&
		(intr != LPDDR4_INTR_SW_REQ_MODE) &&
		(intr != LPDDR4_INTR_LOR_BITS)
		) {
		ret = CDN_EINVAL;
	} else {
	}

	return ret;
}

static inline uint32_t lpddr4_intr_sanityfunction3(const lpddr4_privatedata *pD, const lpddr4_intr_phyindepinterrupt intr, const bool *irqStatus)
{
	uint32_t ret = 0;

	if (pD == NULL) {
		ret = CDN_EINVAL;
	} else if (irqStatus == NULL) {
		ret = CDN_EINVAL;
	} else if (
		(intr != LPDDR4_INTR_PHY_INDEP_INIT_DONE_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_CONTROL_ERROR_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_CA_PARITY_ERR_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_RDLVL_ERROR_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_RDLVL_G_ERROR_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_WRLVL_ERROR_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_CALVL_ERROR_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_WDQLVL_ERROR_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_UPDATE_ERROR_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_RDLVL_REQ_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_RDLVL_GATE_REQ_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_WRLVL_REQ_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_CALVL_REQ_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_WDQLVL_REQ_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_LVL_DONE_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_BIST_DONE_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_TDFI_INIT_TIME_OUT_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_DLL_LOCK_STATE_CHANGE_BIT)
		) {
		ret = CDN_EINVAL;
	} else {
	}

	return ret;
}

static inline uint32_t lpddr4_intr_sanityfunction4(const lpddr4_privatedata *pD, const lpddr4_intr_phyindepinterrupt intr)
{
	uint32_t ret = 0;

	if (pD == NULL) {
		ret = CDN_EINVAL;
	} else if (
		(intr != LPDDR4_INTR_PHY_INDEP_INIT_DONE_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_CONTROL_ERROR_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_CA_PARITY_ERR_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_RDLVL_ERROR_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_RDLVL_G_ERROR_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_WRLVL_ERROR_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_CALVL_ERROR_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_WDQLVL_ERROR_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_UPDATE_ERROR_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_RDLVL_REQ_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_RDLVL_GATE_REQ_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_WRLVL_REQ_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_CALVL_REQ_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_WDQLVL_REQ_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_LVL_DONE_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_BIST_DONE_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_TDFI_INIT_TIME_OUT_BIT) &&
		(intr != LPDDR4_INTR_PHY_INDEP_DLL_LOCK_STATE_CHANGE_BIT)
		) {
		ret = CDN_EINVAL;
	} else {
	}

	return ret;
}

#ifdef __cplusplus
}
#endif


#endif  /* LPDDR4_32BIT_SANITY_H */