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 62*2cf0b6feSIoana Ciornei * @clk: QBMAN clock frequency value in Hz 63c89105c9SRoy Pledge */ 64c89105c9SRoy Pledge struct dpio_attr { 65c89105c9SRoy Pledge int id; 66c89105c9SRoy Pledge u64 qbman_portal_ce_offset; 67c89105c9SRoy Pledge u64 qbman_portal_ci_offset; 68c89105c9SRoy Pledge u16 qbman_portal_id; 69c89105c9SRoy Pledge enum dpio_channel_mode channel_mode; 70c89105c9SRoy Pledge u8 num_priorities; 71c89105c9SRoy Pledge u32 qbman_version; 72*2cf0b6feSIoana Ciornei u32 clk; 73c89105c9SRoy Pledge }; 74c89105c9SRoy Pledge 75c89105c9SRoy Pledge int dpio_get_attributes(struct fsl_mc_io *mc_io, 76c89105c9SRoy Pledge u32 cmd_flags, 77c89105c9SRoy Pledge u16 token, 78c89105c9SRoy Pledge struct dpio_attr *attr); 79c89105c9SRoy Pledge 8051da14e9SIoana Ciornei int dpio_set_stashing_destination(struct fsl_mc_io *mc_io, 8151da14e9SIoana Ciornei u32 cmd_flags, 8251da14e9SIoana Ciornei u16 token, 8351da14e9SIoana Ciornei u8 dest); 8451da14e9SIoana Ciornei 85c89105c9SRoy Pledge int dpio_get_api_version(struct fsl_mc_io *mc_io, 86c89105c9SRoy Pledge u32 cmd_flags, 87c89105c9SRoy Pledge u16 *major_ver, 88c89105c9SRoy Pledge u16 *minor_ver); 89c89105c9SRoy Pledge 9011c8bac9SRoy Pledge int dpio_reset(struct fsl_mc_io *mc_io, 9111c8bac9SRoy Pledge u32 cmd_flags, 9211c8bac9SRoy Pledge u16 token); 9311c8bac9SRoy Pledge 94c89105c9SRoy Pledge #endif /* __FSL_DPIO_H */ 95