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 */ 63 struct dpio_attr { 64 int id; 65 u64 qbman_portal_ce_offset; 66 u64 qbman_portal_ci_offset; 67 u16 qbman_portal_id; 68 enum dpio_channel_mode channel_mode; 69 u8 num_priorities; 70 u32 qbman_version; 71 }; 72 73 int dpio_get_attributes(struct fsl_mc_io *mc_io, 74 u32 cmd_flags, 75 u16 token, 76 struct dpio_attr *attr); 77 78 int dpio_get_api_version(struct fsl_mc_io *mc_io, 79 u32 cmd_flags, 80 u16 *major_ver, 81 u16 *minor_ver); 82 83 #endif /* __FSL_DPIO_H */ 84