xref: /kernel/linux/linux-6.6/drivers/soc/fsl/dpio/dpio.h (revision 62306a36)
162306a36Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright 2013-2016 Freescale Semiconductor Inc.
462306a36Sopenharmony_ci * Copyright 2016 NXP
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci#ifndef __FSL_DPIO_H
862306a36Sopenharmony_ci#define __FSL_DPIO_H
962306a36Sopenharmony_ci
1062306a36Sopenharmony_cistruct fsl_mc_io;
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ciint dpio_open(struct fsl_mc_io	*mc_io,
1362306a36Sopenharmony_ci	      u32		cmd_flags,
1462306a36Sopenharmony_ci	      int		dpio_id,
1562306a36Sopenharmony_ci	      u16		*token);
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ciint dpio_close(struct fsl_mc_io	*mc_io,
1862306a36Sopenharmony_ci	       u32		cmd_flags,
1962306a36Sopenharmony_ci	       u16		token);
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci/**
2262306a36Sopenharmony_ci * enum dpio_channel_mode - DPIO notification channel mode
2362306a36Sopenharmony_ci * @DPIO_NO_CHANNEL: No support for notification channel
2462306a36Sopenharmony_ci * @DPIO_LOCAL_CHANNEL: Notifications on data availability can be received by a
2562306a36Sopenharmony_ci *	dedicated channel in the DPIO; user should point the queue's
2662306a36Sopenharmony_ci *	destination in the relevant interface to this DPIO
2762306a36Sopenharmony_ci */
2862306a36Sopenharmony_cienum dpio_channel_mode {
2962306a36Sopenharmony_ci	DPIO_NO_CHANNEL = 0,
3062306a36Sopenharmony_ci	DPIO_LOCAL_CHANNEL = 1,
3162306a36Sopenharmony_ci};
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci/**
3462306a36Sopenharmony_ci * struct dpio_cfg - Structure representing DPIO configuration
3562306a36Sopenharmony_ci * @channel_mode: Notification channel mode
3662306a36Sopenharmony_ci * @num_priorities: Number of priorities for the notification channel (1-8);
3762306a36Sopenharmony_ci *			relevant only if 'channel_mode = DPIO_LOCAL_CHANNEL'
3862306a36Sopenharmony_ci */
3962306a36Sopenharmony_cistruct dpio_cfg {
4062306a36Sopenharmony_ci	enum dpio_channel_mode	channel_mode;
4162306a36Sopenharmony_ci	u8		num_priorities;
4262306a36Sopenharmony_ci};
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ciint dpio_enable(struct fsl_mc_io	*mc_io,
4562306a36Sopenharmony_ci		u32		cmd_flags,
4662306a36Sopenharmony_ci		u16		token);
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ciint dpio_disable(struct fsl_mc_io	*mc_io,
4962306a36Sopenharmony_ci		 u32		cmd_flags,
5062306a36Sopenharmony_ci		 u16		token);
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci/**
5362306a36Sopenharmony_ci * struct dpio_attr - Structure representing DPIO attributes
5462306a36Sopenharmony_ci * @id: DPIO object ID
5562306a36Sopenharmony_ci * @qbman_portal_ce_offset: offset of the software portal cache-enabled area
5662306a36Sopenharmony_ci * @qbman_portal_ci_offset: offset of the software portal cache-inhibited area
5762306a36Sopenharmony_ci * @qbman_portal_id: Software portal ID
5862306a36Sopenharmony_ci * @channel_mode: Notification channel mode
5962306a36Sopenharmony_ci * @num_priorities: Number of priorities for the notification channel (1-8);
6062306a36Sopenharmony_ci *			relevant only if 'channel_mode = DPIO_LOCAL_CHANNEL'
6162306a36Sopenharmony_ci * @qbman_version: QBMAN version
6262306a36Sopenharmony_ci * @clk: QBMAN clock frequency value in Hz
6362306a36Sopenharmony_ci */
6462306a36Sopenharmony_cistruct dpio_attr {
6562306a36Sopenharmony_ci	int			id;
6662306a36Sopenharmony_ci	u64		qbman_portal_ce_offset;
6762306a36Sopenharmony_ci	u64		qbman_portal_ci_offset;
6862306a36Sopenharmony_ci	u16		qbman_portal_id;
6962306a36Sopenharmony_ci	enum dpio_channel_mode	channel_mode;
7062306a36Sopenharmony_ci	u8			num_priorities;
7162306a36Sopenharmony_ci	u32		qbman_version;
7262306a36Sopenharmony_ci	u32		clk;
7362306a36Sopenharmony_ci};
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ciint dpio_get_attributes(struct fsl_mc_io	*mc_io,
7662306a36Sopenharmony_ci			u32		cmd_flags,
7762306a36Sopenharmony_ci			u16		token,
7862306a36Sopenharmony_ci			struct dpio_attr	*attr);
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ciint dpio_set_stashing_destination(struct fsl_mc_io *mc_io,
8162306a36Sopenharmony_ci				  u32 cmd_flags,
8262306a36Sopenharmony_ci				  u16 token,
8362306a36Sopenharmony_ci				  u8 dest);
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ciint dpio_get_api_version(struct fsl_mc_io *mc_io,
8662306a36Sopenharmony_ci			 u32 cmd_flags,
8762306a36Sopenharmony_ci			 u16 *major_ver,
8862306a36Sopenharmony_ci			 u16 *minor_ver);
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ciint dpio_reset(struct fsl_mc_io	*mc_io,
9162306a36Sopenharmony_ci	       u32 cmd_flags,
9262306a36Sopenharmony_ci	       u16 token);
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci#endif /* __FSL_DPIO_H */
95