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