xref: /openbmc/linux/drivers/soc/fsl/dpio/dpio.h (revision d4fffba4)
1 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
2 /*
3  * Copyright 2013-2016 Freescale Semiconductor Inc.
4  * Copyright 2016 NXP
5  *
6  */
7 #ifndef __FSL_DPIO_H
8 #define __FSL_DPIO_H
9 
10 struct fsl_mc_io;
11 
12 int dpio_open(struct fsl_mc_io	*mc_io,
13 	      u32		cmd_flags,
14 	      int		dpio_id,
15 	      u16		*token);
16 
17 int dpio_close(struct fsl_mc_io	*mc_io,
18 	       u32		cmd_flags,
19 	       u16		token);
20 
21 /**
22  * enum dpio_channel_mode - DPIO notification channel mode
23  * @DPIO_NO_CHANNEL: No support for notification channel
24  * @DPIO_LOCAL_CHANNEL: Notifications on data availability can be received by a
25  *	dedicated channel in the DPIO; user should point the queue's
26  *	destination in the relevant interface to this DPIO
27  */
28 enum dpio_channel_mode {
29 	DPIO_NO_CHANNEL = 0,
30 	DPIO_LOCAL_CHANNEL = 1,
31 };
32 
33 /**
34  * struct dpio_cfg - Structure representing DPIO configuration
35  * @channel_mode: Notification channel mode
36  * @num_priorities: Number of priorities for the notification channel (1-8);
37  *			relevant only if 'channel_mode = DPIO_LOCAL_CHANNEL'
38  */
39 struct dpio_cfg {
40 	enum dpio_channel_mode	channel_mode;
41 	u8		num_priorities;
42 };
43 
44 int dpio_enable(struct fsl_mc_io	*mc_io,
45 		u32		cmd_flags,
46 		u16		token);
47 
48 int dpio_disable(struct fsl_mc_io	*mc_io,
49 		 u32		cmd_flags,
50 		 u16		token);
51 
52 /**
53  * struct dpio_attr - Structure representing DPIO attributes
54  * @id: DPIO object ID
55  * @qbman_portal_ce_offset: offset of the software portal cache-enabled area
56  * @qbman_portal_ci_offset: offset of the software portal cache-inhibited area
57  * @qbman_portal_id: Software portal ID
58  * @channel_mode: Notification channel mode
59  * @num_priorities: Number of priorities for the notification channel (1-8);
60  *			relevant only if 'channel_mode = DPIO_LOCAL_CHANNEL'
61  * @qbman_version: QBMAN version
62  * @clk: QBMAN clock frequency value in Hz
63  */
64 struct dpio_attr {
65 	int			id;
66 	u64		qbman_portal_ce_offset;
67 	u64		qbman_portal_ci_offset;
68 	u16		qbman_portal_id;
69 	enum dpio_channel_mode	channel_mode;
70 	u8			num_priorities;
71 	u32		qbman_version;
72 	u32		clk;
73 };
74 
75 int dpio_get_attributes(struct fsl_mc_io	*mc_io,
76 			u32		cmd_flags,
77 			u16		token,
78 			struct dpio_attr	*attr);
79 
80 int dpio_set_stashing_destination(struct fsl_mc_io *mc_io,
81 				  u32 cmd_flags,
82 				  u16 token,
83 				  u8 dest);
84 
85 int dpio_get_api_version(struct fsl_mc_io *mc_io,
86 			 u32 cmd_flags,
87 			 u16 *major_ver,
88 			 u16 *minor_ver);
89 
90 int dpio_reset(struct fsl_mc_io	*mc_io,
91 	       u32 cmd_flags,
92 	       u16 token);
93 
94 #endif /* __FSL_DPIO_H */
95