This source file includes following definitions.
- hwicap_type_1_read
- hwicap_type_1_write
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 #ifndef XILINX_HWICAP_H_
34 #define XILINX_HWICAP_H_
35
36 #include <linux/types.h>
37 #include <linux/cdev.h>
38 #include <linux/platform_device.h>
39
40 #include <linux/io.h>
41
42 struct hwicap_drvdata {
43 u32 write_buffer_in_use;
44 u8 write_buffer[4];
45 u32 read_buffer_in_use;
46 u8 read_buffer[4];
47 resource_size_t mem_start;
48 resource_size_t mem_end;
49 resource_size_t mem_size;
50 void __iomem *base_address;
51
52 struct device *dev;
53 struct cdev cdev;
54 dev_t devt;
55
56 const struct hwicap_driver_config *config;
57 const struct config_registers *config_regs;
58 void *private_data;
59 bool is_open;
60 struct mutex sem;
61 };
62
63 struct hwicap_driver_config {
64
65
66
67 int (*get_configuration)(struct hwicap_drvdata *drvdata, u32 *data,
68 u32 size);
69
70
71
72 int (*set_configuration)(struct hwicap_drvdata *drvdata, u32 *data,
73 u32 size);
74
75
76
77
78
79
80
81
82
83
84
85 u32 (*get_status)(struct hwicap_drvdata *drvdata);
86
87 void (*reset)(struct hwicap_drvdata *drvdata);
88 };
89
90
91
92
93
94
95
96
97 #define XHI_MAX_RETRIES 5000
98
99
100
101 #define XHI_PAD_FRAMES 0x1
102
103
104 #define XHI_WORD_COUNT_MASK_TYPE_1 0x7FFUL
105 #define XHI_WORD_COUNT_MASK_TYPE_2 0x1FFFFFUL
106 #define XHI_TYPE_MASK 0x7
107 #define XHI_REGISTER_MASK 0xF
108 #define XHI_OP_MASK 0x3
109
110 #define XHI_TYPE_SHIFT 29
111 #define XHI_REGISTER_SHIFT 13
112 #define XHI_OP_SHIFT 27
113
114 #define XHI_TYPE_1 1
115 #define XHI_TYPE_2 2
116 #define XHI_OP_WRITE 2
117 #define XHI_OP_READ 1
118
119
120 #define XHI_FAR_CLB_BLOCK 0
121 #define XHI_FAR_BRAM_BLOCK 1
122 #define XHI_FAR_BRAM_INT_BLOCK 2
123
124 struct config_registers {
125 u32 CRC;
126 u32 FAR;
127 u32 FDRI;
128 u32 FDRO;
129 u32 CMD;
130 u32 CTL;
131 u32 MASK;
132 u32 STAT;
133 u32 LOUT;
134 u32 COR;
135 u32 MFWR;
136 u32 FLR;
137 u32 KEY;
138 u32 CBC;
139 u32 IDCODE;
140 u32 AXSS;
141 u32 C0R_1;
142 u32 CSOB;
143 u32 WBSTAR;
144 u32 TIMER;
145 u32 BOOTSTS;
146 u32 CTL_1;
147 };
148
149
150 #define XHI_CMD_NULL 0
151 #define XHI_CMD_WCFG 1
152 #define XHI_CMD_MFW 2
153 #define XHI_CMD_DGHIGH 3
154 #define XHI_CMD_RCFG 4
155 #define XHI_CMD_START 5
156 #define XHI_CMD_RCAP 6
157 #define XHI_CMD_RCRC 7
158 #define XHI_CMD_AGHIGH 8
159 #define XHI_CMD_SWITCH 9
160 #define XHI_CMD_GRESTORE 10
161 #define XHI_CMD_SHUTDOWN 11
162 #define XHI_CMD_GCAPTURE 12
163 #define XHI_CMD_DESYNCH 13
164 #define XHI_CMD_IPROG 15
165 #define XHI_CMD_CRCC 16
166 #define XHI_CMD_LTIMER 17
167
168
169 #define XHI_SYNC_PACKET 0xAA995566UL
170 #define XHI_DUMMY_PACKET 0xFFFFFFFFUL
171 #define XHI_NOOP_PACKET (XHI_TYPE_1 << XHI_TYPE_SHIFT)
172 #define XHI_TYPE_2_READ ((XHI_TYPE_2 << XHI_TYPE_SHIFT) | \
173 (XHI_OP_READ << XHI_OP_SHIFT))
174
175 #define XHI_TYPE_2_WRITE ((XHI_TYPE_2 << XHI_TYPE_SHIFT) | \
176 (XHI_OP_WRITE << XHI_OP_SHIFT))
177
178 #define XHI_TYPE2_CNT_MASK 0x07FFFFFF
179
180 #define XHI_TYPE_1_PACKET_MAX_WORDS 2047UL
181 #define XHI_TYPE_1_HEADER_BYTES 4
182 #define XHI_TYPE_2_HEADER_BYTES 8
183
184
185 #define XHI_DISABLED_AUTO_CRC 0x0000DEFCUL
186
187
188 #define XHI_SR_CFGERR_N_MASK 0x00000100
189 #define XHI_SR_DALIGN_MASK 0x00000080
190 #define XHI_SR_RIP_MASK 0x00000040
191 #define XHI_SR_IN_ABORT_N_MASK 0x00000020
192 #define XHI_SR_DONE_MASK 0x00000001
193
194
195
196
197
198
199
200
201
202
203
204 static inline u32 hwicap_type_1_read(u32 reg)
205 {
206 return (XHI_TYPE_1 << XHI_TYPE_SHIFT) |
207 (reg << XHI_REGISTER_SHIFT) |
208 (XHI_OP_READ << XHI_OP_SHIFT);
209 }
210
211
212
213
214
215
216
217 static inline u32 hwicap_type_1_write(u32 reg)
218 {
219 return (XHI_TYPE_1 << XHI_TYPE_SHIFT) |
220 (reg << XHI_REGISTER_SHIFT) |
221 (XHI_OP_WRITE << XHI_OP_SHIFT);
222 }
223
224 #endif