OpenWrt – Blame information for rev 2
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | From ede8d823f0e1b2c5e14cbac13839b818ed1c18cf Mon Sep 17 00:00:00 2001 |
2 | From: Biwen Li <biwen.li@nxp.com> |
||
3 | Date: Tue, 30 Oct 2018 18:26:10 +0800 |
||
4 | Subject: [PATCH 07/40] apaa2-dpio:support layerscape |
||
5 | This is an integrated patch of dpaa2-dpio for layerscape |
||
6 | |||
7 | Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com> |
||
8 | Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com> |
||
9 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
||
10 | Signed-off-by: Guanhua Gao <guanhua.gao@nxp.com> |
||
11 | Signed-off-by: Haiying Wang <Haiying.Wang@nxp.com> |
||
12 | Signed-off-by: Horia Geantă <horia.geanta@nxp.com> |
||
13 | Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com> |
||
14 | Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com> |
||
15 | Signed-off-by: Radu Alexe <radu.alexe@nxp.com> |
||
16 | Signed-off-by: Roy Pledge <roy.pledge@nxp.com> |
||
17 | Signed-off-by: Biwen Li <biwen.li@nxp.com> |
||
18 | --- |
||
19 | drivers/staging/fsl-mc/Kconfig | 1 + |
||
20 | drivers/staging/fsl-mc/Makefile | 1 + |
||
21 | drivers/staging/fsl-mc/bus/Kconfig | 5 +- |
||
22 | drivers/staging/fsl-mc/bus/Makefile | 3 +- |
||
23 | drivers/staging/fsl-mc/bus/dpbp-cmd.h | 28 +- |
||
24 | drivers/staging/fsl-mc/bus/dpbp.c | 28 +- |
||
25 | drivers/staging/fsl-mc/bus/dpcon-cmd.h | 28 +- |
||
26 | drivers/staging/fsl-mc/bus/dpcon.c | 32 +- |
||
27 | drivers/staging/fsl-mc/bus/dpio/Makefile | 3 +- |
||
28 | drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h | 29 +- |
||
29 | drivers/staging/fsl-mc/bus/dpio/dpio-driver.c | 53 ++-- |
||
30 | .../staging/fsl-mc/bus/dpio/dpio-service.c | 258 +++++++++++++--- |
||
31 | drivers/staging/fsl-mc/bus/dpio/dpio.c | 51 ++-- |
||
32 | drivers/staging/fsl-mc/bus/dpio/dpio.h | 32 +- |
||
33 | .../staging/fsl-mc/bus/dpio/qbman-portal.c | 217 ++++++++++--- |
||
34 | .../staging/fsl-mc/bus/dpio/qbman-portal.h | 112 ++++--- |
||
35 | drivers/staging/fsl-mc/bus/dpmcp.c | 28 +- |
||
36 | drivers/staging/fsl-mc/bus/dprc-driver.c | 4 +- |
||
37 | drivers/staging/fsl-mc/bus/dprc.c | 28 +- |
||
38 | drivers/staging/fsl-mc/bus/fsl-mc-allocator.c | 4 +- |
||
39 | drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 4 +- |
||
40 | drivers/staging/fsl-mc/bus/fsl-mc-msi.c | 4 +- |
||
41 | drivers/staging/fsl-mc/bus/fsl-mc-private.h | 4 +- |
||
42 | .../fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c | 4 +- |
||
43 | drivers/staging/fsl-mc/bus/mc-io.c | 28 +- |
||
44 | drivers/staging/fsl-mc/bus/mc-sys.c | 28 +- |
||
45 | drivers/staging/fsl-mc/include/dpaa2-fd.h | 288 ++++++++++++++++-- |
||
46 | drivers/staging/fsl-mc/include/dpaa2-global.h | 27 +- |
||
47 | drivers/staging/fsl-mc/include/dpaa2-io.h | 97 ++++-- |
||
48 | drivers/staging/fsl-mc/include/dpbp.h | 29 +- |
||
49 | drivers/staging/fsl-mc/include/dpcon.h | 32 +- |
||
50 | drivers/staging/fsl-mc/include/dpopr.h | 110 +++++++ |
||
51 | drivers/staging/fsl-mc/include/mc.h | 4 +- |
||
52 | 33 files changed, 970 insertions(+), 634 deletions(-) |
||
53 | create mode 100644 drivers/staging/fsl-mc/include/dpopr.h |
||
54 | |||
55 | --- a/drivers/staging/fsl-mc/Kconfig |
||
56 | +++ b/drivers/staging/fsl-mc/Kconfig |
||
57 | @@ -1 +1,2 @@ |
||
58 | +# SPDX-License-Identifier: GPL-2.0 |
||
59 | source "drivers/staging/fsl-mc/bus/Kconfig" |
||
60 | --- a/drivers/staging/fsl-mc/Makefile |
||
61 | +++ b/drivers/staging/fsl-mc/Makefile |
||
62 | @@ -1,2 +1,3 @@ |
||
63 | +# SPDX-License-Identifier: GPL-2.0 |
||
64 | # Freescale Management Complex (MC) bus drivers |
||
65 | obj-$(CONFIG_FSL_MC_BUS) += bus/ |
||
66 | --- a/drivers/staging/fsl-mc/bus/Kconfig |
||
67 | +++ b/drivers/staging/fsl-mc/bus/Kconfig |
||
68 | @@ -1,10 +1,9 @@ |
||
69 | +# SPDX-License-Identifier: GPL-2.0 |
||
70 | # |
||
71 | # DPAA2 fsl-mc bus |
||
72 | # |
||
73 | # Copyright (C) 2014-2016 Freescale Semiconductor, Inc. |
||
74 | # |
||
75 | -# This file is released under the GPLv2 |
||
76 | -# |
||
77 | |||
78 | config FSL_MC_BUS |
||
79 | bool "QorIQ DPAA2 fsl-mc bus driver" |
||
80 | @@ -18,7 +17,7 @@ config FSL_MC_BUS |
||
81 | |||
82 | config FSL_MC_DPIO |
||
83 | tristate "QorIQ DPAA2 DPIO driver" |
||
84 | - depends on FSL_MC_BUS && ARCH_LAYERSCAPE |
||
85 | + depends on FSL_MC_BUS |
||
86 | help |
||
87 | Driver for the DPAA2 DPIO object. A DPIO provides queue and |
||
88 | buffer management facilities for software to interact with |
||
89 | --- a/drivers/staging/fsl-mc/bus/Makefile |
||
90 | +++ b/drivers/staging/fsl-mc/bus/Makefile |
||
91 | @@ -1,10 +1,9 @@ |
||
92 | +# SPDX-License-Identifier: GPL-2.0 |
||
93 | # |
||
94 | # Freescale Management Complex (MC) bus drivers |
||
95 | # |
||
96 | # Copyright (C) 2014 Freescale Semiconductor, Inc. |
||
97 | # |
||
98 | -# This file is released under the GPLv2 |
||
99 | -# |
||
100 | obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o |
||
101 | |||
102 | mc-bus-driver-objs := fsl-mc-bus.o \ |
||
103 | --- a/drivers/staging/fsl-mc/bus/dpbp-cmd.h |
||
104 | +++ b/drivers/staging/fsl-mc/bus/dpbp-cmd.h |
||
105 | @@ -1,33 +1,7 @@ |
||
106 | +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ |
||
107 | /* |
||
108 | * Copyright 2013-2016 Freescale Semiconductor Inc. |
||
109 | * |
||
110 | - * Redistribution and use in source and binary forms, with or without |
||
111 | - * modification, are permitted provided that the following conditions are met: |
||
112 | - * * Redistributions of source code must retain the above copyright |
||
113 | - * notice, this list of conditions and the following disclaimer. |
||
114 | - * * Redistributions in binary form must reproduce the above copyright |
||
115 | - * notice, this list of conditions and the following disclaimer in the |
||
116 | - * documentation and/or other materials provided with the distribution. |
||
117 | - * * Neither the name of the above-listed copyright holders nor the |
||
118 | - * names of any contributors may be used to endorse or promote products |
||
119 | - * derived from this software without specific prior written permission. |
||
120 | - * |
||
121 | - * ALTERNATIVELY, this software may be distributed under the terms of the |
||
122 | - * GNU General Public License ("GPL") as published by the Free Software |
||
123 | - * Foundation, either version 2 of that License or (at your option) any |
||
124 | - * later version. |
||
125 | - * |
||
126 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||
127 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
128 | - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
129 | - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE |
||
130 | - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||
131 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||
132 | - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||
133 | - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||
134 | - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||
135 | - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||
136 | - * POSSIBILITY OF SUCH DAMAGE. |
||
137 | */ |
||
138 | #ifndef _FSL_DPBP_CMD_H |
||
139 | #define _FSL_DPBP_CMD_H |
||
140 | --- a/drivers/staging/fsl-mc/bus/dpbp.c |
||
141 | +++ b/drivers/staging/fsl-mc/bus/dpbp.c |
||
142 | @@ -1,33 +1,7 @@ |
||
143 | +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) |
||
144 | /* |
||
145 | * Copyright 2013-2016 Freescale Semiconductor Inc. |
||
146 | * |
||
147 | - * Redistribution and use in source and binary forms, with or without |
||
148 | - * modification, are permitted provided that the following conditions are met: |
||
149 | - * * Redistributions of source code must retain the above copyright |
||
150 | - * notice, this list of conditions and the following disclaimer. |
||
151 | - * * Redistributions in binary form must reproduce the above copyright |
||
152 | - * notice, this list of conditions and the following disclaimer in the |
||
153 | - * documentation and/or other materials provided with the distribution. |
||
154 | - * * Neither the name of the above-listed copyright holders nor the |
||
155 | - * names of any contributors may be used to endorse or promote products |
||
156 | - * derived from this software without specific prior written permission. |
||
157 | - * |
||
158 | - * ALTERNATIVELY, this software may be distributed under the terms of the |
||
159 | - * GNU General Public License ("GPL") as published by the Free Software |
||
160 | - * Foundation, either version 2 of that License or (at your option) any |
||
161 | - * later version. |
||
162 | - * |
||
163 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||
164 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
165 | - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
166 | - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE |
||
167 | - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||
168 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||
169 | - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||
170 | - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||
171 | - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||
172 | - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||
173 | - * POSSIBILITY OF SUCH DAMAGE. |
||
174 | */ |
||
175 | #include <linux/kernel.h> |
||
176 | #include "../include/mc.h" |
||
177 | --- a/drivers/staging/fsl-mc/bus/dpcon-cmd.h |
||
178 | +++ b/drivers/staging/fsl-mc/bus/dpcon-cmd.h |
||
179 | @@ -1,33 +1,7 @@ |
||
180 | +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ |
||
181 | /* |
||
182 | * Copyright 2013-2016 Freescale Semiconductor Inc. |
||
183 | * |
||
184 | - * Redistribution and use in source and binary forms, with or without |
||
185 | - * modification, are permitted provided that the following conditions are met: |
||
186 | - * * Redistributions of source code must retain the above copyright |
||
187 | - * notice, this list of conditions and the following disclaimer. |
||
188 | - * * Redistributions in binary form must reproduce the above copyright |
||
189 | - * notice, this list of conditions and the following disclaimer in the |
||
190 | - * documentation and/or other materials provided with the distribution. |
||
191 | - * * Neither the name of the above-listed copyright holders nor the |
||
192 | - * names of any contributors may be used to endorse or promote products |
||
193 | - * derived from this software without specific prior written permission. |
||
194 | - * |
||
195 | - * ALTERNATIVELY, this software may be distributed under the terms of the |
||
196 | - * GNU General Public License ("GPL") as published by the Free Software |
||
197 | - * Foundation, either version 2 of that License or (at your option) any |
||
198 | - * later version. |
||
199 | - * |
||
200 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||
201 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
202 | - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
203 | - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE |
||
204 | - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||
205 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||
206 | - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||
207 | - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||
208 | - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||
209 | - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||
210 | - * POSSIBILITY OF SUCH DAMAGE. |
||
211 | */ |
||
212 | #ifndef _FSL_DPCON_CMD_H |
||
213 | #define _FSL_DPCON_CMD_H |
||
214 | --- a/drivers/staging/fsl-mc/bus/dpcon.c |
||
215 | +++ b/drivers/staging/fsl-mc/bus/dpcon.c |
||
216 | @@ -1,33 +1,7 @@ |
||
217 | -/* Copyright 2013-2016 Freescale Semiconductor Inc. |
||
218 | +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) |
||
219 | +/* |
||
220 | + * Copyright 2013-2016 Freescale Semiconductor Inc. |
||
221 | * |
||
222 | - * Redistribution and use in source and binary forms, with or without |
||
223 | - * modification, are permitted provided that the following conditions are met: |
||
224 | - * * Redistributions of source code must retain the above copyright |
||
225 | - * notice, this list of conditions and the following disclaimer. |
||
226 | - * * Redistributions in binary form must reproduce the above copyright |
||
227 | - * notice, this list of conditions and the following disclaimer in the |
||
228 | - * documentation and/or other materials provided with the distribution. |
||
229 | - * * Neither the name of the above-listed copyright holders nor the |
||
230 | - * names of any contributors may be used to endorse or promote products |
||
231 | - * derived from this software without specific prior written permission. |
||
232 | - * |
||
233 | - * |
||
234 | - * ALTERNATIVELY, this software may be distributed under the terms of the |
||
235 | - * GNU General Public License ("GPL") as published by the Free Software |
||
236 | - * Foundation, either version 2 of that License or (at your option) any |
||
237 | - * later version. |
||
238 | - * |
||
239 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||
240 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
241 | - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
242 | - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE |
||
243 | - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||
244 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||
245 | - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||
246 | - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||
247 | - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||
248 | - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||
249 | - * POSSIBILITY OF SUCH DAMAGE. |
||
250 | */ |
||
251 | #include <linux/kernel.h> |
||
252 | #include "../include/mc.h" |
||
253 | --- a/drivers/staging/fsl-mc/bus/dpio/Makefile |
||
254 | +++ b/drivers/staging/fsl-mc/bus/dpio/Makefile |
||
255 | @@ -1,9 +1,8 @@ |
||
256 | +# SPDX-License-Identifier: GPL-2.0 |
||
257 | # |
||
258 | # QorIQ DPAA2 DPIO driver |
||
259 | # |
||
260 | |||
261 | -subdir-ccflags-y := -Werror |
||
262 | - |
||
263 | obj-$(CONFIG_FSL_MC_DPIO) += fsl-mc-dpio.o |
||
264 | |||
265 | fsl-mc-dpio-objs := dpio.o qbman-portal.o dpio-service.o dpio-driver.o |
||
266 | --- a/drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h |
||
267 | +++ b/drivers/staging/fsl-mc/bus/dpio/dpio-cmd.h |
||
268 | @@ -1,34 +1,8 @@ |
||
269 | +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ |
||
270 | /* |
||
271 | * Copyright 2013-2016 Freescale Semiconductor Inc. |
||
272 | * Copyright 2016 NXP |
||
273 | * |
||
274 | - * Redistribution and use in source and binary forms, with or without |
||
275 | - * modification, are permitted provided that the following conditions are met: |
||
276 | - * * Redistributions of source code must retain the above copyright |
||
277 | - * notice, this list of conditions and the following disclaimer. |
||
278 | - * * Redistributions in binary form must reproduce the above copyright |
||
279 | - * notice, this list of conditions and the following disclaimer in the |
||
280 | - * documentation and/or other materials provided with the distribution. |
||
281 | - * * Neither the name of the above-listed copyright holders nor the |
||
282 | - * names of any contributors may be used to endorse or promote products |
||
283 | - * derived from this software without specific prior written permission. |
||
284 | - * |
||
285 | - * ALTERNATIVELY, this software may be distributed under the terms of the |
||
286 | - * GNU General Public License ("GPL") as published by the Free Software |
||
287 | - * Foundation, either version 2 of that License or (at your option) any |
||
288 | - * later version. |
||
289 | - * |
||
290 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||
291 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
292 | - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
293 | - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE |
||
294 | - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||
295 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||
296 | - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||
297 | - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||
298 | - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||
299 | - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||
300 | - * POSSIBILITY OF SUCH DAMAGE. |
||
301 | */ |
||
302 | #ifndef _FSL_DPIO_CMD_H |
||
303 | #define _FSL_DPIO_CMD_H |
||
304 | @@ -51,6 +25,7 @@ |
||
305 | #define DPIO_CMDID_ENABLE DPIO_CMD(0x002) |
||
306 | #define DPIO_CMDID_DISABLE DPIO_CMD(0x003) |
||
307 | #define DPIO_CMDID_GET_ATTR DPIO_CMD(0x004) |
||
308 | +#define DPIO_CMDID_RESET DPIO_CMD(0x005) |
||
309 | |||
310 | struct dpio_cmd_open { |
||
311 | __le32 dpio_id; |
||
312 | --- a/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c |
||
313 | +++ b/drivers/staging/fsl-mc/bus/dpio/dpio-driver.c |
||
314 | @@ -1,33 +1,8 @@ |
||
315 | +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) |
||
316 | /* |
||
317 | * Copyright 2014-2016 Freescale Semiconductor Inc. |
||
318 | - * Copyright NXP 2016 |
||
319 | + * Copyright 2016 NXP |
||
320 | * |
||
321 | - * Redistribution and use in source and binary forms, with or without |
||
322 | - * modification, are permitted provided that the following conditions are met: |
||
323 | - * * Redistributions of source code must retain the above copyright |
||
324 | - * notice, this list of conditions and the following disclaimer. |
||
325 | - * * Redistributions in binary form must reproduce the above copyright |
||
326 | - * notice, this list of conditions and the following disclaimer in the |
||
327 | - * documentation and/or other materials provided with the distribution. |
||
328 | - * * Neither the name of Freescale Semiconductor nor the |
||
329 | - * names of its contributors may be used to endorse or promote products |
||
330 | - * derived from this software without specific prior written permission. |
||
331 | - * |
||
332 | - * ALTERNATIVELY, this software may be distributed under the terms of the |
||
333 | - * GNU General Public License ("GPL") as published by the Free Software |
||
334 | - * Foundation, either version 2 of that License or (at your option) any |
||
335 | - * later version. |
||
336 | - * |
||
337 | - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY |
||
338 | - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||
339 | - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||
340 | - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY |
||
341 | - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
||
342 | - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||
343 | - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
||
344 | - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
345 | - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||
346 | - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
347 | */ |
||
348 | |||
349 | #include <linux/types.h> |
||
350 | @@ -114,6 +89,7 @@ static int dpaa2_dpio_probe(struct fsl_m |
||
351 | int err = -ENOMEM; |
||
352 | struct device *dev = &dpio_dev->dev; |
||
353 | static int next_cpu = -1; |
||
354 | + int possible_next_cpu; |
||
355 | |||
356 | priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); |
||
357 | if (!priv) |
||
358 | @@ -135,6 +111,12 @@ static int dpaa2_dpio_probe(struct fsl_m |
||
359 | goto err_open; |
||
360 | } |
||
361 | |||
362 | + err = dpio_reset(dpio_dev->mc_io, 0, dpio_dev->mc_handle); |
||
363 | + if (err) { |
||
364 | + dev_err(dev, "dpio_reset() failed\n"); |
||
365 | + goto err_reset; |
||
366 | + } |
||
367 | + |
||
368 | err = dpio_get_attributes(dpio_dev->mc_io, 0, dpio_dev->mc_handle, |
||
369 | &dpio_attrs); |
||
370 | if (err) { |
||
371 | @@ -156,23 +138,23 @@ static int dpaa2_dpio_probe(struct fsl_m |
||
372 | |||
373 | /* get the cpu to use for the affinity hint */ |
||
374 | if (next_cpu == -1) |
||
375 | - next_cpu = cpumask_first(cpu_online_mask); |
||
376 | + possible_next_cpu = cpumask_first(cpu_online_mask); |
||
377 | else |
||
378 | - next_cpu = cpumask_next(next_cpu, cpu_online_mask); |
||
379 | + possible_next_cpu = cpumask_next(next_cpu, cpu_online_mask); |
||
380 | |||
381 | - if (!cpu_possible(next_cpu)) { |
||
382 | + if (possible_next_cpu >= nr_cpu_ids) { |
||
383 | dev_err(dev, "probe failed. Number of DPIOs exceeds NR_CPUS.\n"); |
||
384 | err = -ERANGE; |
||
385 | goto err_allocate_irqs; |
||
386 | } |
||
387 | - desc.cpu = next_cpu; |
||
388 | + desc.cpu = next_cpu = possible_next_cpu; |
||
389 | |||
390 | /* |
||
391 | - * Set the CENA regs to be the cache inhibited area of the portal to |
||
392 | - * avoid coherency issues if a user migrates to another core. |
||
393 | + * Set the CENA regs to be the cache enabled area of the portal to |
||
394 | + * achieve the best performance. |
||
395 | */ |
||
396 | - desc.regs_cena = ioremap_wc(dpio_dev->regions[1].start, |
||
397 | - resource_size(&dpio_dev->regions[1])); |
||
398 | + desc.regs_cena = ioremap_cache_ns(dpio_dev->regions[0].start, |
||
399 | + resource_size(&dpio_dev->regions[0])); |
||
400 | desc.regs_cinh = ioremap(dpio_dev->regions[1].start, |
||
401 | resource_size(&dpio_dev->regions[1])); |
||
402 | |||
403 | @@ -207,6 +189,7 @@ err_register_dpio_irq: |
||
404 | err_allocate_irqs: |
||
405 | dpio_disable(dpio_dev->mc_io, 0, dpio_dev->mc_handle); |
||
406 | err_get_attr: |
||
407 | +err_reset: |
||
408 | dpio_close(dpio_dev->mc_io, 0, dpio_dev->mc_handle); |
||
409 | err_open: |
||
410 | fsl_mc_portal_free(dpio_dev->mc_io); |
||
411 | --- a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c |
||
412 | +++ b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c |
||
413 | @@ -1,33 +1,8 @@ |
||
414 | +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) |
||
415 | /* |
||
416 | * Copyright 2014-2016 Freescale Semiconductor Inc. |
||
417 | * Copyright 2016 NXP |
||
418 | * |
||
419 | - * Redistribution and use in source and binary forms, with or without |
||
420 | - * modification, are permitted provided that the following conditions are met: |
||
421 | - * * Redistributions of source code must retain the above copyright |
||
422 | - * notice, this list of conditions and the following disclaimer. |
||
423 | - * * Redistributions in binary form must reproduce the above copyright |
||
424 | - * notice, this list of conditions and the following disclaimer in the |
||
425 | - * documentation and/or other materials provided with the distribution. |
||
426 | - * * Neither the name of Freescale Semiconductor nor the |
||
427 | - * names of its contributors may be used to endorse or promote products |
||
428 | - * derived from this software without specific prior written permission. |
||
429 | - * |
||
430 | - * ALTERNATIVELY, this software may be distributed under the terms of the |
||
431 | - * GNU General Public License ("GPL") as published by the Free Software |
||
432 | - * Foundation, either version 2 of that License or (at your option) any |
||
433 | - * later version. |
||
434 | - * |
||
435 | - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY |
||
436 | - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||
437 | - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||
438 | - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY |
||
439 | - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
||
440 | - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||
441 | - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
||
442 | - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
443 | - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||
444 | - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
445 | */ |
||
446 | #include <linux/types.h> |
||
447 | #include "../../include/mc.h" |
||
448 | @@ -43,7 +18,6 @@ |
||
449 | #include "qbman-portal.h" |
||
450 | |||
451 | struct dpaa2_io { |
||
452 | - atomic_t refs; |
||
453 | struct dpaa2_io_desc dpio_desc; |
||
454 | struct qbman_swp_desc swp_desc; |
||
455 | struct qbman_swp *swp; |
||
456 | @@ -83,7 +57,7 @@ static inline struct dpaa2_io *service_s |
||
457 | * If cpu == -1, choose the current cpu, with no guarantees about |
||
458 | * potentially being migrated away. |
||
459 | */ |
||
460 | - if (unlikely(cpu < 0)) |
||
461 | + if (cpu < 0) |
||
462 | cpu = smp_processor_id(); |
||
463 | |||
464 | /* If a specific cpu was requested, pick it up immediately */ |
||
465 | @@ -95,6 +69,10 @@ static inline struct dpaa2_io *service_s |
||
466 | if (d) |
||
467 | return d; |
||
468 | |||
469 | + d = service_select_by_cpu(d, -1); |
||
470 | + if (d) |
||
471 | + return d; |
||
472 | + |
||
473 | spin_lock(&dpio_list_lock); |
||
474 | d = list_entry(dpio_list.next, struct dpaa2_io, node); |
||
475 | list_del(&d->node); |
||
476 | @@ -105,6 +83,23 @@ static inline struct dpaa2_io *service_s |
||
477 | } |
||
478 | |||
479 | /** |
||
480 | + * dpaa2_io_service_select() - return a dpaa2_io service affined to this cpu |
||
481 | + * @cpu: the cpu id |
||
482 | + * |
||
483 | + * Return the affine dpaa2_io service, or NULL if there is no service affined |
||
484 | + * to the specified cpu. If DPAA2_IO_ANY_CPU is used, return the next available |
||
485 | + * service. |
||
486 | + */ |
||
487 | +struct dpaa2_io *dpaa2_io_service_select(int cpu) |
||
488 | +{ |
||
489 | + if (cpu == DPAA2_IO_ANY_CPU) |
||
490 | + return service_select(NULL); |
||
491 | + |
||
492 | + return service_select_by_cpu(NULL, cpu); |
||
493 | +} |
||
494 | +EXPORT_SYMBOL_GPL(dpaa2_io_service_select); |
||
495 | + |
||
496 | +/** |
||
497 | * dpaa2_io_create() - create a dpaa2_io object. |
||
498 | * @desc: the dpaa2_io descriptor |
||
499 | * |
||
500 | @@ -126,7 +121,6 @@ struct dpaa2_io *dpaa2_io_create(const s |
||
501 | return NULL; |
||
502 | } |
||
503 | |||
504 | - atomic_set(&obj->refs, 1); |
||
505 | obj->dpio_desc = *desc; |
||
506 | obj->swp_desc.cena_bar = obj->dpio_desc.regs_cena; |
||
507 | obj->swp_desc.cinh_bar = obj->dpio_desc.regs_cinh; |
||
508 | @@ -158,7 +152,6 @@ struct dpaa2_io *dpaa2_io_create(const s |
||
509 | |||
510 | return obj; |
||
511 | } |
||
512 | -EXPORT_SYMBOL(dpaa2_io_create); |
||
513 | |||
514 | /** |
||
515 | * dpaa2_io_down() - release the dpaa2_io object. |
||
516 | @@ -171,11 +164,8 @@ EXPORT_SYMBOL(dpaa2_io_create); |
||
517 | */ |
||
518 | void dpaa2_io_down(struct dpaa2_io *d) |
||
519 | { |
||
520 | - if (!atomic_dec_and_test(&d->refs)) |
||
521 | - return; |
||
522 | kfree(d); |
||
523 | } |
||
524 | -EXPORT_SYMBOL(dpaa2_io_down); |
||
525 | |||
526 | #define DPAA_POLL_MAX 32 |
||
527 | |||
528 | @@ -206,7 +196,7 @@ irqreturn_t dpaa2_io_irq(struct dpaa2_io |
||
529 | u64 q64; |
||
530 | |||
531 | q64 = qbman_result_SCN_ctx(dq); |
||
532 | - ctx = (void *)q64; |
||
533 | + ctx = (void *)(uintptr_t)q64; |
||
534 | ctx->cb(ctx); |
||
535 | } else { |
||
536 | pr_crit("fsl-mc-dpio: Unrecognised/ignored DQRR entry\n"); |
||
537 | @@ -222,7 +212,6 @@ done: |
||
538 | qbman_swp_interrupt_set_inhibit(swp, 0); |
||
539 | return IRQ_HANDLED; |
||
540 | } |
||
541 | -EXPORT_SYMBOL(dpaa2_io_irq); |
||
542 | |||
543 | /** |
||
544 | * dpaa2_io_service_register() - Prepare for servicing of FQDAN or CDAN |
||
545 | @@ -252,7 +241,7 @@ int dpaa2_io_service_register(struct dpa |
||
546 | return -ENODEV; |
||
547 | |||
548 | ctx->dpio_id = d->dpio_desc.dpio_id; |
||
549 | - ctx->qman64 = (u64)ctx; |
||
550 | + ctx->qman64 = (u64)(uintptr_t)ctx; |
||
551 | ctx->dpio_private = d; |
||
552 | spin_lock_irqsave(&d->lock_notifications, irqflags); |
||
553 | list_add(&ctx->node, &d->notifications); |
||
554 | @@ -265,7 +254,7 @@ int dpaa2_io_service_register(struct dpa |
||
555 | ctx->qman64); |
||
556 | return 0; |
||
557 | } |
||
558 | -EXPORT_SYMBOL(dpaa2_io_service_register); |
||
559 | +EXPORT_SYMBOL_GPL(dpaa2_io_service_register); |
||
560 | |||
561 | /** |
||
562 | * dpaa2_io_service_deregister - The opposite of 'register'. |
||
563 | @@ -288,7 +277,7 @@ void dpaa2_io_service_deregister(struct |
||
564 | list_del(&ctx->node); |
||
565 | spin_unlock_irqrestore(&d->lock_notifications, irqflags); |
||
566 | } |
||
567 | -EXPORT_SYMBOL(dpaa2_io_service_deregister); |
||
568 | +EXPORT_SYMBOL_GPL(dpaa2_io_service_deregister); |
||
569 | |||
570 | /** |
||
571 | * dpaa2_io_service_rearm() - Rearm the notification for the given DPIO service. |
||
572 | @@ -322,7 +311,7 @@ int dpaa2_io_service_rearm(struct dpaa2_ |
||
573 | |||
574 | return err; |
||
575 | } |
||
576 | -EXPORT_SYMBOL(dpaa2_io_service_rearm); |
||
577 | +EXPORT_SYMBOL_GPL(dpaa2_io_service_rearm); |
||
578 | |||
579 | /** |
||
580 | * dpaa2_io_service_pull_fq() - pull dequeue functions from a fq. |
||
581 | @@ -385,7 +374,7 @@ int dpaa2_io_service_pull_channel(struct |
||
582 | |||
583 | return err; |
||
584 | } |
||
585 | -EXPORT_SYMBOL(dpaa2_io_service_pull_channel); |
||
586 | +EXPORT_SYMBOL_GPL(dpaa2_io_service_pull_channel); |
||
587 | |||
588 | /** |
||
589 | * dpaa2_io_service_enqueue_fq() - Enqueue a frame to a frame queue. |
||
590 | @@ -441,7 +430,7 @@ int dpaa2_io_service_enqueue_qd(struct d |
||
591 | |||
592 | return qbman_swp_enqueue(d->swp, &ed, fd); |
||
593 | } |
||
594 | -EXPORT_SYMBOL(dpaa2_io_service_enqueue_qd); |
||
595 | +EXPORT_SYMBOL_GPL(dpaa2_io_service_enqueue_qd); |
||
596 | |||
597 | /** |
||
598 | * dpaa2_io_service_release() - Release buffers to a buffer pool. |
||
599 | @@ -453,7 +442,7 @@ EXPORT_SYMBOL(dpaa2_io_service_enqueue_q |
||
600 | * Return 0 for success, and negative error code for failure. |
||
601 | */ |
||
602 | int dpaa2_io_service_release(struct dpaa2_io *d, |
||
603 | - u32 bpid, |
||
604 | + u16 bpid, |
||
605 | const u64 *buffers, |
||
606 | unsigned int num_buffers) |
||
607 | { |
||
608 | @@ -468,7 +457,7 @@ int dpaa2_io_service_release(struct dpaa |
||
609 | |||
610 | return qbman_swp_release(d->swp, &rd, buffers, num_buffers); |
||
611 | } |
||
612 | -EXPORT_SYMBOL(dpaa2_io_service_release); |
||
613 | +EXPORT_SYMBOL_GPL(dpaa2_io_service_release); |
||
614 | |||
615 | /** |
||
616 | * dpaa2_io_service_acquire() - Acquire buffers from a buffer pool. |
||
617 | @@ -482,7 +471,7 @@ EXPORT_SYMBOL(dpaa2_io_service_release); |
||
618 | * Eg. if the buffer pool is empty, this will return zero. |
||
619 | */ |
||
620 | int dpaa2_io_service_acquire(struct dpaa2_io *d, |
||
621 | - u32 bpid, |
||
622 | + u16 bpid, |
||
623 | u64 *buffers, |
||
624 | unsigned int num_buffers) |
||
625 | { |
||
626 | @@ -499,7 +488,7 @@ int dpaa2_io_service_acquire(struct dpaa |
||
627 | |||
628 | return err; |
||
629 | } |
||
630 | -EXPORT_SYMBOL(dpaa2_io_service_acquire); |
||
631 | +EXPORT_SYMBOL_GPL(dpaa2_io_service_acquire); |
||
632 | |||
633 | /* |
||
634 | * 'Stores' are reusable memory blocks for holding dequeue results, and to |
||
635 | @@ -553,7 +542,7 @@ struct dpaa2_io_store *dpaa2_io_store_cr |
||
636 | |||
637 | return ret; |
||
638 | } |
||
639 | -EXPORT_SYMBOL(dpaa2_io_store_create); |
||
640 | +EXPORT_SYMBOL_GPL(dpaa2_io_store_create); |
||
641 | |||
642 | /** |
||
643 | * dpaa2_io_store_destroy() - Frees the dma memory storage for dequeue |
||
644 | @@ -567,7 +556,7 @@ void dpaa2_io_store_destroy(struct dpaa2 |
||
645 | kfree(s->alloced_addr); |
||
646 | kfree(s); |
||
647 | } |
||
648 | -EXPORT_SYMBOL(dpaa2_io_store_destroy); |
||
649 | +EXPORT_SYMBOL_GPL(dpaa2_io_store_destroy); |
||
650 | |||
651 | /** |
||
652 | * dpaa2_io_store_next() - Determine when the next dequeue result is available. |
||
653 | @@ -615,4 +604,177 @@ struct dpaa2_dq *dpaa2_io_store_next(str |
||
654 | |||
655 | return ret; |
||
656 | } |
||
657 | -EXPORT_SYMBOL(dpaa2_io_store_next); |
||
658 | +EXPORT_SYMBOL_GPL(dpaa2_io_store_next); |
||
659 | + |
||
660 | +/** |
||
661 | + * dpaa2_io_query_fq_count() - Get the frame and byte count for a given fq. |
||
662 | + * @d: the given DPIO object. |
||
663 | + * @fqid: the id of frame queue to be queried. |
||
664 | + * @fcnt: the queried frame count. |
||
665 | + * @bcnt: the queried byte count. |
||
666 | + * |
||
667 | + * Knowing the FQ count at run-time can be useful in debugging situations. |
||
668 | + * The instantaneous frame- and byte-count are hereby returned. |
||
669 | + * |
||
670 | + * Return 0 for a successful query, and negative error code if query fails. |
||
671 | + */ |
||
672 | +int dpaa2_io_query_fq_count(struct dpaa2_io *d, u32 fqid, |
||
673 | + u32 *fcnt, u32 *bcnt) |
||
674 | +{ |
||
675 | + struct qbman_fq_query_np_rslt state; |
||
676 | + struct qbman_swp *swp; |
||
677 | + unsigned long irqflags; |
||
678 | + int ret; |
||
679 | + |
||
680 | + d = service_select(d); |
||
681 | + if (!d) |
||
682 | + return -ENODEV; |
||
683 | + |
||
684 | + swp = d->swp; |
||
685 | + spin_lock_irqsave(&d->lock_mgmt_cmd, irqflags); |
||
686 | + ret = qbman_fq_query_state(swp, fqid, &state); |
||
687 | + spin_unlock_irqrestore(&d->lock_mgmt_cmd, irqflags); |
||
688 | + if (ret) |
||
689 | + return ret; |
||
690 | + *fcnt = qbman_fq_state_frame_count(&state); |
||
691 | + *bcnt = qbman_fq_state_byte_count(&state); |
||
692 | + |
||
693 | + return 0; |
||
694 | +} |
||
695 | +EXPORT_SYMBOL_GPL(dpaa2_io_query_fq_count); |
||
696 | + |
||
697 | +/** |
||
698 | + * dpaa2_io_query_bp_count() - Query the number of buffers currently in a |
||
699 | + * buffer pool. |
||
700 | + * @d: the given DPIO object. |
||
701 | + * @bpid: the index of buffer pool to be queried. |
||
702 | + * @num: the queried number of buffers in the buffer pool. |
||
703 | + * |
||
704 | + * Return 0 for a successful query, and negative error code if query fails. |
||
705 | + */ |
||
706 | +int dpaa2_io_query_bp_count(struct dpaa2_io *d, u16 bpid, u32 *num) |
||
707 | +{ |
||
708 | + struct qbman_bp_query_rslt state; |
||
709 | + struct qbman_swp *swp; |
||
710 | + unsigned long irqflags; |
||
711 | + int ret; |
||
712 | + |
||
713 | + d = service_select(d); |
||
714 | + if (!d) |
||
715 | + return -ENODEV; |
||
716 | + |
||
717 | + swp = d->swp; |
||
718 | + spin_lock_irqsave(&d->lock_mgmt_cmd, irqflags); |
||
719 | + ret = qbman_bp_query(swp, bpid, &state); |
||
720 | + spin_unlock_irqrestore(&d->lock_mgmt_cmd, irqflags); |
||
721 | + if (ret) |
||
722 | + return ret; |
||
723 | + *num = qbman_bp_info_num_free_bufs(&state); |
||
724 | + return 0; |
||
725 | +} |
||
726 | +EXPORT_SYMBOL_GPL(dpaa2_io_query_bp_count); |
||
727 | + |
||
728 | +/** |
||
729 | + * dpaa2_io_service_enqueue_orp_fq() - Enqueue a frame to a frame queue with |
||
730 | + * order restoration |
||
731 | + * @d: the given DPIO service. |
||
732 | + * @fqid: the given frame queue id. |
||
733 | + * @fd: the frame descriptor which is enqueued. |
||
734 | + * @orpid: the order restoration point ID |
||
735 | + * @seqnum: the order sequence number |
||
736 | + * @last: must be set for the final frame if seqnum is shared (spilt frame) |
||
737 | + * |
||
738 | + * Performs an enqueue to a frame queue using the specified order restoration |
||
739 | + * point. The QMan device will ensure the order of frames placed on the |
||
740 | + * queue will be ordered as per the sequence number. |
||
741 | + * |
||
742 | + * In the case a frame is split it is possible to enqueue using the same |
||
743 | + * sequence number more than once. The final frame in a shared sequence number |
||
744 | + * most be indicated by setting last = 1. For non shared sequence numbers |
||
745 | + * last = 1 must always be set. |
||
746 | + * |
||
747 | + * Return 0 for successful enqueue, or -EBUSY if the enqueue ring is not ready, |
||
748 | + * or -ENODEV if there is no dpio service. |
||
749 | + */ |
||
750 | +int dpaa2_io_service_enqueue_orp_fq(struct dpaa2_io *d, u32 fqid, |
||
751 | + const struct dpaa2_fd *fd, u16 orpid, |
||
752 | + u16 seqnum, int last) |
||
753 | +{ |
||
754 | + struct qbman_eq_desc ed; |
||
755 | + |
||
756 | + d = service_select(d); |
||
757 | + if (!d) |
||
758 | + return -ENODEV; |
||
759 | + qbman_eq_desc_clear(&ed); |
||
760 | + qbman_eq_desc_set_orp(&ed, 0, orpid, seqnum, !last); |
||
761 | + qbman_eq_desc_set_fq(&ed, fqid); |
||
762 | + return qbman_swp_enqueue(d->swp, &ed, fd); |
||
763 | +} |
||
764 | +EXPORT_SYMBOL(dpaa2_io_service_enqueue_orp_fq); |
||
765 | + |
||
766 | +/** |
||
767 | + * dpaa2_io_service_enqueue_orp_qd() - Enqueue a frame to a queueing destination |
||
768 | + * with order restoration |
||
769 | + * @d: the given DPIO service. |
||
770 | + * @qdid: the given queuing destination id. |
||
771 | + * @fd: the frame descriptor which is enqueued. |
||
772 | + * @orpid: the order restoration point ID |
||
773 | + * @seqnum: the order sequence number |
||
774 | + * @last: must be set for the final frame if seqnum is shared (spilt frame) |
||
775 | + * |
||
776 | + * Performs an enqueue to a frame queue using the specified order restoration |
||
777 | + * point. The QMan device will ensure the order of frames placed on the |
||
778 | + * queue will be ordered as per the sequence number. |
||
779 | + * |
||
780 | + * In the case a frame is split it is possible to enqueue using the same |
||
781 | + * sequence number more than once. The final frame in a shared sequence number |
||
782 | + * most be indicated by setting last = 1. For non shared sequence numbers |
||
783 | + * last = 1 must always be set. |
||
784 | + * |
||
785 | + * Return 0 for successful enqueue, or -EBUSY if the enqueue ring is not ready, |
||
786 | + * or -ENODEV if there is no dpio service. |
||
787 | + */ |
||
788 | +int dpaa2_io_service_enqueue_orp_qd(struct dpaa2_io *d, u32 qdid, u8 prio, |
||
789 | + u16 qdbin, const struct dpaa2_fd *fd, |
||
790 | + u16 orpid, u16 seqnum, int last) |
||
791 | +{ |
||
792 | + struct qbman_eq_desc ed; |
||
793 | + |
||
794 | + d = service_select(d); |
||
795 | + if (!d) |
||
796 | + return -ENODEV; |
||
797 | + qbman_eq_desc_clear(&ed); |
||
798 | + qbman_eq_desc_set_orp(&ed, 0, orpid, seqnum, !last); |
||
799 | + qbman_eq_desc_set_qd(&ed, qdid, qdbin, prio); |
||
800 | + return qbman_swp_enqueue(d->swp, &ed, fd); |
||
801 | +} |
||
802 | +EXPORT_SYMBOL_GPL(dpaa2_io_service_enqueue_orp_qd); |
||
803 | + |
||
804 | +/** |
||
805 | + * dpaa2_io_service_orp_seqnum_drop() - Remove a sequence number from |
||
806 | + * an order restoration list |
||
807 | + * @d: the given DPIO service. |
||
808 | + * @orpid: Order restoration point to remove a sequence number from |
||
809 | + * @seqnum: Sequence number to remove |
||
810 | + * |
||
811 | + * Removes a frames sequence number from an order restoration point without |
||
812 | + * enqueing the frame. Used to indicate that the order restoration hardware |
||
813 | + * should not expect to see this sequence number. Typically used to indicate |
||
814 | + * a frame was terminated or dropped from a flow. |
||
815 | + * |
||
816 | + * Return 0 for successful enqueue, or -EBUSY if the enqueue ring is not ready, |
||
817 | + * or -ENODEV if there is no dpio service. |
||
818 | + */ |
||
819 | +int dpaa2_io_service_orp_seqnum_drop(struct dpaa2_io *d, u16 orpid, u16 seqnum) |
||
820 | +{ |
||
821 | + struct qbman_eq_desc ed; |
||
822 | + struct dpaa2_fd fd; |
||
823 | + |
||
824 | + d = service_select(d); |
||
825 | + if (!d) |
||
826 | + return -ENODEV; |
||
827 | + qbman_eq_desc_clear(&ed); |
||
828 | + qbman_eq_desc_set_orp_hole(&ed, orpid, seqnum); |
||
829 | + return qbman_swp_enqueue(d->swp, &ed, &fd); |
||
830 | +} |
||
831 | +EXPORT_SYMBOL_GPL(dpaa2_io_service_orp_seqnum_drop); |
||
832 | --- a/drivers/staging/fsl-mc/bus/dpio/dpio.c |
||
833 | +++ b/drivers/staging/fsl-mc/bus/dpio/dpio.c |
||
834 | @@ -1,34 +1,8 @@ |
||
835 | +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) |
||
836 | /* |
||
837 | * Copyright 2013-2016 Freescale Semiconductor Inc. |
||
838 | * Copyright 2016 NXP |
||
839 | * |
||
840 | - * Redistribution and use in source and binary forms, with or without |
||
841 | - * modification, are permitted provided that the following conditions are met: |
||
842 | - * * Redistributions of source code must retain the above copyright |
||
843 | - * notice, this list of conditions and the following disclaimer. |
||
844 | - * * Redistributions in binary form must reproduce the above copyright |
||
845 | - * notice, this list of conditions and the following disclaimer in the |
||
846 | - * documentation and/or other materials provided with the distribution. |
||
847 | - * * Neither the name of the above-listed copyright holders nor the |
||
848 | - * names of any contributors may be used to endorse or promote products |
||
849 | - * derived from this software without specific prior written permission. |
||
850 | - * |
||
851 | - * ALTERNATIVELY, this software may be distributed under the terms of the |
||
852 | - * GNU General Public License ("GPL") as published by the Free Software |
||
853 | - * Foundation, either version 2 of that License or (at your option) any |
||
854 | - * later version. |
||
855 | - * |
||
856 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||
857 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
858 | - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
859 | - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE |
||
860 | - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||
861 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||
862 | - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||
863 | - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||
864 | - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||
865 | - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||
866 | - * POSSIBILITY OF SUCH DAMAGE. |
||
867 | */ |
||
868 | #include <linux/kernel.h> |
||
869 | #include "../../include/mc.h" |
||
870 | @@ -222,3 +196,26 @@ int dpio_get_api_version(struct fsl_mc_i |
||
871 | |||
872 | return 0; |
||
873 | } |
||
874 | + |
||
875 | +/** |
||
876 | + * dpio_reset() - Reset the DPIO, returns the object to initial state. |
||
877 | + * @mc_io: Pointer to MC portal's I/O object |
||
878 | + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' |
||
879 | + * @token: Token of DPIO object |
||
880 | + * |
||
881 | + * Return: '0' on Success; Error code otherwise. |
||
882 | + */ |
||
883 | +int dpio_reset(struct fsl_mc_io *mc_io, |
||
884 | + u32 cmd_flags, |
||
885 | + u16 token) |
||
886 | +{ |
||
887 | + struct fsl_mc_command cmd = { 0 }; |
||
888 | + |
||
889 | + /* prepare command */ |
||
890 | + cmd.header = mc_encode_cmd_header(DPIO_CMDID_RESET, |
||
891 | + cmd_flags, |
||
892 | + token); |
||
893 | + |
||
894 | + /* send command to mc*/ |
||
895 | + return mc_send_command(mc_io, &cmd); |
||
896 | +} |
||
897 | --- a/drivers/staging/fsl-mc/bus/dpio/dpio.h |
||
898 | +++ b/drivers/staging/fsl-mc/bus/dpio/dpio.h |
||
899 | @@ -1,34 +1,8 @@ |
||
900 | +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ |
||
901 | /* |
||
902 | * Copyright 2013-2016 Freescale Semiconductor Inc. |
||
903 | * Copyright 2016 NXP |
||
904 | * |
||
905 | - * Redistribution and use in source and binary forms, with or without |
||
906 | - * modification, are permitted provided that the following conditions are met: |
||
907 | - * * Redistributions of source code must retain the above copyright |
||
908 | - * notice, this list of conditions and the following disclaimer. |
||
909 | - * * Redistributions in binary form must reproduce the above copyright |
||
910 | - * notice, this list of conditions and the following disclaimer in the |
||
911 | - * documentation and/or other materials provided with the distribution. |
||
912 | - * * Neither the name of the above-listed copyright holders nor the |
||
913 | - * names of any contributors may be used to endorse or promote products |
||
914 | - * derived from this software without specific prior written permission. |
||
915 | - * |
||
916 | - * ALTERNATIVELY, this software may be distributed under the terms of the |
||
917 | - * GNU General Public License ("GPL") as published by the Free Software |
||
918 | - * Foundation, either version 2 of that License or (at your option) any |
||
919 | - * later version. |
||
920 | - * |
||
921 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||
922 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
923 | - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
924 | - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE |
||
925 | - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||
926 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||
927 | - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||
928 | - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||
929 | - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||
930 | - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||
931 | - * POSSIBILITY OF SUCH DAMAGE. |
||
932 | */ |
||
933 | #ifndef __FSL_DPIO_H |
||
934 | #define __FSL_DPIO_H |
||
935 | @@ -106,4 +80,8 @@ int dpio_get_api_version(struct fsl_mc_i |
||
936 | u16 *major_ver, |
||
937 | u16 *minor_ver); |
||
938 | |||
939 | +int dpio_reset(struct fsl_mc_io *mc_io, |
||
940 | + u32 cmd_flags, |
||
941 | + u16 token); |
||
942 | + |
||
943 | #endif /* __FSL_DPIO_H */ |
||
944 | --- a/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c |
||
945 | +++ b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.c |
||
946 | @@ -1,33 +1,8 @@ |
||
947 | +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) |
||
948 | /* |
||
949 | * Copyright (C) 2014-2016 Freescale Semiconductor, Inc. |
||
950 | * Copyright 2016 NXP |
||
951 | * |
||
952 | - * Redistribution and use in source and binary forms, with or without |
||
953 | - * modification, are permitted provided that the following conditions are met: |
||
954 | - * * Redistributions of source code must retain the above copyright |
||
955 | - * notice, this list of conditions and the following disclaimer. |
||
956 | - * * Redistributions in binary form must reproduce the above copyright |
||
957 | - * notice, this list of conditions and the following disclaimer in the |
||
958 | - * documentation and/or other materials provided with the distribution. |
||
959 | - * * Neither the name of Freescale Semiconductor nor the |
||
960 | - * names of its contributors may be used to endorse or promote products |
||
961 | - * derived from this software without specific prior written permission. |
||
962 | - * |
||
963 | - * ALTERNATIVELY, this software may be distributed under the terms of the |
||
964 | - * GNU General Public License ("GPL") as published by the Free Software |
||
965 | - * Foundation, either version 2 of that License or (at your option) any |
||
966 | - * later version. |
||
967 | - * |
||
968 | - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY |
||
969 | - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||
970 | - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||
971 | - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY |
||
972 | - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
||
973 | - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||
974 | - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
||
975 | - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
976 | - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||
977 | - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
978 | */ |
||
979 | |||
980 | #include <asm/cacheflush.h> |
||
981 | @@ -99,6 +74,14 @@ enum qbman_sdqcr_fc { |
||
982 | qbman_sdqcr_fc_up_to_3 = 1 |
||
983 | }; |
||
984 | |||
985 | +#define dccvac(p) { asm volatile("dc cvac, %0;" : : "r" (p) : "memory"); } |
||
986 | +#define dcivac(p) { asm volatile("dc ivac, %0" : : "r"(p) : "memory"); } |
||
987 | +static inline void qbman_inval_prefetch(struct qbman_swp *p, uint32_t offset) |
||
988 | +{ |
||
989 | + dcivac(p->addr_cena + offset); |
||
990 | + prefetch(p->addr_cena + offset); |
||
991 | +} |
||
992 | + |
||
993 | /* Portal Access */ |
||
994 | |||
995 | static inline u32 qbman_read_register(struct qbman_swp *p, u32 offset) |
||
996 | @@ -189,7 +172,7 @@ struct qbman_swp *qbman_swp_init(const s |
||
997 | p->addr_cinh = d->cinh_bar; |
||
998 | |||
999 | reg = qbman_set_swp_cfg(p->dqrr.dqrr_size, |
||
1000 | - 1, /* Writes Non-cacheable */ |
||
1001 | + 0, /* Writes cacheable */ |
||
1002 | 0, /* EQCR_CI stashing threshold */ |
||
1003 | 3, /* RPM: Valid bit mode, RCR in array mode */ |
||
1004 | 2, /* DCM: Discrete consumption ack mode */ |
||
1005 | @@ -315,6 +298,7 @@ void qbman_swp_mc_submit(struct qbman_sw |
||
1006 | |||
1007 | dma_wmb(); |
||
1008 | *v = cmd_verb | p->mc.valid_bit; |
||
1009 | + dccvac(cmd); |
||
1010 | } |
||
1011 | |||
1012 | /* |
||
1013 | @@ -325,6 +309,7 @@ void *qbman_swp_mc_result(struct qbman_s |
||
1014 | { |
||
1015 | u32 *ret, verb; |
||
1016 | |||
1017 | + qbman_inval_prefetch(p, QBMAN_CENA_SWP_RR(p->mc.valid_bit)); |
||
1018 | ret = qbman_get_cmd(p, QBMAN_CENA_SWP_RR(p->mc.valid_bit)); |
||
1019 | |||
1020 | /* Remove the valid-bit - command completed if the rest is non-zero */ |
||
1021 | @@ -370,6 +355,43 @@ void qbman_eq_desc_set_no_orp(struct qbm |
||
1022 | d->verb |= enqueue_rejects_to_fq; |
||
1023 | } |
||
1024 | |||
1025 | +/** |
||
1026 | + * qbman_eq_desc_set_orp() - Set order-restoration in the enqueue descriptor |
||
1027 | + * @d: the enqueue descriptor. |
||
1028 | + * @response_success: 1 = enqueue with response always; 0 = enqueue with |
||
1029 | + * rejections returned on a FQ. |
||
1030 | + * @oprid: the order point record id. |
||
1031 | + * @seqnum: the order restoration sequence number. |
||
1032 | + * @incomplete: indicates whether this is the last fragments using the same |
||
1033 | + * sequence number. |
||
1034 | + */ |
||
1035 | +void qbman_eq_desc_set_orp(struct qbman_eq_desc *d, int respond_success, |
||
1036 | + u16 oprid, u16 seqnum, int incomplete) |
||
1037 | +{ |
||
1038 | + d->verb |= (1 << QB_ENQUEUE_CMD_ORP_ENABLE_SHIFT); |
||
1039 | + if (respond_success) |
||
1040 | + d->verb |= enqueue_response_always; |
||
1041 | + else |
||
1042 | + d->verb |= enqueue_rejects_to_fq; |
||
1043 | + d->orpid = cpu_to_le16(oprid); |
||
1044 | + d->seqnum = cpu_to_le16((!!incomplete << 14) | seqnum); |
||
1045 | +} |
||
1046 | + |
||
1047 | +/** |
||
1048 | + * qbman_eq_desc_set_orp_hole() - fill a hole in the order-restoration sequence |
||
1049 | + * without any enqueue |
||
1050 | + * @d: the enqueue descriptor. |
||
1051 | + * @oprid: the order point record id. |
||
1052 | + * @seqnum: the order restoration sequence number. |
||
1053 | + */ |
||
1054 | +void qbman_eq_desc_set_orp_hole(struct qbman_eq_desc *d, u16 oprid, |
||
1055 | + u16 seqnum) |
||
1056 | +{ |
||
1057 | + d->verb |= (1 << QB_ENQUEUE_CMD_ORP_ENABLE_SHIFT) | enqueue_empty; |
||
1058 | + d->orpid = cpu_to_le16(oprid); |
||
1059 | + d->seqnum = cpu_to_le16(seqnum); |
||
1060 | +} |
||
1061 | + |
||
1062 | /* |
||
1063 | * Exactly one of the following descriptor "targets" should be set. (Calling any |
||
1064 | * one of these will replace the effect of any prior call to one of these.) |
||
1065 | @@ -429,12 +451,23 @@ int qbman_swp_enqueue(struct qbman_swp * |
||
1066 | return -EBUSY; |
||
1067 | |||
1068 | p = qbman_get_cmd(s, QBMAN_CENA_SWP_EQCR(EQAR_IDX(eqar))); |
||
1069 | - memcpy(&p->dca, &d->dca, 31); |
||
1070 | + /* This is mapped as DEVICE type memory, writes are |
||
1071 | + * with address alignment: |
||
1072 | + * desc.dca address alignment = 1 |
||
1073 | + * desc.seqnum address alignment = 2 |
||
1074 | + * desc.orpid address alignment = 4 |
||
1075 | + * desc.tgtid address alignment = 8 |
||
1076 | + */ |
||
1077 | + p->dca = d->dca; |
||
1078 | + p->seqnum = d->seqnum; |
||
1079 | + p->orpid = d->orpid; |
||
1080 | + memcpy(&p->tgtid, &d->tgtid, 24); |
||
1081 | memcpy(&p->fd, fd, sizeof(*fd)); |
||
1082 | |||
1083 | /* Set the verb byte, have to substitute in the valid-bit */ |
||
1084 | dma_wmb(); |
||
1085 | p->verb = d->verb | EQAR_VB(eqar); |
||
1086 | + dccvac(p); |
||
1087 | |||
1088 | return 0; |
||
1089 | } |
||
1090 | @@ -522,7 +555,7 @@ void qbman_pull_desc_set_storage(struct |
||
1091 | int stash) |
||
1092 | { |
||
1093 | /* save the virtual address */ |
||
1094 | - d->rsp_addr_virt = (u64)storage; |
||
1095 | + d->rsp_addr_virt = (u64)(uintptr_t)storage; |
||
1096 | |||
1097 | if (!storage) { |
||
1098 | d->verb &= ~(1 << QB_VDQCR_VERB_RLS_SHIFT); |
||
1099 | @@ -615,7 +648,7 @@ int qbman_swp_pull(struct qbman_swp *s, |
||
1100 | atomic_inc(&s->vdq.available); |
||
1101 | return -EBUSY; |
||
1102 | } |
||
1103 | - s->vdq.storage = (void *)d->rsp_addr_virt; |
||
1104 | + s->vdq.storage = (void *)(uintptr_t)d->rsp_addr_virt; |
||
1105 | p = qbman_get_cmd(s, QBMAN_CENA_SWP_VDQCR); |
||
1106 | p->numf = d->numf; |
||
1107 | p->tok = QMAN_DQ_TOKEN_VALID; |
||
1108 | @@ -627,6 +660,7 @@ int qbman_swp_pull(struct qbman_swp *s, |
||
1109 | /* Set the verb byte, have to substitute in the valid-bit */ |
||
1110 | p->verb = d->verb | s->vdq.valid_bit; |
||
1111 | s->vdq.valid_bit ^= QB_VALID_BIT; |
||
1112 | + dccvac(p); |
||
1113 | |||
1114 | return 0; |
||
1115 | } |
||
1116 | @@ -680,8 +714,7 @@ const struct dpaa2_dq *qbman_swp_dqrr_ne |
||
1117 | s->dqrr.next_idx, pi); |
||
1118 | s->dqrr.reset_bug = 0; |
||
1119 | } |
||
1120 | - prefetch(qbman_get_cmd(s, |
||
1121 | - QBMAN_CENA_SWP_DQRR(s->dqrr.next_idx))); |
||
1122 | + qbman_inval_prefetch(s, QBMAN_CENA_SWP_DQRR(s->dqrr.next_idx)); |
||
1123 | } |
||
1124 | |||
1125 | p = qbman_get_cmd(s, QBMAN_CENA_SWP_DQRR(s->dqrr.next_idx)); |
||
1126 | @@ -696,8 +729,7 @@ const struct dpaa2_dq *qbman_swp_dqrr_ne |
||
1127 | * knew from reading PI. |
||
1128 | */ |
||
1129 | if ((verb & QB_VALID_BIT) != s->dqrr.valid_bit) { |
||
1130 | - prefetch(qbman_get_cmd(s, |
||
1131 | - QBMAN_CENA_SWP_DQRR(s->dqrr.next_idx))); |
||
1132 | + qbman_inval_prefetch(s, QBMAN_CENA_SWP_DQRR(s->dqrr.next_idx)); |
||
1133 | return NULL; |
||
1134 | } |
||
1135 | /* |
||
1136 | @@ -720,7 +752,7 @@ const struct dpaa2_dq *qbman_swp_dqrr_ne |
||
1137 | (flags & DPAA2_DQ_STAT_EXPIRED)) |
||
1138 | atomic_inc(&s->vdq.available); |
||
1139 | |||
1140 | - prefetch(qbman_get_cmd(s, QBMAN_CENA_SWP_DQRR(s->dqrr.next_idx))); |
||
1141 | + qbman_inval_prefetch(s, QBMAN_CENA_SWP_DQRR(s->dqrr.next_idx)); |
||
1142 | |||
1143 | return p; |
||
1144 | } |
||
1145 | @@ -848,6 +880,7 @@ int qbman_swp_release(struct qbman_swp * |
||
1146 | */ |
||
1147 | dma_wmb(); |
||
1148 | p->verb = d->verb | RAR_VB(rar) | num_buffers; |
||
1149 | + dccvac(p); |
||
1150 | |||
1151 | return 0; |
||
1152 | } |
||
1153 | @@ -855,7 +888,7 @@ int qbman_swp_release(struct qbman_swp * |
||
1154 | struct qbman_acquire_desc { |
||
1155 | u8 verb; |
||
1156 | u8 reserved; |
||
1157 | - u16 bpid; |
||
1158 | + __le16 bpid; |
||
1159 | u8 num; |
||
1160 | u8 reserved2[59]; |
||
1161 | }; |
||
1162 | @@ -863,10 +896,10 @@ struct qbman_acquire_desc { |
||
1163 | struct qbman_acquire_rslt { |
||
1164 | u8 verb; |
||
1165 | u8 rslt; |
||
1166 | - u16 reserved; |
||
1167 | + __le16 reserved; |
||
1168 | u8 num; |
||
1169 | u8 reserved2[3]; |
||
1170 | - u64 buf[7]; |
||
1171 | + __le64 buf[7]; |
||
1172 | }; |
||
1173 | |||
1174 | /** |
||
1175 | @@ -929,7 +962,7 @@ int qbman_swp_acquire(struct qbman_swp * |
||
1176 | struct qbman_alt_fq_state_desc { |
||
1177 | u8 verb; |
||
1178 | u8 reserved[3]; |
||
1179 | - u32 fqid; |
||
1180 | + __le32 fqid; |
||
1181 | u8 reserved2[56]; |
||
1182 | }; |
||
1183 | |||
1184 | @@ -952,7 +985,7 @@ int qbman_swp_alt_fq_state(struct qbman_ |
||
1185 | if (!p) |
||
1186 | return -EBUSY; |
||
1187 | |||
1188 | - p->fqid = cpu_to_le32(fqid) & ALT_FQ_FQID_MASK; |
||
1189 | + p->fqid = cpu_to_le32(fqid & ALT_FQ_FQID_MASK); |
||
1190 | |||
1191 | /* Complete the management command */ |
||
1192 | r = qbman_swp_mc_complete(s, p, alt_fq_verb); |
||
1193 | @@ -978,11 +1011,11 @@ int qbman_swp_alt_fq_state(struct qbman_ |
||
1194 | struct qbman_cdan_ctrl_desc { |
||
1195 | u8 verb; |
||
1196 | u8 reserved; |
||
1197 | - u16 ch; |
||
1198 | + __le16 ch; |
||
1199 | u8 we; |
||
1200 | u8 ctrl; |
||
1201 | - u16 reserved2; |
||
1202 | - u64 cdan_ctx; |
||
1203 | + __le16 reserved2; |
||
1204 | + __le64 cdan_ctx; |
||
1205 | u8 reserved3[48]; |
||
1206 | |||
1207 | }; |
||
1208 | @@ -990,7 +1023,7 @@ struct qbman_cdan_ctrl_desc { |
||
1209 | struct qbman_cdan_ctrl_rslt { |
||
1210 | u8 verb; |
||
1211 | u8 rslt; |
||
1212 | - u16 ch; |
||
1213 | + __le16 ch; |
||
1214 | u8 reserved[60]; |
||
1215 | }; |
||
1216 | |||
1217 | @@ -1033,3 +1066,99 @@ int qbman_swp_CDAN_set(struct qbman_swp |
||
1218 | |||
1219 | return 0; |
||
1220 | } |
||
1221 | + |
||
1222 | +#define QBMAN_RESPONSE_VERB_MASK 0x7f |
||
1223 | +#define QBMAN_FQ_QUERY_NP 0x45 |
||
1224 | +#define QBMAN_BP_QUERY 0x32 |
||
1225 | + |
||
1226 | +struct qbman_fq_query_desc { |
||
1227 | + u8 verb; |
||
1228 | + u8 reserved[3]; |
||
1229 | + __le32 fqid; |
||
1230 | + u8 reserved2[56]; |
||
1231 | +}; |
||
1232 | + |
||
1233 | +int qbman_fq_query_state(struct qbman_swp *s, u32 fqid, |
||
1234 | + struct qbman_fq_query_np_rslt *r) |
||
1235 | +{ |
||
1236 | + struct qbman_fq_query_desc *p; |
||
1237 | + void *resp; |
||
1238 | + |
||
1239 | + p = (struct qbman_fq_query_desc *)qbman_swp_mc_start(s); |
||
1240 | + if (!p) |
||
1241 | + return -EBUSY; |
||
1242 | + |
||
1243 | + /* FQID is a 24 bit value */ |
||
1244 | + p->fqid = cpu_to_le32(fqid & 0x00FFFFFF); |
||
1245 | + resp = qbman_swp_mc_complete(s, p, QBMAN_FQ_QUERY_NP); |
||
1246 | + if (!resp) { |
||
1247 | + pr_err("qbman: Query FQID %d NP fields failed, no response\n", |
||
1248 | + fqid); |
||
1249 | + return -EIO; |
||
1250 | + } |
||
1251 | + *r = *(struct qbman_fq_query_np_rslt *)resp; |
||
1252 | + /* Decode the outcome */ |
||
1253 | + WARN_ON((r->verb & QBMAN_RESPONSE_VERB_MASK) != QBMAN_FQ_QUERY_NP); |
||
1254 | + |
||
1255 | + /* Determine success or failure */ |
||
1256 | + if (r->rslt != QBMAN_MC_RSLT_OK) { |
||
1257 | + pr_err("Query NP fields of FQID 0x%x failed, code=0x%02x\n", |
||
1258 | + p->fqid, r->rslt); |
||
1259 | + return -EIO; |
||
1260 | + } |
||
1261 | + |
||
1262 | + return 0; |
||
1263 | +} |
||
1264 | + |
||
1265 | +u32 qbman_fq_state_frame_count(const struct qbman_fq_query_np_rslt *r) |
||
1266 | +{ |
||
1267 | + return (le32_to_cpu(r->frm_cnt) & 0x00FFFFFF); |
||
1268 | +} |
||
1269 | + |
||
1270 | +u32 qbman_fq_state_byte_count(const struct qbman_fq_query_np_rslt *r) |
||
1271 | +{ |
||
1272 | + return le32_to_cpu(r->byte_cnt); |
||
1273 | +} |
||
1274 | + |
||
1275 | +struct qbman_bp_query_desc { |
||
1276 | + u8 verb; |
||
1277 | + u8 reserved; |
||
1278 | + __le16 bpid; |
||
1279 | + u8 reserved2[60]; |
||
1280 | +}; |
||
1281 | + |
||
1282 | +int qbman_bp_query(struct qbman_swp *s, u16 bpid, |
||
1283 | + struct qbman_bp_query_rslt *r) |
||
1284 | +{ |
||
1285 | + struct qbman_bp_query_desc *p; |
||
1286 | + void *resp; |
||
1287 | + |
||
1288 | + p = (struct qbman_bp_query_desc *)qbman_swp_mc_start(s); |
||
1289 | + if (!p) |
||
1290 | + return -EBUSY; |
||
1291 | + |
||
1292 | + p->bpid = cpu_to_le16(bpid); |
||
1293 | + resp = qbman_swp_mc_complete(s, p, QBMAN_BP_QUERY); |
||
1294 | + if (!resp) { |
||
1295 | + pr_err("qbman: Query BPID %d fields failed, no response\n", |
||
1296 | + bpid); |
||
1297 | + return -EIO; |
||
1298 | + } |
||
1299 | + *r = *(struct qbman_bp_query_rslt *)resp; |
||
1300 | + /* Decode the outcome */ |
||
1301 | + WARN_ON((r->verb & QBMAN_RESPONSE_VERB_MASK) != QBMAN_BP_QUERY); |
||
1302 | + |
||
1303 | + /* Determine success or failure */ |
||
1304 | + if (r->rslt != QBMAN_MC_RSLT_OK) { |
||
1305 | + pr_err("Query fields of BPID 0x%x failed, code=0x%02x\n", |
||
1306 | + bpid, r->rslt); |
||
1307 | + return -EIO; |
||
1308 | + } |
||
1309 | + |
||
1310 | + return 0; |
||
1311 | +} |
||
1312 | + |
||
1313 | +u32 qbman_bp_info_num_free_bufs(struct qbman_bp_query_rslt *a) |
||
1314 | +{ |
||
1315 | + return le32_to_cpu(a->fill); |
||
1316 | +} |
||
1317 | --- a/drivers/staging/fsl-mc/bus/dpio/qbman-portal.h |
||
1318 | +++ b/drivers/staging/fsl-mc/bus/dpio/qbman-portal.h |
||
1319 | @@ -1,33 +1,8 @@ |
||
1320 | +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ |
||
1321 | /* |
||
1322 | * Copyright (C) 2014-2016 Freescale Semiconductor, Inc. |
||
1323 | * Copyright 2016 NXP |
||
1324 | * |
||
1325 | - * Redistribution and use in source and binary forms, with or without |
||
1326 | - * modification, are permitted provided that the following conditions are met: |
||
1327 | - * * Redistributions of source code must retain the above copyright |
||
1328 | - * notice, this list of conditions and the following disclaimer. |
||
1329 | - * * Redistributions in binary form must reproduce the above copyright |
||
1330 | - * notice, this list of conditions and the following disclaimer in the |
||
1331 | - * documentation and/or other materials provided with the distribution. |
||
1332 | - * * Neither the name of Freescale Semiconductor nor the |
||
1333 | - * names of its contributors may be used to endorse or promote products |
||
1334 | - * derived from this software without specific prior written permission. |
||
1335 | - * |
||
1336 | - * ALTERNATIVELY, this software may be distributed under the terms of the |
||
1337 | - * GNU General Public License ("GPL") as published by the Free Software |
||
1338 | - * Foundation, either version 2 of that License or (at your option) any |
||
1339 | - * later version. |
||
1340 | - * |
||
1341 | - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY |
||
1342 | - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||
1343 | - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||
1344 | - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY |
||
1345 | - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
||
1346 | - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||
1347 | - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
||
1348 | - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
1349 | - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||
1350 | - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
1351 | */ |
||
1352 | #ifndef __FSL_QBMAN_PORTAL_H |
||
1353 | #define __FSL_QBMAN_PORTAL_H |
||
1354 | @@ -57,8 +32,8 @@ struct qbman_pull_desc { |
||
1355 | u8 numf; |
||
1356 | u8 tok; |
||
1357 | u8 reserved; |
||
1358 | - u32 dq_src; |
||
1359 | - u64 rsp_addr; |
||
1360 | + __le32 dq_src; |
||
1361 | + __le64 rsp_addr; |
||
1362 | u64 rsp_addr_virt; |
||
1363 | u8 padding[40]; |
||
1364 | }; |
||
1365 | @@ -95,17 +70,17 @@ enum qbman_pull_type_e { |
||
1366 | struct qbman_eq_desc { |
||
1367 | u8 verb; |
||
1368 | u8 dca; |
||
1369 | - u16 seqnum; |
||
1370 | - u16 orpid; |
||
1371 | - u16 reserved1; |
||
1372 | - u32 tgtid; |
||
1373 | - u32 tag; |
||
1374 | - u16 qdbin; |
||
1375 | + __le16 seqnum; |
||
1376 | + __le16 orpid; |
||
1377 | + __le16 reserved1; |
||
1378 | + __le32 tgtid; |
||
1379 | + __le32 tag; |
||
1380 | + __le16 qdbin; |
||
1381 | u8 qpri; |
||
1382 | u8 reserved[3]; |
||
1383 | u8 wae; |
||
1384 | u8 rspid; |
||
1385 | - u64 rsp_addr; |
||
1386 | + __le64 rsp_addr; |
||
1387 | u8 fd[32]; |
||
1388 | }; |
||
1389 | |||
1390 | @@ -113,9 +88,9 @@ struct qbman_eq_desc { |
||
1391 | struct qbman_release_desc { |
||
1392 | u8 verb; |
||
1393 | u8 reserved; |
||
1394 | - u16 bpid; |
||
1395 | - u32 reserved2; |
||
1396 | - u64 buf[7]; |
||
1397 | + __le16 bpid; |
||
1398 | + __le32 reserved2; |
||
1399 | + __le64 buf[7]; |
||
1400 | }; |
||
1401 | |||
1402 | /* Management command result codes */ |
||
1403 | @@ -187,6 +162,9 @@ int qbman_result_has_new_result(struct q |
||
1404 | |||
1405 | void qbman_eq_desc_clear(struct qbman_eq_desc *d); |
||
1406 | void qbman_eq_desc_set_no_orp(struct qbman_eq_desc *d, int respond_success); |
||
1407 | +void qbman_eq_desc_set_orp(struct qbman_eq_desc *d, int respond_success, |
||
1408 | + u16 oprid, u16 seqnum, int incomplete); |
||
1409 | +void qbman_eq_desc_set_orp_hole(struct qbman_eq_desc *d, u16 oprid, u16 seqnum); |
||
1410 | void qbman_eq_desc_set_token(struct qbman_eq_desc *d, u8 token); |
||
1411 | void qbman_eq_desc_set_fq(struct qbman_eq_desc *d, u32 fqid); |
||
1412 | void qbman_eq_desc_set_qd(struct qbman_eq_desc *d, u32 qdid, |
||
1413 | @@ -466,4 +444,62 @@ static inline void *qbman_swp_mc_complet |
||
1414 | return cmd; |
||
1415 | } |
||
1416 | |||
1417 | +/* Query APIs */ |
||
1418 | +struct qbman_fq_query_np_rslt { |
||
1419 | + u8 verb; |
||
1420 | + u8 rslt; |
||
1421 | + u8 st1; |
||
1422 | + u8 st2; |
||
1423 | + u8 reserved[2]; |
||
1424 | + __le16 od1_sfdr; |
||
1425 | + __le16 od2_sfdr; |
||
1426 | + __le16 od3_sfdr; |
||
1427 | + __le16 ra1_sfdr; |
||
1428 | + __le16 ra2_sfdr; |
||
1429 | + __le32 pfdr_hptr; |
||
1430 | + __le32 pfdr_tptr; |
||
1431 | + __le32 frm_cnt; |
||
1432 | + __le32 byte_cnt; |
||
1433 | + __le16 ics_surp; |
||
1434 | + u8 is; |
||
1435 | + u8 reserved2[29]; |
||
1436 | +}; |
||
1437 | + |
||
1438 | +int qbman_fq_query_state(struct qbman_swp *s, u32 fqid, |
||
1439 | + struct qbman_fq_query_np_rslt *r); |
||
1440 | +u32 qbman_fq_state_frame_count(const struct qbman_fq_query_np_rslt *r); |
||
1441 | +u32 qbman_fq_state_byte_count(const struct qbman_fq_query_np_rslt *r); |
||
1442 | + |
||
1443 | +struct qbman_bp_query_rslt { |
||
1444 | + u8 verb; |
||
1445 | + u8 rslt; |
||
1446 | + u8 reserved[4]; |
||
1447 | + u8 bdi; |
||
1448 | + u8 state; |
||
1449 | + __le32 fill; |
||
1450 | + __le32 hdotr; |
||
1451 | + __le16 swdet; |
||
1452 | + __le16 swdxt; |
||
1453 | + __le16 hwdet; |
||
1454 | + __le16 hwdxt; |
||
1455 | + __le16 swset; |
||
1456 | + __le16 swsxt; |
||
1457 | + __le16 vbpid; |
||
1458 | + __le16 icid; |
||
1459 | + __le64 bpscn_addr; |
||
1460 | + __le64 bpscn_ctx; |
||
1461 | + __le16 hw_targ; |
||
1462 | + u8 dbe; |
||
1463 | + u8 reserved2; |
||
1464 | + u8 sdcnt; |
||
1465 | + u8 hdcnt; |
||
1466 | + u8 sscnt; |
||
1467 | + u8 reserved3[9]; |
||
1468 | +}; |
||
1469 | + |
||
1470 | +int qbman_bp_query(struct qbman_swp *s, u16 bpid, |
||
1471 | + struct qbman_bp_query_rslt *r); |
||
1472 | + |
||
1473 | +u32 qbman_bp_info_num_free_bufs(struct qbman_bp_query_rslt *a); |
||
1474 | + |
||
1475 | #endif /* __FSL_QBMAN_PORTAL_H */ |
||
1476 | --- a/drivers/staging/fsl-mc/bus/dpmcp.c |
||
1477 | +++ b/drivers/staging/fsl-mc/bus/dpmcp.c |
||
1478 | @@ -1,33 +1,7 @@ |
||
1479 | +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) |
||
1480 | /* |
||
1481 | * Copyright 2013-2016 Freescale Semiconductor Inc. |
||
1482 | * |
||
1483 | - * Redistribution and use in source and binary forms, with or without |
||
1484 | - * modification, are permitted provided that the following conditions are met: |
||
1485 | - * * Redistributions of source code must retain the above copyright |
||
1486 | - * notice, this list of conditions and the following disclaimer. |
||
1487 | - * * Redistributions in binary form must reproduce the above copyright |
||
1488 | - * notice, this list of conditions and the following disclaimer in the |
||
1489 | - * documentation and/or other materials provided with the distribution. |
||
1490 | - * * Neither the name of the above-listed copyright holders nor the |
||
1491 | - * names of any contributors may be used to endorse or promote products |
||
1492 | - * derived from this software without specific prior written permission. |
||
1493 | - * |
||
1494 | - * ALTERNATIVELY, this software may be distributed under the terms of the |
||
1495 | - * GNU General Public License ("GPL") as published by the Free Software |
||
1496 | - * Foundation, either version 2 of that License or (at your option) any |
||
1497 | - * later version. |
||
1498 | - * |
||
1499 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||
1500 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
1501 | - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
1502 | - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE |
||
1503 | - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||
1504 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||
1505 | - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||
1506 | - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||
1507 | - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||
1508 | - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||
1509 | - * POSSIBILITY OF SUCH DAMAGE. |
||
1510 | */ |
||
1511 | #include <linux/kernel.h> |
||
1512 | #include "../include/mc.h" |
||
1513 | --- a/drivers/staging/fsl-mc/bus/dprc-driver.c |
||
1514 | +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c |
||
1515 | @@ -1,12 +1,10 @@ |
||
1516 | +// SPDX-License-Identifier: GPL-2.0 |
||
1517 | /* |
||
1518 | * Freescale data path resource container (DPRC) driver |
||
1519 | * |
||
1520 | * Copyright (C) 2014-2016 Freescale Semiconductor, Inc. |
||
1521 | * Author: German Rivera <German.Rivera@freescale.com> |
||
1522 | * |
||
1523 | - * This file is licensed under the terms of the GNU General Public |
||
1524 | - * License version 2. This program is licensed "as is" without any |
||
1525 | - * warranty of any kind, whether express or implied. |
||
1526 | */ |
||
1527 | |||
1528 | #include <linux/module.h> |
||
1529 | --- a/drivers/staging/fsl-mc/bus/dprc.c |
||
1530 | +++ b/drivers/staging/fsl-mc/bus/dprc.c |
||
1531 | @@ -1,33 +1,7 @@ |
||
1532 | +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) |
||
1533 | /* |
||
1534 | * Copyright 2013-2016 Freescale Semiconductor Inc. |
||
1535 | * |
||
1536 | - * Redistribution and use in source and binary forms, with or without |
||
1537 | - * modification, are permitted provided that the following conditions are met: |
||
1538 | - * * Redistributions of source code must retain the above copyright |
||
1539 | - * notice, this list of conditions and the following disclaimer. |
||
1540 | - * * Redistributions in binary form must reproduce the above copyright |
||
1541 | - * notice, this list of conditions and the following disclaimer in the |
||
1542 | - * documentation and/or other materials provided with the distribution. |
||
1543 | - * * Neither the name of the above-listed copyright holders nor the |
||
1544 | - * names of any contributors may be used to endorse or promote products |
||
1545 | - * derived from this software without specific prior written permission. |
||
1546 | - * |
||
1547 | - * ALTERNATIVELY, this software may be distributed under the terms of the |
||
1548 | - * GNU General Public License ("GPL") as published by the Free Software |
||
1549 | - * Foundation, either version 2 of that License or (at your option) any |
||
1550 | - * later version. |
||
1551 | - * |
||
1552 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||
1553 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
1554 | - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
1555 | - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE |
||
1556 | - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||
1557 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||
1558 | - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||
1559 | - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||
1560 | - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||
1561 | - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||
1562 | - * POSSIBILITY OF SUCH DAMAGE. |
||
1563 | */ |
||
1564 | #include <linux/kernel.h> |
||
1565 | #include "../include/mc.h" |
||
1566 | --- a/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c |
||
1567 | +++ b/drivers/staging/fsl-mc/bus/fsl-mc-allocator.c |
||
1568 | @@ -1,11 +1,9 @@ |
||
1569 | +// SPDX-License-Identifier: GPL-2.0 |
||
1570 | /* |
||
1571 | * fsl-mc object allocator driver |
||
1572 | * |
||
1573 | * Copyright (C) 2013-2016 Freescale Semiconductor, Inc. |
||
1574 | * |
||
1575 | - * This file is licensed under the terms of the GNU General Public |
||
1576 | - * License version 2. This program is licensed "as is" without any |
||
1577 | - * warranty of any kind, whether express or implied. |
||
1578 | */ |
||
1579 | |||
1580 | #include <linux/module.h> |
||
1581 | --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c |
||
1582 | +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c |
||
1583 | @@ -1,12 +1,10 @@ |
||
1584 | +// SPDX-License-Identifier: GPL-2.0 |
||
1585 | /* |
||
1586 | * Freescale Management Complex (MC) bus driver |
||
1587 | * |
||
1588 | * Copyright (C) 2014-2016 Freescale Semiconductor, Inc. |
||
1589 | * Author: German Rivera <German.Rivera@freescale.com> |
||
1590 | * |
||
1591 | - * This file is licensed under the terms of the GNU General Public |
||
1592 | - * License version 2. This program is licensed "as is" without any |
||
1593 | - * warranty of any kind, whether express or implied. |
||
1594 | */ |
||
1595 | |||
1596 | #define pr_fmt(fmt) "fsl-mc: " fmt |
||
1597 | --- a/drivers/staging/fsl-mc/bus/fsl-mc-msi.c |
||
1598 | +++ b/drivers/staging/fsl-mc/bus/fsl-mc-msi.c |
||
1599 | @@ -1,12 +1,10 @@ |
||
1600 | +// SPDX-License-Identifier: GPL-2.0 |
||
1601 | /* |
||
1602 | * Freescale Management Complex (MC) bus driver MSI support |
||
1603 | * |
||
1604 | * Copyright (C) 2015-2016 Freescale Semiconductor, Inc. |
||
1605 | * Author: German Rivera <German.Rivera@freescale.com> |
||
1606 | * |
||
1607 | - * This file is licensed under the terms of the GNU General Public |
||
1608 | - * License version 2. This program is licensed "as is" without any |
||
1609 | - * warranty of any kind, whether express or implied. |
||
1610 | */ |
||
1611 | |||
1612 | #include <linux/of_device.h> |
||
1613 | --- a/drivers/staging/fsl-mc/bus/fsl-mc-private.h |
||
1614 | +++ b/drivers/staging/fsl-mc/bus/fsl-mc-private.h |
||
1615 | @@ -1,11 +1,9 @@ |
||
1616 | +/* SPDX-License-Identifier: GPL-2.0 */ |
||
1617 | /* |
||
1618 | * Freescale Management Complex (MC) bus private declarations |
||
1619 | * |
||
1620 | * Copyright (C) 2016 Freescale Semiconductor, Inc. |
||
1621 | * |
||
1622 | - * This file is licensed under the terms of the GNU General Public |
||
1623 | - * License version 2. This program is licensed "as is" without any |
||
1624 | - * warranty of any kind, whether express or implied. |
||
1625 | */ |
||
1626 | #ifndef _FSL_MC_PRIVATE_H_ |
||
1627 | #define _FSL_MC_PRIVATE_H_ |
||
1628 | --- a/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c |
||
1629 | +++ b/drivers/staging/fsl-mc/bus/irq-gic-v3-its-fsl-mc-msi.c |
||
1630 | @@ -1,12 +1,10 @@ |
||
1631 | +// SPDX-License-Identifier: GPL-2.0 |
||
1632 | /* |
||
1633 | * Freescale Management Complex (MC) bus driver MSI support |
||
1634 | * |
||
1635 | * Copyright (C) 2015-2016 Freescale Semiconductor, Inc. |
||
1636 | * Author: German Rivera <German.Rivera@freescale.com> |
||
1637 | * |
||
1638 | - * This file is licensed under the terms of the GNU General Public |
||
1639 | - * License version 2. This program is licensed "as is" without any |
||
1640 | - * warranty of any kind, whether express or implied. |
||
1641 | */ |
||
1642 | |||
1643 | #include <linux/of_device.h> |
||
1644 | --- a/drivers/staging/fsl-mc/bus/mc-io.c |
||
1645 | +++ b/drivers/staging/fsl-mc/bus/mc-io.c |
||
1646 | @@ -1,33 +1,7 @@ |
||
1647 | +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) |
||
1648 | /* |
||
1649 | * Copyright 2013-2016 Freescale Semiconductor Inc. |
||
1650 | * |
||
1651 | - * Redistribution and use in source and binary forms, with or without |
||
1652 | - * modification, are permitted provided that the following conditions are met: |
||
1653 | - * * Redistributions of source code must retain the above copyright |
||
1654 | - * notice, this list of conditions and the following disclaimer. |
||
1655 | - * * Redistributions in binary form must reproduce the above copyright |
||
1656 | - * notice, this list of conditions and the following disclaimer in the |
||
1657 | - * documentation and/or other materials provided with the distribution. |
||
1658 | - * * Neither the name of the above-listed copyright holders nor the |
||
1659 | - * names of any contributors may be used to endorse or promote products |
||
1660 | - * derived from this software without specific prior written permission. |
||
1661 | - * |
||
1662 | - * ALTERNATIVELY, this software may be distributed under the terms of the |
||
1663 | - * GNU General Public License ("GPL") as published by the Free Software |
||
1664 | - * Foundation, either version 2 of that License or (at your option) any |
||
1665 | - * later version. |
||
1666 | - * |
||
1667 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||
1668 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
1669 | - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
1670 | - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE |
||
1671 | - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||
1672 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||
1673 | - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||
1674 | - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||
1675 | - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||
1676 | - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||
1677 | - * POSSIBILITY OF SUCH DAMAGE. |
||
1678 | */ |
||
1679 | |||
1680 | #include <linux/io.h> |
||
1681 | --- a/drivers/staging/fsl-mc/bus/mc-sys.c |
||
1682 | +++ b/drivers/staging/fsl-mc/bus/mc-sys.c |
||
1683 | @@ -1,35 +1,9 @@ |
||
1684 | +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) |
||
1685 | /* |
||
1686 | * Copyright 2013-2016 Freescale Semiconductor Inc. |
||
1687 | * |
||
1688 | * I/O services to send MC commands to the MC hardware |
||
1689 | * |
||
1690 | - * Redistribution and use in source and binary forms, with or without |
||
1691 | - * modification, are permitted provided that the following conditions are met: |
||
1692 | - * * Redistributions of source code must retain the above copyright |
||
1693 | - * notice, this list of conditions and the following disclaimer. |
||
1694 | - * * Redistributions in binary form must reproduce the above copyright |
||
1695 | - * notice, this list of conditions and the following disclaimer in the |
||
1696 | - * documentation and/or other materials provided with the distribution. |
||
1697 | - * * Neither the name of the above-listed copyright holders nor the |
||
1698 | - * names of any contributors may be used to endorse or promote products |
||
1699 | - * derived from this software without specific prior written permission. |
||
1700 | - * |
||
1701 | - * ALTERNATIVELY, this software may be distributed under the terms of the |
||
1702 | - * GNU General Public License ("GPL") as published by the Free Software |
||
1703 | - * Foundation, either version 2 of that License or (at your option) any |
||
1704 | - * later version. |
||
1705 | - * |
||
1706 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||
1707 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
1708 | - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
1709 | - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE |
||
1710 | - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||
1711 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||
1712 | - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||
1713 | - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||
1714 | - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||
1715 | - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||
1716 | - * POSSIBILITY OF SUCH DAMAGE. |
||
1717 | */ |
||
1718 | |||
1719 | #include <linux/delay.h> |
||
1720 | --- a/drivers/staging/fsl-mc/include/dpaa2-fd.h |
||
1721 | +++ b/drivers/staging/fsl-mc/include/dpaa2-fd.h |
||
1722 | @@ -1,33 +1,8 @@ |
||
1723 | +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ |
||
1724 | /* |
||
1725 | * Copyright 2014-2016 Freescale Semiconductor Inc. |
||
1726 | * Copyright 2016 NXP |
||
1727 | * |
||
1728 | - * Redistribution and use in source and binary forms, with or without |
||
1729 | - * modification, are permitted provided that the following conditions are met: |
||
1730 | - * * Redistributions of source code must retain the above copyright |
||
1731 | - * notice, this list of conditions and the following disclaimer. |
||
1732 | - * * Redistributions in binary form must reproduce the above copyright |
||
1733 | - * notice, this list of conditions and the following disclaimer in the |
||
1734 | - * documentation and/or other materials provided with the distribution. |
||
1735 | - * * Neither the name of Freescale Semiconductor nor the |
||
1736 | - * names of its contributors may be used to endorse or promote products |
||
1737 | - * derived from this software without specific prior written permission. |
||
1738 | - * |
||
1739 | - * ALTERNATIVELY, this software may be distributed under the terms of the |
||
1740 | - * GNU General Public License ("GPL") as published by the Free Software |
||
1741 | - * Foundation, either version 2 of that License or (at your option) any |
||
1742 | - * later version. |
||
1743 | - * |
||
1744 | - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY |
||
1745 | - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||
1746 | - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||
1747 | - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY |
||
1748 | - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
||
1749 | - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||
1750 | - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
||
1751 | - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
1752 | - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||
1753 | - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
1754 | */ |
||
1755 | #ifndef __FSL_DPAA2_FD_H |
||
1756 | #define __FSL_DPAA2_FD_H |
||
1757 | @@ -91,6 +66,27 @@ struct dpaa2_fd { |
||
1758 | #define SG_BPID_MASK 0x3FFF |
||
1759 | #define SG_FINAL_FLAG_MASK 0x1 |
||
1760 | #define SG_FINAL_FLAG_SHIFT 15 |
||
1761 | +#define FL_SHORT_LEN_FLAG_MASK 0x1 |
||
1762 | +#define FL_SHORT_LEN_FLAG_SHIFT 14 |
||
1763 | +#define FL_SHORT_LEN_MASK 0x3FFFF |
||
1764 | +#define FL_OFFSET_MASK 0x0FFF |
||
1765 | +#define FL_FORMAT_MASK 0x3 |
||
1766 | +#define FL_FORMAT_SHIFT 12 |
||
1767 | +#define FL_BPID_MASK 0x3FFF |
||
1768 | +#define FL_FINAL_FLAG_MASK 0x1 |
||
1769 | +#define FL_FINAL_FLAG_SHIFT 15 |
||
1770 | + |
||
1771 | +/* Error bits in FD CTRL */ |
||
1772 | +#define FD_CTRL_ERR_MASK 0x000000FF |
||
1773 | +#define FD_CTRL_UFD 0x00000004 |
||
1774 | +#define FD_CTRL_SBE 0x00000008 |
||
1775 | +#define FD_CTRL_FLC 0x00000010 |
||
1776 | +#define FD_CTRL_FSE 0x00000020 |
||
1777 | +#define FD_CTRL_FAERR 0x00000040 |
||
1778 | + |
||
1779 | +/* Annotation bits in FD CTRL */ |
||
1780 | +#define FD_CTRL_PTA 0x00800000 |
||
1781 | +#define FD_CTRL_PTV1 0x00400000 |
||
1782 | |||
1783 | enum dpaa2_fd_format { |
||
1784 | dpaa2_fd_single = 0, |
||
1785 | @@ -312,7 +308,7 @@ enum dpaa2_sg_format { |
||
1786 | */ |
||
1787 | static inline dma_addr_t dpaa2_sg_get_addr(const struct dpaa2_sg_entry *sg) |
||
1788 | { |
||
1789 | - return le64_to_cpu((dma_addr_t)sg->addr); |
||
1790 | + return (dma_addr_t)le64_to_cpu(sg->addr); |
||
1791 | } |
||
1792 | |||
1793 | /** |
||
1794 | @@ -443,9 +439,243 @@ static inline bool dpaa2_sg_is_final(con |
||
1795 | */ |
||
1796 | static inline void dpaa2_sg_set_final(struct dpaa2_sg_entry *sg, bool final) |
||
1797 | { |
||
1798 | - sg->format_offset &= cpu_to_le16(~(SG_FINAL_FLAG_MASK |
||
1799 | - << SG_FINAL_FLAG_SHIFT)); |
||
1800 | + sg->format_offset &= cpu_to_le16((~(SG_FINAL_FLAG_MASK |
||
1801 | + << SG_FINAL_FLAG_SHIFT)) & 0xFFFF); |
||
1802 | sg->format_offset |= cpu_to_le16(final << SG_FINAL_FLAG_SHIFT); |
||
1803 | } |
||
1804 | |||
1805 | +/** |
||
1806 | + * struct dpaa2_fl_entry - structure for frame list entry. |
||
1807 | + * @addr: address in the FLE |
||
1808 | + * @len: length in the FLE |
||
1809 | + * @bpid: buffer pool ID |
||
1810 | + * @format_offset: format, offset, and short-length fields |
||
1811 | + * @frc: frame context |
||
1812 | + * @ctrl: control bits...including pta, pvt1, pvt2, err, etc |
||
1813 | + * @flc: flow context address |
||
1814 | + */ |
||
1815 | +struct dpaa2_fl_entry { |
||
1816 | + __le64 addr; |
||
1817 | + __le32 len; |
||
1818 | + __le16 bpid; |
||
1819 | + __le16 format_offset; |
||
1820 | + __le32 frc; |
||
1821 | + __le32 ctrl; |
||
1822 | + __le64 flc; |
||
1823 | +}; |
||
1824 | + |
||
1825 | +enum dpaa2_fl_format { |
||
1826 | + dpaa2_fl_single = 0, |
||
1827 | + dpaa2_fl_res, |
||
1828 | + dpaa2_fl_sg |
||
1829 | +}; |
||
1830 | + |
||
1831 | +/** |
||
1832 | + * dpaa2_fl_get_addr() - get the addr field of FLE |
||
1833 | + * @fle: the given frame list entry |
||
1834 | + * |
||
1835 | + * Return the address in the frame list entry. |
||
1836 | + */ |
||
1837 | +static inline dma_addr_t dpaa2_fl_get_addr(const struct dpaa2_fl_entry *fle) |
||
1838 | +{ |
||
1839 | + return (dma_addr_t)le64_to_cpu(fle->addr); |
||
1840 | +} |
||
1841 | + |
||
1842 | +/** |
||
1843 | + * dpaa2_fl_set_addr() - Set the addr field of FLE |
||
1844 | + * @fle: the given frame list entry |
||
1845 | + * @addr: the address needs to be set in frame list entry |
||
1846 | + */ |
||
1847 | +static inline void dpaa2_fl_set_addr(struct dpaa2_fl_entry *fle, |
||
1848 | + dma_addr_t addr) |
||
1849 | +{ |
||
1850 | + fle->addr = cpu_to_le64(addr); |
||
1851 | +} |
||
1852 | + |
||
1853 | +/** |
||
1854 | + * dpaa2_fl_get_frc() - Get the frame context in the FLE |
||
1855 | + * @fle: the given frame list entry |
||
1856 | + * |
||
1857 | + * Return the frame context field in the frame lsit entry. |
||
1858 | + */ |
||
1859 | +static inline u32 dpaa2_fl_get_frc(const struct dpaa2_fl_entry *fle) |
||
1860 | +{ |
||
1861 | + return le32_to_cpu(fle->frc); |
||
1862 | +} |
||
1863 | + |
||
1864 | +/** |
||
1865 | + * dpaa2_fl_set_frc() - Set the frame context in the FLE |
||
1866 | + * @fle: the given frame list entry |
||
1867 | + * @frc: the frame context needs to be set in frame list entry |
||
1868 | + */ |
||
1869 | +static inline void dpaa2_fl_set_frc(struct dpaa2_fl_entry *fle, u32 frc) |
||
1870 | +{ |
||
1871 | + fle->frc = cpu_to_le32(frc); |
||
1872 | +} |
||
1873 | + |
||
1874 | +/** |
||
1875 | + * dpaa2_fl_get_ctrl() - Get the control bits in the FLE |
||
1876 | + * @fle: the given frame list entry |
||
1877 | + * |
||
1878 | + * Return the control bits field in the frame list entry. |
||
1879 | + */ |
||
1880 | +static inline u32 dpaa2_fl_get_ctrl(const struct dpaa2_fl_entry *fle) |
||
1881 | +{ |
||
1882 | + return le32_to_cpu(fle->ctrl); |
||
1883 | +} |
||
1884 | + |
||
1885 | +/** |
||
1886 | + * dpaa2_fl_set_ctrl() - Set the control bits in the FLE |
||
1887 | + * @fle: the given frame list entry |
||
1888 | + * @ctrl: the control bits to be set in the frame list entry |
||
1889 | + */ |
||
1890 | +static inline void dpaa2_fl_set_ctrl(struct dpaa2_fl_entry *fle, u32 ctrl) |
||
1891 | +{ |
||
1892 | + fle->ctrl = cpu_to_le32(ctrl); |
||
1893 | +} |
||
1894 | + |
||
1895 | +/** |
||
1896 | + * dpaa2_fl_get_flc() - Get the flow context in the FLE |
||
1897 | + * @fle: the given frame list entry |
||
1898 | + * |
||
1899 | + * Return the flow context in the frame list entry. |
||
1900 | + */ |
||
1901 | +static inline dma_addr_t dpaa2_fl_get_flc(const struct dpaa2_fl_entry *fle) |
||
1902 | +{ |
||
1903 | + return (dma_addr_t)le64_to_cpu(fle->flc); |
||
1904 | +} |
||
1905 | + |
||
1906 | +/** |
||
1907 | + * dpaa2_fl_set_flc() - Set the flow context field of FLE |
||
1908 | + * @fle: the given frame list entry |
||
1909 | + * @flc_addr: the flow context needs to be set in frame list entry |
||
1910 | + */ |
||
1911 | +static inline void dpaa2_fl_set_flc(struct dpaa2_fl_entry *fle, |
||
1912 | + dma_addr_t flc_addr) |
||
1913 | +{ |
||
1914 | + fle->flc = cpu_to_le64(flc_addr); |
||
1915 | +} |
||
1916 | + |
||
1917 | +static inline bool dpaa2_fl_short_len(const struct dpaa2_fl_entry *fle) |
||
1918 | +{ |
||
1919 | + return !!((le16_to_cpu(fle->format_offset) >> |
||
1920 | + FL_SHORT_LEN_FLAG_SHIFT) & FL_SHORT_LEN_FLAG_MASK); |
||
1921 | +} |
||
1922 | + |
||
1923 | +/** |
||
1924 | + * dpaa2_fl_get_len() - Get the length in the FLE |
||
1925 | + * @fle: the given frame list entry |
||
1926 | + * |
||
1927 | + * Return the length field in the frame list entry. |
||
1928 | + */ |
||
1929 | +static inline u32 dpaa2_fl_get_len(const struct dpaa2_fl_entry *fle) |
||
1930 | +{ |
||
1931 | + if (dpaa2_fl_short_len(fle)) |
||
1932 | + return le32_to_cpu(fle->len) & FL_SHORT_LEN_MASK; |
||
1933 | + |
||
1934 | + return le32_to_cpu(fle->len); |
||
1935 | +} |
||
1936 | + |
||
1937 | +/** |
||
1938 | + * dpaa2_fl_set_len() - Set the length field of FLE |
||
1939 | + * @fle: the given frame list entry |
||
1940 | + * @len: the length needs to be set in frame list entry |
||
1941 | + */ |
||
1942 | +static inline void dpaa2_fl_set_len(struct dpaa2_fl_entry *fle, u32 len) |
||
1943 | +{ |
||
1944 | + fle->len = cpu_to_le32(len); |
||
1945 | +} |
||
1946 | + |
||
1947 | +/** |
||
1948 | + * dpaa2_fl_get_offset() - Get the offset field in the frame list entry |
||
1949 | + * @fle: the given frame list entry |
||
1950 | + * |
||
1951 | + * Return the offset. |
||
1952 | + */ |
||
1953 | +static inline u16 dpaa2_fl_get_offset(const struct dpaa2_fl_entry *fle) |
||
1954 | +{ |
||
1955 | + return le16_to_cpu(fle->format_offset) & FL_OFFSET_MASK; |
||
1956 | +} |
||
1957 | + |
||
1958 | +/** |
||
1959 | + * dpaa2_fl_set_offset() - Set the offset field of FLE |
||
1960 | + * @fle: the given frame list entry |
||
1961 | + * @offset: the offset needs to be set in frame list entry |
||
1962 | + */ |
||
1963 | +static inline void dpaa2_fl_set_offset(struct dpaa2_fl_entry *fle, u16 offset) |
||
1964 | +{ |
||
1965 | + fle->format_offset &= cpu_to_le16(~FL_OFFSET_MASK); |
||
1966 | + fle->format_offset |= cpu_to_le16(offset); |
||
1967 | +} |
||
1968 | + |
||
1969 | +/** |
||
1970 | + * dpaa2_fl_get_format() - Get the format field in the FLE |
||
1971 | + * @fle: the given frame list entry |
||
1972 | + * |
||
1973 | + * Return the format. |
||
1974 | + */ |
||
1975 | +static inline enum dpaa2_fl_format dpaa2_fl_get_format( |
||
1976 | + const struct dpaa2_fl_entry *fle) |
||
1977 | +{ |
||
1978 | + return (enum dpaa2_fl_format)((le16_to_cpu(fle->format_offset) >> |
||
1979 | + FL_FORMAT_SHIFT) & FL_FORMAT_MASK); |
||
1980 | +} |
||
1981 | + |
||
1982 | +/** |
||
1983 | + * dpaa2_fl_set_format() - Set the format field of FLE |
||
1984 | + * @fle: the given frame list entry |
||
1985 | + * @format: the format needs to be set in frame list entry |
||
1986 | + */ |
||
1987 | +static inline void dpaa2_fl_set_format(struct dpaa2_fl_entry *fle, |
||
1988 | + enum dpaa2_fl_format format) |
||
1989 | +{ |
||
1990 | + fle->format_offset &= cpu_to_le16(~(FL_FORMAT_MASK << FL_FORMAT_SHIFT)); |
||
1991 | + fle->format_offset |= cpu_to_le16(format << FL_FORMAT_SHIFT); |
||
1992 | +} |
||
1993 | + |
||
1994 | +/** |
||
1995 | + * dpaa2_fl_get_bpid() - Get the bpid field in the FLE |
||
1996 | + * @fle: the given frame list entry |
||
1997 | + * |
||
1998 | + * Return the buffer pool id. |
||
1999 | + */ |
||
2000 | +static inline u16 dpaa2_fl_get_bpid(const struct dpaa2_fl_entry *fle) |
||
2001 | +{ |
||
2002 | + return le16_to_cpu(fle->bpid) & FL_BPID_MASK; |
||
2003 | +} |
||
2004 | + |
||
2005 | +/** |
||
2006 | + * dpaa2_fl_set_bpid() - Set the bpid field of FLE |
||
2007 | + * @fle: the given frame list entry |
||
2008 | + * @bpid: buffer pool id to be set |
||
2009 | + */ |
||
2010 | +static inline void dpaa2_fl_set_bpid(struct dpaa2_fl_entry *fle, u16 bpid) |
||
2011 | +{ |
||
2012 | + fle->bpid &= cpu_to_le16(~(FL_BPID_MASK)); |
||
2013 | + fle->bpid |= cpu_to_le16(bpid); |
||
2014 | +} |
||
2015 | + |
||
2016 | +/** |
||
2017 | + * dpaa2_fl_is_final() - Check final bit in FLE |
||
2018 | + * @fle: the given frame list entry |
||
2019 | + * |
||
2020 | + * Return bool. |
||
2021 | + */ |
||
2022 | +static inline bool dpaa2_fl_is_final(const struct dpaa2_fl_entry *fle) |
||
2023 | +{ |
||
2024 | + return !!(le16_to_cpu(fle->format_offset) >> FL_FINAL_FLAG_SHIFT); |
||
2025 | +} |
||
2026 | + |
||
2027 | +/** |
||
2028 | + * dpaa2_fl_set_final() - Set the final bit in FLE |
||
2029 | + * @fle: the given frame list entry |
||
2030 | + * @final: the final boolean to be set |
||
2031 | + */ |
||
2032 | +static inline void dpaa2_fl_set_final(struct dpaa2_fl_entry *fle, bool final) |
||
2033 | +{ |
||
2034 | + fle->format_offset &= cpu_to_le16(~(FL_FINAL_FLAG_MASK << |
||
2035 | + FL_FINAL_FLAG_SHIFT)); |
||
2036 | + fle->format_offset |= cpu_to_le16(final << FL_FINAL_FLAG_SHIFT); |
||
2037 | +} |
||
2038 | + |
||
2039 | #endif /* __FSL_DPAA2_FD_H */ |
||
2040 | --- a/drivers/staging/fsl-mc/include/dpaa2-global.h |
||
2041 | +++ b/drivers/staging/fsl-mc/include/dpaa2-global.h |
||
2042 | @@ -1,33 +1,8 @@ |
||
2043 | +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ |
||
2044 | /* |
||
2045 | * Copyright 2014-2016 Freescale Semiconductor Inc. |
||
2046 | * Copyright 2016 NXP |
||
2047 | * |
||
2048 | - * Redistribution and use in source and binary forms, with or without |
||
2049 | - * modification, are permitted provided that the following conditions are met: |
||
2050 | - * * Redistributions of source code must retain the above copyright |
||
2051 | - * notice, this list of conditions and the following disclaimer. |
||
2052 | - * * Redistributions in binary form must reproduce the above copyright |
||
2053 | - * notice, this list of conditions and the following disclaimer in the |
||
2054 | - * documentation and/or other materials provided with the distribution. |
||
2055 | - * * Neither the name of Freescale Semiconductor nor the |
||
2056 | - * names of its contributors may be used to endorse or promote products |
||
2057 | - * derived from this software without specific prior written permission. |
||
2058 | - * |
||
2059 | - * ALTERNATIVELY, this software may be distributed under the terms of the |
||
2060 | - * GNU General Public License ("GPL") as published by the Free Software |
||
2061 | - * Foundation, either version 2 of that License or (at your option) any |
||
2062 | - * later version. |
||
2063 | - * |
||
2064 | - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY |
||
2065 | - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||
2066 | - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||
2067 | - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY |
||
2068 | - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
||
2069 | - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||
2070 | - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
||
2071 | - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
2072 | - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||
2073 | - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
2074 | */ |
||
2075 | #ifndef __FSL_DPAA2_GLOBAL_H |
||
2076 | #define __FSL_DPAA2_GLOBAL_H |
||
2077 | --- a/drivers/staging/fsl-mc/include/dpaa2-io.h |
||
2078 | +++ b/drivers/staging/fsl-mc/include/dpaa2-io.h |
||
2079 | @@ -1,33 +1,8 @@ |
||
2080 | +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ |
||
2081 | /* |
||
2082 | * Copyright 2014-2016 Freescale Semiconductor Inc. |
||
2083 | - * Copyright NXP |
||
2084 | + * Copyright 2017 NXP |
||
2085 | * |
||
2086 | - * Redistribution and use in source and binary forms, with or without |
||
2087 | - * modification, are permitted provided that the following conditions are met: |
||
2088 | - * * Redistributions of source code must retain the above copyright |
||
2089 | - * notice, this list of conditions and the following disclaimer. |
||
2090 | - * * Redistributions in binary form must reproduce the above copyright |
||
2091 | - * notice, this list of conditions and the following disclaimer in the |
||
2092 | - * documentation and/or other materials provided with the distribution. |
||
2093 | - * * Neither the name of Freescale Semiconductor nor the |
||
2094 | - * names of its contributors may be used to endorse or promote products |
||
2095 | - * derived from this software without specific prior written permission. |
||
2096 | - * |
||
2097 | - * ALTERNATIVELY, this software may be distributed under the terms of the |
||
2098 | - * GNU General Public License ("GPL") as published by the Free Software |
||
2099 | - * Foundation, either version 2 of that License or (at your option) any |
||
2100 | - * later version. |
||
2101 | - * |
||
2102 | - * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY |
||
2103 | - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||
2104 | - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||
2105 | - * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY |
||
2106 | - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
||
2107 | - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||
2108 | - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
||
2109 | - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
2110 | - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||
2111 | - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
2112 | */ |
||
2113 | #ifndef __FSL_DPAA2_IO_H |
||
2114 | #define __FSL_DPAA2_IO_H |
||
2115 | @@ -88,6 +63,8 @@ void dpaa2_io_down(struct dpaa2_io *d); |
||
2116 | |||
2117 | irqreturn_t dpaa2_io_irq(struct dpaa2_io *obj); |
||
2118 | |||
2119 | +struct dpaa2_io *dpaa2_io_service_select(int cpu); |
||
2120 | + |
||
2121 | /** |
||
2122 | * struct dpaa2_io_notification_ctx - The DPIO notification context structure |
||
2123 | * @cb: The callback to be invoked when the notification arrives |
||
2124 | @@ -103,7 +80,7 @@ irqreturn_t dpaa2_io_irq(struct dpaa2_io |
||
2125 | * Used when a FQDAN/CDAN registration is made by drivers. |
||
2126 | */ |
||
2127 | struct dpaa2_io_notification_ctx { |
||
2128 | - void (*cb)(struct dpaa2_io_notification_ctx *); |
||
2129 | + void (*cb)(struct dpaa2_io_notification_ctx *ctx); |
||
2130 | int is_cdan; |
||
2131 | u32 id; |
||
2132 | int desired_cpu; |
||
2133 | @@ -129,9 +106,9 @@ int dpaa2_io_service_enqueue_fq(struct d |
||
2134 | const struct dpaa2_fd *fd); |
||
2135 | int dpaa2_io_service_enqueue_qd(struct dpaa2_io *d, u32 qdid, u8 prio, |
||
2136 | u16 qdbin, const struct dpaa2_fd *fd); |
||
2137 | -int dpaa2_io_service_release(struct dpaa2_io *d, u32 bpid, |
||
2138 | +int dpaa2_io_service_release(struct dpaa2_io *d, u16 bpid, |
||
2139 | const u64 *buffers, unsigned int num_buffers); |
||
2140 | -int dpaa2_io_service_acquire(struct dpaa2_io *d, u32 bpid, |
||
2141 | +int dpaa2_io_service_acquire(struct dpaa2_io *d, u16 bpid, |
||
2142 | u64 *buffers, unsigned int num_buffers); |
||
2143 | |||
2144 | struct dpaa2_io_store *dpaa2_io_store_create(unsigned int max_frames, |
||
2145 | @@ -139,4 +116,64 @@ struct dpaa2_io_store *dpaa2_io_store_cr |
||
2146 | void dpaa2_io_store_destroy(struct dpaa2_io_store *s); |
||
2147 | struct dpaa2_dq *dpaa2_io_store_next(struct dpaa2_io_store *s, int *is_last); |
||
2148 | |||
2149 | +/* Order Restoration Support */ |
||
2150 | +int dpaa2_io_service_enqueue_orp_fq(struct dpaa2_io *d, u32 fqid, |
||
2151 | + const struct dpaa2_fd *fd, u16 orpid, |
||
2152 | + u16 seqnum, int last); |
||
2153 | + |
||
2154 | +int dpaa2_io_service_enqueue_orp_qd(struct dpaa2_io *d, u32 qdid, u8 prio, |
||
2155 | + u16 qdbin, const struct dpaa2_fd *fd, |
||
2156 | + u16 orpid, u16 seqnum, int last); |
||
2157 | + |
||
2158 | +int dpaa2_io_service_orp_seqnum_drop(struct dpaa2_io *d, u16 orpid, |
||
2159 | + u16 seqnum); |
||
2160 | + |
||
2161 | +/***************/ |
||
2162 | +/* CSCN */ |
||
2163 | +/***************/ |
||
2164 | + |
||
2165 | +/** |
||
2166 | + * struct dpaa2_cscn - The CSCN message format |
||
2167 | + * @verb: identifies the type of message (should be 0x27). |
||
2168 | + * @stat: status bits related to dequeuing response (not used) |
||
2169 | + * @state: bit 0 = 0/1 if CG is no/is congested |
||
2170 | + * @reserved: reserved byte |
||
2171 | + * @cgid: congest grp ID - the first 16 bits |
||
2172 | + * @ctx: context data |
||
2173 | + * |
||
2174 | + * Congestion management can be implemented in software through |
||
2175 | + * the use of Congestion State Change Notifications (CSCN). These |
||
2176 | + * are messages written by DPAA2 hardware to memory whenever the |
||
2177 | + * instantaneous count (I_CNT field in the CG) exceeds the |
||
2178 | + * Congestion State (CS) entrance threshold, signifying congestion |
||
2179 | + * entrance, or when the instantaneous count returns below exit |
||
2180 | + * threshold, signifying congestion exit. The format of the message |
||
2181 | + * is given by the dpaa2_cscn structure. Bit 0 of the state field |
||
2182 | + * represents congestion state written by the hardware. |
||
2183 | + */ |
||
2184 | +struct dpaa2_cscn { |
||
2185 | + u8 verb; |
||
2186 | + u8 stat; |
||
2187 | + u8 state; |
||
2188 | + u8 reserved; |
||
2189 | + __le32 cgid; |
||
2190 | + __le64 ctx; |
||
2191 | +}; |
||
2192 | + |
||
2193 | +#define DPAA2_CSCN_SIZE 64 |
||
2194 | +#define DPAA2_CSCN_ALIGN 16 |
||
2195 | + |
||
2196 | +#define DPAA2_CSCN_STATE_MASK 0x1 |
||
2197 | +#define DPAA2_CSCN_CONGESTED 1 |
||
2198 | + |
||
2199 | +static inline bool dpaa2_cscn_state_congested(struct dpaa2_cscn *cscn) |
||
2200 | +{ |
||
2201 | + return ((cscn->state & DPAA2_CSCN_STATE_MASK) == DPAA2_CSCN_CONGESTED); |
||
2202 | +} |
||
2203 | + |
||
2204 | +int dpaa2_io_query_fq_count(struct dpaa2_io *d, u32 fqid, |
||
2205 | + u32 *fcnt, u32 *bcnt); |
||
2206 | +int dpaa2_io_query_bp_count(struct dpaa2_io *d, u16 bpid, |
||
2207 | + u32 *num); |
||
2208 | + |
||
2209 | #endif /* __FSL_DPAA2_IO_H */ |
||
2210 | --- a/drivers/staging/fsl-mc/include/dpbp.h |
||
2211 | +++ b/drivers/staging/fsl-mc/include/dpbp.h |
||
2212 | @@ -1,34 +1,7 @@ |
||
2213 | +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ |
||
2214 | /* |
||
2215 | * Copyright 2013-2016 Freescale Semiconductor Inc. |
||
2216 | * |
||
2217 | - * Redistribution and use in source and binary forms, with or without |
||
2218 | - * modification, are permitted provided that the following conditions are met: |
||
2219 | - * * Redistributions of source code must retain the above copyright |
||
2220 | - * notice, this list of conditions and the following disclaimer. |
||
2221 | - * * Redistributions in binary form must reproduce the above copyright |
||
2222 | - * notice, this list of conditions and the following disclaimer in the |
||
2223 | - * documentation and/or other materials provided with the distribution. |
||
2224 | - * * Neither the name of the above-listed copyright holders nor the |
||
2225 | - * names of any contributors may be used to endorse or promote products |
||
2226 | - * derived from this software without specific prior written permission. |
||
2227 | - * |
||
2228 | - * |
||
2229 | - * ALTERNATIVELY, this software may be distributed under the terms of the |
||
2230 | - * GNU General Public License ("GPL") as published by the Free Software |
||
2231 | - * Foundation, either version 2 of that License or (at your option) any |
||
2232 | - * later version. |
||
2233 | - * |
||
2234 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||
2235 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
2236 | - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
2237 | - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE |
||
2238 | - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||
2239 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||
2240 | - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||
2241 | - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||
2242 | - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||
2243 | - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||
2244 | - * POSSIBILITY OF SUCH DAMAGE. |
||
2245 | */ |
||
2246 | #ifndef __FSL_DPBP_H |
||
2247 | #define __FSL_DPBP_H |
||
2248 | --- a/drivers/staging/fsl-mc/include/dpcon.h |
||
2249 | +++ b/drivers/staging/fsl-mc/include/dpcon.h |
||
2250 | @@ -1,33 +1,7 @@ |
||
2251 | -/* Copyright 2013-2016 Freescale Semiconductor Inc. |
||
2252 | +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ |
||
2253 | +/* |
||
2254 | + * Copyright 2013-2016 Freescale Semiconductor Inc. |
||
2255 | * |
||
2256 | - * Redistribution and use in source and binary forms, with or without |
||
2257 | - * modification, are permitted provided that the following conditions are met: |
||
2258 | - * * Redistributions of source code must retain the above copyright |
||
2259 | - * notice, this list of conditions and the following disclaimer. |
||
2260 | - * * Redistributions in binary form must reproduce the above copyright |
||
2261 | - * notice, this list of conditions and the following disclaimer in the |
||
2262 | - * documentation and/or other materials provided with the distribution. |
||
2263 | - * * Neither the name of the above-listed copyright holders nor the |
||
2264 | - * names of any contributors may be used to endorse or promote products |
||
2265 | - * derived from this software without specific prior written permission. |
||
2266 | - * |
||
2267 | - * |
||
2268 | - * ALTERNATIVELY, this software may be distributed under the terms of the |
||
2269 | - * GNU General Public License ("GPL") as published by the Free Software |
||
2270 | - * Foundation, either version 2 of that License or (at your option) any |
||
2271 | - * later version. |
||
2272 | - * |
||
2273 | - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||
2274 | - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
2275 | - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
2276 | - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE |
||
2277 | - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||
2278 | - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||
2279 | - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||
2280 | - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||
2281 | - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||
2282 | - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||
2283 | - * POSSIBILITY OF SUCH DAMAGE. |
||
2284 | */ |
||
2285 | #ifndef __FSL_DPCON_H |
||
2286 | #define __FSL_DPCON_H |
||
2287 | --- /dev/null |
||
2288 | +++ b/drivers/staging/fsl-mc/include/dpopr.h |
||
2289 | @@ -0,0 +1,110 @@ |
||
2290 | +/* |
||
2291 | + * Copyright 2017 NXP |
||
2292 | + * |
||
2293 | + * Redistribution and use in source and binary forms, with or without |
||
2294 | + * modification, are permitted provided that the following conditions are met: |
||
2295 | + * * Redistributions of source code must retain the above copyright |
||
2296 | + * notice, this list of conditions and the following disclaimer. |
||
2297 | + * * Redistributions in binary form must reproduce the above copyright |
||
2298 | + * notice, this list of conditions and the following disclaimer in the |
||
2299 | + * documentation and/or other materials provided with the distribution. |
||
2300 | + * * Neither the name of the above-listed copyright holders nor the |
||
2301 | + * names of any contributors may be used to endorse or promote products |
||
2302 | + * derived from this software without specific prior written permission. |
||
2303 | + * |
||
2304 | + * |
||
2305 | + * ALTERNATIVELY, this software may be distributed under the terms of the |
||
2306 | + * GNU General Public License ("GPL") as published by the Free Software |
||
2307 | + * Foundation, either version 2 of that License or (at your option) any |
||
2308 | + * later version. |
||
2309 | + * |
||
2310 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
||
2311 | + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||
2312 | + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||
2313 | + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE |
||
2314 | + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
||
2315 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
||
2316 | + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
||
2317 | + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
||
2318 | + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||
2319 | + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||
2320 | + * POSSIBILITY OF SUCH DAMAGE. |
||
2321 | + */ |
||
2322 | +#ifndef __FSL_DPOPR_H_ |
||
2323 | +#define __FSL_DPOPR_H_ |
||
2324 | + |
||
2325 | +/* Data Path Order Restoration API |
||
2326 | + * Contains initialization APIs and runtime APIs for the Order Restoration |
||
2327 | + */ |
||
2328 | + |
||
2329 | +/** Order Restoration properties */ |
||
2330 | + |
||
2331 | +/** |
||
2332 | + * Create a new Order Point Record option |
||
2333 | + */ |
||
2334 | +#define OPR_OPT_CREATE 0x1 |
||
2335 | +/** |
||
2336 | + * Retire an existing Order Point Record option |
||
2337 | + */ |
||
2338 | +#define OPR_OPT_RETIRE 0x2 |
||
2339 | + |
||
2340 | +/** |
||
2341 | + * struct opr_cfg - Structure representing OPR configuration |
||
2342 | + * @oprrws: Order point record (OPR) restoration window size (0 to 5) |
||
2343 | + * 0 - Window size is 32 frames. |
||
2344 | + * 1 - Window size is 64 frames. |
||
2345 | + * 2 - Window size is 128 frames. |
||
2346 | + * 3 - Window size is 256 frames. |
||
2347 | + * 4 - Window size is 512 frames. |
||
2348 | + * 5 - Window size is 1024 frames. |
||
2349 | + * @oa: OPR auto advance NESN window size (0 disabled, 1 enabled) |
||
2350 | + * @olws: OPR acceptable late arrival window size (0 to 3) |
||
2351 | + * 0 - Disabled. Late arrivals are always rejected. |
||
2352 | + * 1 - Window size is 32 frames. |
||
2353 | + * 2 - Window size is the same as the OPR restoration |
||
2354 | + * window size configured in the OPRRWS field. |
||
2355 | + * 3 - Window size is 8192 frames. Late arrivals are |
||
2356 | + * always accepted. |
||
2357 | + * @oeane: Order restoration list (ORL) resource exhaustion |
||
2358 | + * advance NESN enable (0 disabled, 1 enabled) |
||
2359 | + * @oloe: OPR loose ordering enable (0 disabled, 1 enabled) |
||
2360 | + */ |
||
2361 | +struct opr_cfg { |
||
2362 | + u8 oprrws; |
||
2363 | + u8 oa; |
||
2364 | + u8 olws; |
||
2365 | + u8 oeane; |
||
2366 | + u8 oloe; |
||
2367 | +}; |
||
2368 | + |
||
2369 | +/** |
||
2370 | + * struct opr_qry - Structure representing OPR configuration |
||
2371 | + * @enable: Enabled state |
||
2372 | + * @rip: Retirement In Progress |
||
2373 | + * @ndsn: Next dispensed sequence number |
||
2374 | + * @nesn: Next expected sequence number |
||
2375 | + * @ea_hseq: Early arrival head sequence number |
||
2376 | + * @hseq_nlis: HSEQ not last in sequence |
||
2377 | + * @ea_tseq: Early arrival tail sequence number |
||
2378 | + * @tseq_nlis: TSEQ not last in sequence |
||
2379 | + * @ea_tptr: Early arrival tail pointer |
||
2380 | + * @ea_hptr: Early arrival head pointer |
||
2381 | + * @opr_id: Order Point Record ID |
||
2382 | + * @opr_vid: Order Point Record Virtual ID |
||
2383 | + */ |
||
2384 | +struct opr_qry { |
||
2385 | + char enable; |
||
2386 | + char rip; |
||
2387 | + u16 ndsn; |
||
2388 | + u16 nesn; |
||
2389 | + u16 ea_hseq; |
||
2390 | + char hseq_nlis; |
||
2391 | + u16 ea_tseq; |
||
2392 | + char tseq_nlis; |
||
2393 | + u16 ea_tptr; |
||
2394 | + u16 ea_hptr; |
||
2395 | + u16 opr_id; |
||
2396 | + u16 opr_vid; |
||
2397 | +}; |
||
2398 | + |
||
2399 | +#endif /* __FSL_DPOPR_H_ */ |
||
2400 | --- a/drivers/staging/fsl-mc/include/mc.h |
||
2401 | +++ b/drivers/staging/fsl-mc/include/mc.h |
||
2402 | @@ -1,12 +1,10 @@ |
||
2403 | +/* SPDX-License-Identifier: GPL-2.0 */ |
||
2404 | /* |
||
2405 | * Freescale Management Complex (MC) bus public interface |
||
2406 | * |
||
2407 | * Copyright (C) 2014-2016 Freescale Semiconductor, Inc. |
||
2408 | * Author: German Rivera <German.Rivera@freescale.com> |
||
2409 | * |
||
2410 | - * This file is licensed under the terms of the GNU General Public |
||
2411 | - * License version 2. This program is licensed "as is" without any |
||
2412 | - * warranty of any kind, whether express or implied. |
||
2413 | */ |
||
2414 | #ifndef _FSL_MC_H_ |
||
2415 | #define _FSL_MC_H_ |