blob: 3f3e6c40707c6a0c1291a651797e72f3218ba375 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Prabhakar Kushwahaa2a55e52015-03-19 09:20:45 -07002/*
3 * Freescale Layerscape MC I/O wrapper
Ioana Ciornei694dc0d2023-05-31 19:04:30 +03004 * Data Path Buffer Pool API
5 * Contains initialization APIs and runtime control APIs for DPBP
Prabhakar Kushwahaa2a55e52015-03-19 09:20:45 -07006 *
Yogesh Gaura6f2a6e2018-05-09 10:52:17 +05307 * Copyright 2013-2016 Freescale Semiconductor, Inc.
Ioana Ciornei694dc0d2023-05-31 19:04:30 +03008 * Copyright 2017-2023 NXP
Prabhakar Kushwahaa2a55e52015-03-19 09:20:45 -07009 */
Ioana Ciornei694dc0d2023-05-31 19:04:30 +030010
Prabhakar Kushwahaa2a55e52015-03-19 09:20:45 -070011#ifndef __FSL_DPBP_H
12#define __FSL_DPBP_H
13
14/* DPBP Version */
Yogesh Gaur2557c5a2017-11-15 11:59:31 +053015#define DPBP_VER_MAJOR 3
16#define DPBP_VER_MINOR 3
Prabhakar Kushwahaa2a55e52015-03-19 09:20:45 -070017
18/* Command IDs */
Yogesh Gaur2557c5a2017-11-15 11:59:31 +053019#define DPBP_CMDID_CLOSE 0x8001
20#define DPBP_CMDID_OPEN 0x8041
21#define DPBP_CMDID_CREATE 0x9041
22#define DPBP_CMDID_DESTROY 0x9841
23#define DPBP_CMDID_GET_API_VERSION 0xa041
Prabhakar Kushwahaa2a55e52015-03-19 09:20:45 -070024
Yogesh Gaur2557c5a2017-11-15 11:59:31 +053025#define DPBP_CMDID_ENABLE 0x0021
26#define DPBP_CMDID_DISABLE 0x0031
27#define DPBP_CMDID_GET_ATTR 0x0041
28#define DPBP_CMDID_RESET 0x0051
Prabhakar Kushwahaa2a55e52015-03-19 09:20:45 -070029
Ioana Ciornei694dc0d2023-05-31 19:04:30 +030030#pragma pack(push, 1)
Prabhakar Kushwahaa2a55e52015-03-19 09:20:45 -070031
Ioana Ciornei694dc0d2023-05-31 19:04:30 +030032struct dpbp_cmd_open {
33 __le32 dpbp_id;
34};
Prabhakar Kushwahaa2a55e52015-03-19 09:20:45 -070035
Ioana Ciornei694dc0d2023-05-31 19:04:30 +030036struct dpbp_cmd_destroy {
37 __le32 object_id;
38};
39
40struct dpbp_rsp_get_attributes {
41 __le16 pad;
42 __le16 bpid;
43 __le32 id;
44};
45
46#pragma pack(pop)
Prabhakar Kushwahaa2a55e52015-03-19 09:20:45 -070047
48struct fsl_mc_io;
49
Ioana Ciornei694dc0d2023-05-31 19:04:30 +030050int dpbp_open(struct fsl_mc_io *mc_io, u32 cmd_flags, int dpbp_id, u16 *token);
Prabhakar Kushwahaa2a55e52015-03-19 09:20:45 -070051
Ioana Ciornei694dc0d2023-05-31 19:04:30 +030052int dpbp_close(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
Prabhakar Kushwahaa2a55e52015-03-19 09:20:45 -070053
54/**
Prabhakar Kushwaha1ebbe4f2015-11-04 12:25:53 +053055 * struct dpbp_cfg - Structure representing DPBP configuration
56 * @options: place holder
57 */
58struct dpbp_cfg {
Ioana Ciornei694dc0d2023-05-31 19:04:30 +030059 u32 options;
Prabhakar Kushwaha1ebbe4f2015-11-04 12:25:53 +053060};
61
Ioana Ciornei694dc0d2023-05-31 19:04:30 +030062int dpbp_create(struct fsl_mc_io *mc_io, u16 dprc_token, u32 cmd_flags,
63 const struct dpbp_cfg *cfg, u32 *obj_id);
Prabhakar Kushwaha1ebbe4f2015-11-04 12:25:53 +053064
Ioana Ciornei694dc0d2023-05-31 19:04:30 +030065int dpbp_destroy(struct fsl_mc_io *mc_io, u16 dprc_token, u32 cmd_flags,
66 u32 obj_id);
Prabhakar Kushwaha1ebbe4f2015-11-04 12:25:53 +053067
Ioana Ciornei694dc0d2023-05-31 19:04:30 +030068int dpbp_enable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
Prabhakar Kushwahaa2a55e52015-03-19 09:20:45 -070069
Ioana Ciornei694dc0d2023-05-31 19:04:30 +030070int dpbp_disable(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
Prabhakar Kushwaha87457d12015-07-07 15:40:06 +053071
Ioana Ciornei694dc0d2023-05-31 19:04:30 +030072int dpbp_reset(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token);
Prabhakar Kushwahaa2a55e52015-03-19 09:20:45 -070073
74/**
75 * struct dpbp_attr - Structure representing DPBP attributes
76 * @id: DPBP object ID
77 * @version: DPBP version
78 * @bpid: Hardware buffer pool ID; should be used as an argument in
79 * acquire/release operations on buffers
80 */
81struct dpbp_attr {
Ioana Ciornei694dc0d2023-05-31 19:04:30 +030082 u32 id;
83 u16 bpid;
Prabhakar Kushwahaa2a55e52015-03-19 09:20:45 -070084};
85
Ioana Ciornei694dc0d2023-05-31 19:04:30 +030086int dpbp_get_attributes(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token,
87 struct dpbp_attr *attr);
Prabhakar Kushwahaa2a55e52015-03-19 09:20:45 -070088
Ioana Ciornei694dc0d2023-05-31 19:04:30 +030089int dpbp_get_api_version(struct fsl_mc_io *mc_io, u32 cmd_flags,
90 u16 *major_ver, u16 *minor_ver);
Prabhakar Kushwahaa2a55e52015-03-19 09:20:45 -070091
92#endif /* __FSL_DPBP_H */