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