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