Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Freescale Management Complex (MC) bus public interface
0004  *
0005  * Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
0006  * Copyright 2019-2020 NXP
0007  * Author: German Rivera <German.Rivera@freescale.com>
0008  *
0009  */
0010 #ifndef _FSL_MC_H_
0011 #define _FSL_MC_H_
0012 
0013 #include <linux/device.h>
0014 #include <linux/mod_devicetable.h>
0015 #include <linux/interrupt.h>
0016 #include <uapi/linux/fsl_mc.h>
0017 
0018 #define FSL_MC_VENDOR_FREESCALE 0x1957
0019 
0020 struct irq_domain;
0021 struct msi_domain_info;
0022 
0023 struct fsl_mc_device;
0024 struct fsl_mc_io;
0025 
0026 /**
0027  * struct fsl_mc_driver - MC object device driver object
0028  * @driver: Generic device driver
0029  * @match_id_table: table of supported device matching Ids
0030  * @probe: Function called when a device is added
0031  * @remove: Function called when a device is removed
0032  * @shutdown: Function called at shutdown time to quiesce the device
0033  * @suspend: Function called when a device is stopped
0034  * @resume: Function called when a device is resumed
0035  * @driver_managed_dma: Device driver doesn't use kernel DMA API for DMA.
0036  *      For most device drivers, no need to care about this flag
0037  *      as long as all DMAs are handled through the kernel DMA API.
0038  *      For some special ones, for example VFIO drivers, they know
0039  *      how to manage the DMA themselves and set this flag so that
0040  *      the IOMMU layer will allow them to setup and manage their
0041  *      own I/O address space.
0042  *
0043  * Generic DPAA device driver object for device drivers that are registered
0044  * with a DPRC bus. This structure is to be embedded in each device-specific
0045  * driver structure.
0046  */
0047 struct fsl_mc_driver {
0048     struct device_driver driver;
0049     const struct fsl_mc_device_id *match_id_table;
0050     int (*probe)(struct fsl_mc_device *dev);
0051     int (*remove)(struct fsl_mc_device *dev);
0052     void (*shutdown)(struct fsl_mc_device *dev);
0053     int (*suspend)(struct fsl_mc_device *dev, pm_message_t state);
0054     int (*resume)(struct fsl_mc_device *dev);
0055     bool driver_managed_dma;
0056 };
0057 
0058 #define to_fsl_mc_driver(_drv) \
0059     container_of(_drv, struct fsl_mc_driver, driver)
0060 
0061 /**
0062  * enum fsl_mc_pool_type - Types of allocatable MC bus resources
0063  *
0064  * Entries in these enum are used as indices in the array of resource
0065  * pools of an fsl_mc_bus object.
0066  */
0067 enum fsl_mc_pool_type {
0068     FSL_MC_POOL_DPMCP = 0x0,    /* corresponds to "dpmcp" in the MC */
0069     FSL_MC_POOL_DPBP,       /* corresponds to "dpbp" in the MC */
0070     FSL_MC_POOL_DPCON,      /* corresponds to "dpcon" in the MC */
0071     FSL_MC_POOL_IRQ,
0072 
0073     /*
0074      * NOTE: New resource pool types must be added before this entry
0075      */
0076     FSL_MC_NUM_POOL_TYPES
0077 };
0078 
0079 /**
0080  * struct fsl_mc_resource - MC generic resource
0081  * @type: type of resource
0082  * @id: unique MC resource Id within the resources of the same type
0083  * @data: pointer to resource-specific data if the resource is currently
0084  * allocated, or NULL if the resource is not currently allocated.
0085  * @parent_pool: pointer to the parent resource pool from which this
0086  * resource is allocated from.
0087  * @node: Node in the free list of the corresponding resource pool
0088  *
0089  * NOTE: This structure is to be embedded as a field of specific
0090  * MC resource structures.
0091  */
0092 struct fsl_mc_resource {
0093     enum fsl_mc_pool_type type;
0094     s32 id;
0095     void *data;
0096     struct fsl_mc_resource_pool *parent_pool;
0097     struct list_head node;
0098 };
0099 
0100 /**
0101  * struct fsl_mc_device_irq - MC object device message-based interrupt
0102  * @virq: Linux virtual interrupt number
0103  * @mc_dev: MC object device that owns this interrupt
0104  * @dev_irq_index: device-relative IRQ index
0105  * @resource: MC generic resource associated with the interrupt
0106  */
0107 struct fsl_mc_device_irq {
0108     unsigned int virq;
0109     struct fsl_mc_device *mc_dev;
0110     u8 dev_irq_index;
0111     struct fsl_mc_resource resource;
0112 };
0113 
0114 #define to_fsl_mc_irq(_mc_resource) \
0115     container_of(_mc_resource, struct fsl_mc_device_irq, resource)
0116 
0117 /* Opened state - Indicates that an object is open by at least one owner */
0118 #define FSL_MC_OBJ_STATE_OPEN       0x00000001
0119 /* Plugged state - Indicates that the object is plugged */
0120 #define FSL_MC_OBJ_STATE_PLUGGED    0x00000002
0121 
0122 /**
0123  * Shareability flag - Object flag indicating no memory shareability.
0124  * the object generates memory accesses that are non coherent with other
0125  * masters;
0126  * user is responsible for proper memory handling through IOMMU configuration.
0127  */
0128 #define FSL_MC_OBJ_FLAG_NO_MEM_SHAREABILITY 0x0001
0129 
0130 /**
0131  * struct fsl_mc_obj_desc - Object descriptor
0132  * @type: Type of object: NULL terminated string
0133  * @id: ID of logical object resource
0134  * @vendor: Object vendor identifier
0135  * @ver_major: Major version number
0136  * @ver_minor:  Minor version number
0137  * @irq_count: Number of interrupts supported by the object
0138  * @region_count: Number of mappable regions supported by the object
0139  * @state: Object state: combination of FSL_MC_OBJ_STATE_ states
0140  * @label: Object label: NULL terminated string
0141  * @flags: Object's flags
0142  */
0143 struct fsl_mc_obj_desc {
0144     char type[16];
0145     int id;
0146     u16 vendor;
0147     u16 ver_major;
0148     u16 ver_minor;
0149     u8 irq_count;
0150     u8 region_count;
0151     u32 state;
0152     char label[16];
0153     u16 flags;
0154 };
0155 
0156 /**
0157  * Bit masks for a MC object device (struct fsl_mc_device) flags
0158  */
0159 #define FSL_MC_IS_DPRC  0x0001
0160 
0161 /* Region flags */
0162 /* Indicates that region can be mapped as cacheable */
0163 #define FSL_MC_REGION_CACHEABLE 0x00000001
0164 
0165 /* Indicates that region can be mapped as shareable */
0166 #define FSL_MC_REGION_SHAREABLE 0x00000002
0167 
0168 /**
0169  * struct fsl_mc_device - MC object device object
0170  * @dev: Linux driver model device object
0171  * @dma_mask: Default DMA mask
0172  * @flags: MC object device flags
0173  * @icid: Isolation context ID for the device
0174  * @mc_handle: MC handle for the corresponding MC object opened
0175  * @mc_io: Pointer to MC IO object assigned to this device or
0176  * NULL if none.
0177  * @obj_desc: MC description of the DPAA device
0178  * @regions: pointer to array of MMIO region entries
0179  * @irqs: pointer to array of pointers to interrupts allocated to this device
0180  * @resource: generic resource associated with this MC object device, if any.
0181  * @driver_override: driver name to force a match; do not set directly,
0182  *                   because core frees it; use driver_set_override() to
0183  *                   set or clear it.
0184  *
0185  * Generic device object for MC object devices that are "attached" to a
0186  * MC bus.
0187  *
0188  * NOTES:
0189  * - For a non-DPRC object its icid is the same as its parent DPRC's icid.
0190  * - The SMMU notifier callback gets invoked after device_add() has been
0191  *   called for an MC object device, but before the device-specific probe
0192  *   callback gets called.
0193  * - DP_OBJ_DPRC objects are the only MC objects that have built-in MC
0194  *   portals. For all other MC objects, their device drivers are responsible for
0195  *   allocating MC portals for them by calling fsl_mc_portal_allocate().
0196  * - Some types of MC objects (e.g., DP_OBJ_DPBP, DP_OBJ_DPCON) are
0197  *   treated as resources that can be allocated/deallocated from the
0198  *   corresponding resource pool in the object's parent DPRC, using the
0199  *   fsl_mc_object_allocate()/fsl_mc_object_free() functions. These MC objects
0200  *   are known as "allocatable" objects. For them, the corresponding
0201  *   fsl_mc_device's 'resource' points to the associated resource object.
0202  *   For MC objects that are not allocatable (e.g., DP_OBJ_DPRC, DP_OBJ_DPNI),
0203  *   'resource' is NULL.
0204  */
0205 struct fsl_mc_device {
0206     struct device dev;
0207     u64 dma_mask;
0208     u16 flags;
0209     u32 icid;
0210     u16 mc_handle;
0211     struct fsl_mc_io *mc_io;
0212     struct fsl_mc_obj_desc obj_desc;
0213     struct resource *regions;
0214     struct fsl_mc_device_irq **irqs;
0215     struct fsl_mc_resource *resource;
0216     struct device_link *consumer_link;
0217     const char *driver_override;
0218 };
0219 
0220 #define to_fsl_mc_device(_dev) \
0221     container_of(_dev, struct fsl_mc_device, dev)
0222 
0223 struct mc_cmd_header {
0224     u8 src_id;
0225     u8 flags_hw;
0226     u8 status;
0227     u8 flags_sw;
0228     __le16 token;
0229     __le16 cmd_id;
0230 };
0231 
0232 enum mc_cmd_status {
0233     MC_CMD_STATUS_OK = 0x0, /* Completed successfully */
0234     MC_CMD_STATUS_READY = 0x1, /* Ready to be processed */
0235     MC_CMD_STATUS_AUTH_ERR = 0x3, /* Authentication error */
0236     MC_CMD_STATUS_NO_PRIVILEGE = 0x4, /* No privilege */
0237     MC_CMD_STATUS_DMA_ERR = 0x5, /* DMA or I/O error */
0238     MC_CMD_STATUS_CONFIG_ERR = 0x6, /* Configuration error */
0239     MC_CMD_STATUS_TIMEOUT = 0x7, /* Operation timed out */
0240     MC_CMD_STATUS_NO_RESOURCE = 0x8, /* No resources */
0241     MC_CMD_STATUS_NO_MEMORY = 0x9, /* No memory available */
0242     MC_CMD_STATUS_BUSY = 0xA, /* Device is busy */
0243     MC_CMD_STATUS_UNSUPPORTED_OP = 0xB, /* Unsupported operation */
0244     MC_CMD_STATUS_INVALID_STATE = 0xC /* Invalid state */
0245 };
0246 
0247 /*
0248  * MC command flags
0249  */
0250 
0251 /* High priority flag */
0252 #define MC_CMD_FLAG_PRI     0x80
0253 /* Command completion flag */
0254 #define MC_CMD_FLAG_INTR_DIS    0x01
0255 
0256 static inline __le64 mc_encode_cmd_header(u16 cmd_id,
0257                       u32 cmd_flags,
0258                       u16 token)
0259 {
0260     __le64 header = 0;
0261     struct mc_cmd_header *hdr = (struct mc_cmd_header *)&header;
0262 
0263     hdr->cmd_id = cpu_to_le16(cmd_id);
0264     hdr->token  = cpu_to_le16(token);
0265     hdr->status = MC_CMD_STATUS_READY;
0266     if (cmd_flags & MC_CMD_FLAG_PRI)
0267         hdr->flags_hw = MC_CMD_FLAG_PRI;
0268     if (cmd_flags & MC_CMD_FLAG_INTR_DIS)
0269         hdr->flags_sw = MC_CMD_FLAG_INTR_DIS;
0270 
0271     return header;
0272 }
0273 
0274 static inline u16 mc_cmd_hdr_read_token(struct fsl_mc_command *cmd)
0275 {
0276     struct mc_cmd_header *hdr = (struct mc_cmd_header *)&cmd->header;
0277     u16 token = le16_to_cpu(hdr->token);
0278 
0279     return token;
0280 }
0281 
0282 struct mc_rsp_create {
0283     __le32 object_id;
0284 };
0285 
0286 struct mc_rsp_api_ver {
0287     __le16 major_ver;
0288     __le16 minor_ver;
0289 };
0290 
0291 static inline u32 mc_cmd_read_object_id(struct fsl_mc_command *cmd)
0292 {
0293     struct mc_rsp_create *rsp_params;
0294 
0295     rsp_params = (struct mc_rsp_create *)cmd->params;
0296     return le32_to_cpu(rsp_params->object_id);
0297 }
0298 
0299 static inline void mc_cmd_read_api_version(struct fsl_mc_command *cmd,
0300                        u16 *major_ver,
0301                        u16 *minor_ver)
0302 {
0303     struct mc_rsp_api_ver *rsp_params;
0304 
0305     rsp_params = (struct mc_rsp_api_ver *)cmd->params;
0306     *major_ver = le16_to_cpu(rsp_params->major_ver);
0307     *minor_ver = le16_to_cpu(rsp_params->minor_ver);
0308 }
0309 
0310 /**
0311  * Bit masks for a MC I/O object (struct fsl_mc_io) flags
0312  */
0313 #define FSL_MC_IO_ATOMIC_CONTEXT_PORTAL 0x0001
0314 
0315 /**
0316  * struct fsl_mc_io - MC I/O object to be passed-in to mc_send_command()
0317  * @dev: device associated with this Mc I/O object
0318  * @flags: flags for mc_send_command()
0319  * @portal_size: MC command portal size in bytes
0320  * @portal_phys_addr: MC command portal physical address
0321  * @portal_virt_addr: MC command portal virtual address
0322  * @dpmcp_dev: pointer to the DPMCP device associated with the MC portal.
0323  *
0324  * Fields are only meaningful if the FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is not
0325  * set:
0326  * @mutex: Mutex to serialize mc_send_command() calls that use the same MC
0327  * portal, if the fsl_mc_io object was created with the
0328  * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag off. mc_send_command() calls for this
0329  * fsl_mc_io object must be made only from non-atomic context.
0330  *
0331  * Fields are only meaningful if the FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is
0332  * set:
0333  * @spinlock: Spinlock to serialize mc_send_command() calls that use the same MC
0334  * portal, if the fsl_mc_io object was created with the
0335  * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag on. mc_send_command() calls for this
0336  * fsl_mc_io object can be made from atomic or non-atomic context.
0337  */
0338 struct fsl_mc_io {
0339     struct device *dev;
0340     u16 flags;
0341     u32 portal_size;
0342     phys_addr_t portal_phys_addr;
0343     void __iomem *portal_virt_addr;
0344     struct fsl_mc_device *dpmcp_dev;
0345     union {
0346         /*
0347          * This field is only meaningful if the
0348          * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is not set
0349          */
0350         struct mutex mutex; /* serializes mc_send_command() */
0351 
0352         /*
0353          * This field is only meaningful if the
0354          * FSL_MC_IO_ATOMIC_CONTEXT_PORTAL flag is set
0355          */
0356         raw_spinlock_t spinlock; /* serializes mc_send_command() */
0357     };
0358 };
0359 
0360 int mc_send_command(struct fsl_mc_io *mc_io, struct fsl_mc_command *cmd);
0361 
0362 #ifdef CONFIG_FSL_MC_BUS
0363 #define dev_is_fsl_mc(_dev) ((_dev)->bus == &fsl_mc_bus_type)
0364 #else
0365 /* If fsl-mc bus is not present device cannot belong to fsl-mc bus */
0366 #define dev_is_fsl_mc(_dev) (0)
0367 #endif
0368 
0369 /* Macro to check if a device is a container device */
0370 #define fsl_mc_is_cont_dev(_dev) (to_fsl_mc_device(_dev)->flags & \
0371     FSL_MC_IS_DPRC)
0372 
0373 /* Macro to get the container device of a MC device */
0374 #define fsl_mc_cont_dev(_dev) (fsl_mc_is_cont_dev(_dev) ? \
0375     (_dev) : (_dev)->parent)
0376 
0377 /*
0378  * module_fsl_mc_driver() - Helper macro for drivers that don't do
0379  * anything special in module init/exit.  This eliminates a lot of
0380  * boilerplate.  Each module may only use this macro once, and
0381  * calling it replaces module_init() and module_exit()
0382  */
0383 #define module_fsl_mc_driver(__fsl_mc_driver) \
0384     module_driver(__fsl_mc_driver, fsl_mc_driver_register, \
0385               fsl_mc_driver_unregister)
0386 
0387 /*
0388  * Macro to avoid include chaining to get THIS_MODULE
0389  */
0390 #define fsl_mc_driver_register(drv) \
0391     __fsl_mc_driver_register(drv, THIS_MODULE)
0392 
0393 int __must_check __fsl_mc_driver_register(struct fsl_mc_driver *fsl_mc_driver,
0394                       struct module *owner);
0395 
0396 void fsl_mc_driver_unregister(struct fsl_mc_driver *driver);
0397 
0398 /**
0399  * struct fsl_mc_version
0400  * @major: Major version number: incremented on API compatibility changes
0401  * @minor: Minor version number: incremented on API additions (that are
0402  *      backward compatible); reset when major version is incremented
0403  * @revision: Internal revision number: incremented on implementation changes
0404  *      and/or bug fixes that have no impact on API
0405  */
0406 struct fsl_mc_version {
0407     u32 major;
0408     u32 minor;
0409     u32 revision;
0410 };
0411 
0412 struct fsl_mc_version *fsl_mc_get_version(void);
0413 
0414 int __must_check fsl_mc_portal_allocate(struct fsl_mc_device *mc_dev,
0415                     u16 mc_io_flags,
0416                     struct fsl_mc_io **new_mc_io);
0417 
0418 void fsl_mc_portal_free(struct fsl_mc_io *mc_io);
0419 
0420 int fsl_mc_portal_reset(struct fsl_mc_io *mc_io);
0421 
0422 int __must_check fsl_mc_object_allocate(struct fsl_mc_device *mc_dev,
0423                     enum fsl_mc_pool_type pool_type,
0424                     struct fsl_mc_device **new_mc_adev);
0425 
0426 void fsl_mc_object_free(struct fsl_mc_device *mc_adev);
0427 
0428 struct irq_domain *fsl_mc_msi_create_irq_domain(struct fwnode_handle *fwnode,
0429                         struct msi_domain_info *info,
0430                         struct irq_domain *parent);
0431 
0432 int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev);
0433 
0434 void fsl_mc_free_irqs(struct fsl_mc_device *mc_dev);
0435 
0436 struct fsl_mc_device *fsl_mc_get_endpoint(struct fsl_mc_device *mc_dev,
0437                       u16 if_id);
0438 
0439 extern struct bus_type fsl_mc_bus_type;
0440 
0441 extern struct device_type fsl_mc_bus_dprc_type;
0442 extern struct device_type fsl_mc_bus_dpni_type;
0443 extern struct device_type fsl_mc_bus_dpio_type;
0444 extern struct device_type fsl_mc_bus_dpsw_type;
0445 extern struct device_type fsl_mc_bus_dpbp_type;
0446 extern struct device_type fsl_mc_bus_dpcon_type;
0447 extern struct device_type fsl_mc_bus_dpmcp_type;
0448 extern struct device_type fsl_mc_bus_dpmac_type;
0449 extern struct device_type fsl_mc_bus_dprtc_type;
0450 extern struct device_type fsl_mc_bus_dpseci_type;
0451 extern struct device_type fsl_mc_bus_dpdmux_type;
0452 extern struct device_type fsl_mc_bus_dpdcei_type;
0453 extern struct device_type fsl_mc_bus_dpaiop_type;
0454 extern struct device_type fsl_mc_bus_dpci_type;
0455 extern struct device_type fsl_mc_bus_dpdmai_type;
0456 
0457 static inline bool is_fsl_mc_bus_dprc(const struct fsl_mc_device *mc_dev)
0458 {
0459     return mc_dev->dev.type == &fsl_mc_bus_dprc_type;
0460 }
0461 
0462 static inline bool is_fsl_mc_bus_dpni(const struct fsl_mc_device *mc_dev)
0463 {
0464     return mc_dev->dev.type == &fsl_mc_bus_dpni_type;
0465 }
0466 
0467 static inline bool is_fsl_mc_bus_dpio(const struct fsl_mc_device *mc_dev)
0468 {
0469     return mc_dev->dev.type == &fsl_mc_bus_dpio_type;
0470 }
0471 
0472 static inline bool is_fsl_mc_bus_dpsw(const struct fsl_mc_device *mc_dev)
0473 {
0474     return mc_dev->dev.type == &fsl_mc_bus_dpsw_type;
0475 }
0476 
0477 static inline bool is_fsl_mc_bus_dpdmux(const struct fsl_mc_device *mc_dev)
0478 {
0479     return mc_dev->dev.type == &fsl_mc_bus_dpdmux_type;
0480 }
0481 
0482 static inline bool is_fsl_mc_bus_dpbp(const struct fsl_mc_device *mc_dev)
0483 {
0484     return mc_dev->dev.type == &fsl_mc_bus_dpbp_type;
0485 }
0486 
0487 static inline bool is_fsl_mc_bus_dpcon(const struct fsl_mc_device *mc_dev)
0488 {
0489     return mc_dev->dev.type == &fsl_mc_bus_dpcon_type;
0490 }
0491 
0492 static inline bool is_fsl_mc_bus_dpmcp(const struct fsl_mc_device *mc_dev)
0493 {
0494     return mc_dev->dev.type == &fsl_mc_bus_dpmcp_type;
0495 }
0496 
0497 static inline bool is_fsl_mc_bus_dpmac(const struct fsl_mc_device *mc_dev)
0498 {
0499     return mc_dev->dev.type == &fsl_mc_bus_dpmac_type;
0500 }
0501 
0502 static inline bool is_fsl_mc_bus_dprtc(const struct fsl_mc_device *mc_dev)
0503 {
0504     return mc_dev->dev.type == &fsl_mc_bus_dprtc_type;
0505 }
0506 
0507 static inline bool is_fsl_mc_bus_dpseci(const struct fsl_mc_device *mc_dev)
0508 {
0509     return mc_dev->dev.type == &fsl_mc_bus_dpseci_type;
0510 }
0511 
0512 static inline bool is_fsl_mc_bus_dpdcei(const struct fsl_mc_device *mc_dev)
0513 {
0514     return mc_dev->dev.type == &fsl_mc_bus_dpdcei_type;
0515 }
0516 
0517 static inline bool is_fsl_mc_bus_dpaiop(const struct fsl_mc_device *mc_dev)
0518 {
0519     return mc_dev->dev.type == &fsl_mc_bus_dpaiop_type;
0520 }
0521 
0522 static inline bool is_fsl_mc_bus_dpci(const struct fsl_mc_device *mc_dev)
0523 {
0524     return mc_dev->dev.type == &fsl_mc_bus_dpci_type;
0525 }
0526 
0527 static inline bool is_fsl_mc_bus_dpdmai(const struct fsl_mc_device *mc_dev)
0528 {
0529     return mc_dev->dev.type == &fsl_mc_bus_dpdmai_type;
0530 }
0531 
0532 #define DPRC_RESET_OPTION_NON_RECURSIVE                0x00000001
0533 int dprc_reset_container(struct fsl_mc_io *mc_io,
0534              u32 cmd_flags,
0535              u16 token,
0536              int child_container_id,
0537              u32 options);
0538 
0539 int dprc_scan_container(struct fsl_mc_device *mc_bus_dev,
0540             bool alloc_interrupts);
0541 
0542 void dprc_remove_devices(struct fsl_mc_device *mc_bus_dev,
0543              struct fsl_mc_obj_desc *obj_desc_array,
0544              int num_child_objects_in_mc);
0545 
0546 int dprc_cleanup(struct fsl_mc_device *mc_dev);
0547 
0548 int dprc_setup(struct fsl_mc_device *mc_dev);
0549 
0550 /**
0551  * Maximum number of total IRQs that can be pre-allocated for an MC bus'
0552  * IRQ pool
0553  */
0554 #define FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS  256
0555 
0556 int fsl_mc_populate_irq_pool(struct fsl_mc_device *mc_bus_dev,
0557                  unsigned int irq_count);
0558 
0559 void fsl_mc_cleanup_irq_pool(struct fsl_mc_device *mc_bus_dev);
0560 
0561 /*
0562  * Data Path Buffer Pool (DPBP) API
0563  * Contains initialization APIs and runtime control APIs for DPBP
0564  */
0565 
0566 int dpbp_open(struct fsl_mc_io *mc_io,
0567           u32 cmd_flags,
0568           int dpbp_id,
0569           u16 *token);
0570 
0571 int dpbp_close(struct fsl_mc_io *mc_io,
0572            u32 cmd_flags,
0573            u16 token);
0574 
0575 int dpbp_enable(struct fsl_mc_io *mc_io,
0576         u32 cmd_flags,
0577         u16 token);
0578 
0579 int dpbp_disable(struct fsl_mc_io *mc_io,
0580          u32 cmd_flags,
0581          u16 token);
0582 
0583 int dpbp_reset(struct fsl_mc_io *mc_io,
0584            u32 cmd_flags,
0585            u16 token);
0586 
0587 /**
0588  * struct dpbp_attr - Structure representing DPBP attributes
0589  * @id:     DPBP object ID
0590  * @bpid:   Hardware buffer pool ID; should be used as an argument in
0591  *      acquire/release operations on buffers
0592  */
0593 struct dpbp_attr {
0594     int id;
0595     u16 bpid;
0596 };
0597 
0598 int dpbp_get_attributes(struct fsl_mc_io *mc_io,
0599             u32 cmd_flags,
0600             u16 token,
0601             struct dpbp_attr *attr);
0602 
0603 /* Data Path Concentrator (DPCON) API
0604  * Contains initialization APIs and runtime control APIs for DPCON
0605  */
0606 
0607 /**
0608  * Use it to disable notifications; see dpcon_set_notification()
0609  */
0610 #define DPCON_INVALID_DPIO_ID       (int)(-1)
0611 
0612 int dpcon_open(struct fsl_mc_io *mc_io,
0613            u32 cmd_flags,
0614            int dpcon_id,
0615            u16 *token);
0616 
0617 int dpcon_close(struct fsl_mc_io *mc_io,
0618         u32 cmd_flags,
0619         u16 token);
0620 
0621 int dpcon_enable(struct fsl_mc_io *mc_io,
0622          u32 cmd_flags,
0623          u16 token);
0624 
0625 int dpcon_disable(struct fsl_mc_io *mc_io,
0626           u32 cmd_flags,
0627           u16 token);
0628 
0629 int dpcon_reset(struct fsl_mc_io *mc_io,
0630         u32 cmd_flags,
0631         u16 token);
0632 
0633 int fsl_mc_obj_open(struct fsl_mc_io *mc_io,
0634             u32 cmd_flags,
0635             int obj_id,
0636             char *obj_type,
0637             u16 *token);
0638 
0639 int fsl_mc_obj_close(struct fsl_mc_io *mc_io,
0640              u32 cmd_flags,
0641              u16 token);
0642 
0643 int fsl_mc_obj_reset(struct fsl_mc_io *mc_io,
0644              u32 cmd_flags,
0645              u16 token);
0646 
0647 /**
0648  * struct dpcon_attr - Structure representing DPCON attributes
0649  * @id: DPCON object ID
0650  * @qbman_ch_id: Channel ID to be used by dequeue operation
0651  * @num_priorities: Number of priorities for the DPCON channel (1-8)
0652  */
0653 struct dpcon_attr {
0654     int id;
0655     u16 qbman_ch_id;
0656     u8 num_priorities;
0657 };
0658 
0659 int dpcon_get_attributes(struct fsl_mc_io *mc_io,
0660              u32 cmd_flags,
0661              u16 token,
0662              struct dpcon_attr *attr);
0663 
0664 /**
0665  * struct dpcon_notification_cfg - Structure representing notification params
0666  * @dpio_id:    DPIO object ID; must be configured with a notification channel;
0667  *  to disable notifications set it to 'DPCON_INVALID_DPIO_ID';
0668  * @priority:   Priority selection within the DPIO channel; valid values
0669  *      are 0-7, depending on the number of priorities in that channel
0670  * @user_ctx:   User context value provided with each CDAN message
0671  */
0672 struct dpcon_notification_cfg {
0673     int dpio_id;
0674     u8 priority;
0675     u64 user_ctx;
0676 };
0677 
0678 int dpcon_set_notification(struct fsl_mc_io *mc_io,
0679                u32 cmd_flags,
0680                u16 token,
0681                struct dpcon_notification_cfg *cfg);
0682 
0683 #endif /* _FSL_MC_H_ */