Lines Matching +full:mc +full:- +full:bus
1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Freescale Management Complex (MC) bus public interface
5 * Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
6 * Copyright 2019-2020 NXP
27 * struct fsl_mc_driver - MC object device driver object
44 * with a DPRC bus. This structure is to be embedded in each device-specific
62 * enum fsl_mc_pool_type - Types of allocatable MC bus resources
68 FSL_MC_POOL_DPMCP = 0x0, /* corresponds to "dpmcp" in the MC */
69 FSL_MC_POOL_DPBP, /* corresponds to "dpbp" in the MC */
70 FSL_MC_POOL_DPCON, /* corresponds to "dpcon" in the MC */
80 * struct fsl_mc_resource - MC generic resource
82 * @id: unique MC resource Id within the resources of the same type
83 * @data: pointer to resource-specific data if the resource is currently
90 * MC resource structures.
101 * struct fsl_mc_device_irq - MC object device message-based interrupt
103 * @mc_dev: MC object device that owns this interrupt
104 * @dev_irq_index: device-relative IRQ index
105 * @resource: MC generic resource associated with the interrupt
117 /* Opened state - Indicates that an object is open by at least one owner */
119 /* Plugged state - Indicates that the object is plugged */
123 * Shareability flag - Object flag indicating no memory shareability.
131 * struct fsl_mc_obj_desc - Object descriptor
157 * Bit masks for a MC object device (struct fsl_mc_device) flags
169 * struct fsl_mc_device - MC object device object
172 * @flags: MC object device flags
174 * @mc_handle: MC handle for the corresponding MC object opened
175 * @mc_io: Pointer to MC IO object assigned to this device or
177 * @obj_desc: MC description of the DPAA device
180 * @resource: generic resource associated with this MC object device, if any.
185 * Generic device object for MC object devices that are "attached" to a
186 * MC bus.
189 * - For a non-DPRC object its icid is the same as its parent DPRC's icid.
190 * - The SMMU notifier callback gets invoked after device_add() has been
191 * called for an MC object device, but before the device-specific probe
193 * - DP_OBJ_DPRC objects are the only MC objects that have built-in MC
194 * portals. For all other MC objects, their device drivers are responsible for
195 * allocating MC portals for them by calling fsl_mc_portal_allocate().
196 * - Some types of MC objects (e.g., DP_OBJ_DPBP, DP_OBJ_DPCON) are
199 * fsl_mc_object_allocate()/fsl_mc_object_free() functions. These MC objects
202 * For MC objects that are not allocatable (e.g., DP_OBJ_DPRC, DP_OBJ_DPNI),
248 * MC command flags
263 hdr->cmd_id = cpu_to_le16(cmd_id); in mc_encode_cmd_header()
264 hdr->token = cpu_to_le16(token); in mc_encode_cmd_header()
265 hdr->status = MC_CMD_STATUS_READY; in mc_encode_cmd_header()
267 hdr->flags_hw = MC_CMD_FLAG_PRI; in mc_encode_cmd_header()
269 hdr->flags_sw = MC_CMD_FLAG_INTR_DIS; in mc_encode_cmd_header()
276 struct mc_cmd_header *hdr = (struct mc_cmd_header *)&cmd->header; in mc_cmd_hdr_read_token()
277 u16 token = le16_to_cpu(hdr->token); in mc_cmd_hdr_read_token()
295 rsp_params = (struct mc_rsp_create *)cmd->params; in mc_cmd_read_object_id()
296 return le32_to_cpu(rsp_params->object_id); in mc_cmd_read_object_id()
305 rsp_params = (struct mc_rsp_api_ver *)cmd->params; in mc_cmd_read_api_version()
306 *major_ver = le16_to_cpu(rsp_params->major_ver); in mc_cmd_read_api_version()
307 *minor_ver = le16_to_cpu(rsp_params->minor_ver); in mc_cmd_read_api_version()
311 * Bit masks for a MC I/O object (struct fsl_mc_io) flags
316 * struct fsl_mc_io - MC I/O object to be passed-in to mc_send_command()
317 * @dev: device associated with this Mc I/O object
319 * @portal_size: MC command portal size in bytes
320 * @portal_phys_addr: MC command portal physical address
321 * @portal_virt_addr: MC command portal virtual address
322 * @dpmcp_dev: pointer to the DPMCP device associated with the MC portal.
326 * @mutex: Mutex to serialize mc_send_command() calls that use the same MC
329 * fsl_mc_io object must be made only from non-atomic context.
333 * @spinlock: Spinlock to serialize mc_send_command() calls that use the same MC
336 * fsl_mc_io object can be made from atomic or non-atomic context.
363 #define dev_is_fsl_mc(_dev) ((_dev)->bus == &fsl_mc_bus_type)
365 /* If fsl-mc bus is not present device cannot belong to fsl-mc bus */
370 #define fsl_mc_is_cont_dev(_dev) (to_fsl_mc_device(_dev)->flags & \
373 /* Macro to get the container device of a MC device */
375 (_dev) : (_dev)->parent)
378 * module_fsl_mc_driver() - Helper macro for drivers that don't do
459 return mc_dev->dev.type == &fsl_mc_bus_dprc_type; in is_fsl_mc_bus_dprc()
464 return mc_dev->dev.type == &fsl_mc_bus_dpni_type; in is_fsl_mc_bus_dpni()
469 return mc_dev->dev.type == &fsl_mc_bus_dpio_type; in is_fsl_mc_bus_dpio()
474 return mc_dev->dev.type == &fsl_mc_bus_dpsw_type; in is_fsl_mc_bus_dpsw()
479 return mc_dev->dev.type == &fsl_mc_bus_dpdmux_type; in is_fsl_mc_bus_dpdmux()
484 return mc_dev->dev.type == &fsl_mc_bus_dpbp_type; in is_fsl_mc_bus_dpbp()
489 return mc_dev->dev.type == &fsl_mc_bus_dpcon_type; in is_fsl_mc_bus_dpcon()
494 return mc_dev->dev.type == &fsl_mc_bus_dpmcp_type; in is_fsl_mc_bus_dpmcp()
499 return mc_dev->dev.type == &fsl_mc_bus_dpmac_type; in is_fsl_mc_bus_dpmac()
504 return mc_dev->dev.type == &fsl_mc_bus_dprtc_type; in is_fsl_mc_bus_dprtc()
509 return mc_dev->dev.type == &fsl_mc_bus_dpseci_type; in is_fsl_mc_bus_dpseci()
514 return mc_dev->dev.type == &fsl_mc_bus_dpdcei_type; in is_fsl_mc_bus_dpdcei()
519 return mc_dev->dev.type == &fsl_mc_bus_dpaiop_type; in is_fsl_mc_bus_dpaiop()
524 return mc_dev->dev.type == &fsl_mc_bus_dpci_type; in is_fsl_mc_bus_dpci()
529 return mc_dev->dev.type == &fsl_mc_bus_dpdmai_type; in is_fsl_mc_bus_dpdmai()
551 * Maximum number of total IRQs that can be pre-allocated for an MC bus'
588 * struct dpbp_attr - Structure representing DPBP attributes
610 #define DPCON_INVALID_DPIO_ID (int)(-1)
648 * struct dpcon_attr - Structure representing DPCON attributes
651 * @num_priorities: Number of priorities for the DPCON channel (1-8)
665 * struct dpcon_notification_cfg - Structure representing notification params
669 * are 0-7, depending on the number of priorities in that channel