diff options
Diffstat (limited to 'drivers/staging/fsl_qbman/fsl_usdpaa.c')
-rw-r--r-- | drivers/staging/fsl_qbman/fsl_usdpaa.c | 56 |
1 files changed, 17 insertions, 39 deletions
diff --git a/drivers/staging/fsl_qbman/fsl_usdpaa.c b/drivers/staging/fsl_qbman/fsl_usdpaa.c index 9dc63a2..33b1923 100644 --- a/drivers/staging/fsl_qbman/fsl_usdpaa.c +++ b/drivers/staging/fsl_qbman/fsl_usdpaa.c @@ -321,7 +321,6 @@ static int usdpaa_open(struct inode *inode, struct file *filp) return 0; } - #define DQRR_MAXFILL 15 /* Reset a QMan portal to its default state */ @@ -435,7 +434,6 @@ static int qm_check_and_destroy_fqs(struct qm_portal *portal, void *ctx, ++fq_id; } return 0; - } static bool check_channel_device(void *_ctx, u32 channel) @@ -1368,13 +1366,13 @@ static long usdpaa_ioctl(struct file *fp, unsigned int cmd, unsigned long arg) return -EINVAL; } - - static long usdpaa_ioctl_compat(struct file *fp, unsigned int cmd, unsigned long arg) { +#ifdef CONFIG_COMPAT struct ctx *ctx = fp->private_data; void __user *a = (void __user *)arg; +#endif switch (cmd) { #ifdef CONFIG_COMPAT case USDPAA_IOCTL_DMA_MAP_COMPAT: @@ -1441,56 +1439,36 @@ static long usdpaa_ioctl_compat(struct file *fp, unsigned int cmd, return -EINVAL; } -struct qm_portal_config *usdpaa_get_qm_portal_config(struct file *filp, - void *hint) -{ - /* Walk the list of portals for filp and return the config - for the portal that matches the hint */ - - struct ctx *context; - struct portal_mapping *portal; - - /* First sanitize the filp */ - if (filp->f_op->open != usdpaa_open) - return NULL; - context = filp->private_data; - spin_lock(&context->lock); - list_for_each_entry(portal, &context->portals, list) { - if (portal->user.type == usdpaa_portal_qman && - portal->user.addr.cinh == hint) { - spin_unlock(&context->lock); - return portal->qportal; - } - } - spin_unlock(&context->lock); - return NULL; -} - -struct bm_portal_config *usdpaa_get_bm_portal_config(struct file *filp, - void *hint) +int usdpaa_get_portal_config(struct file *filp, void *cinh, + enum usdpaa_portal_type ptype, unsigned int *irq, + void **iir_reg) { /* Walk the list of portals for filp and return the config for the portal that matches the hint */ - struct ctx *context; struct portal_mapping *portal; /* First sanitize the filp */ if (filp->f_op->open != usdpaa_open) - return NULL; - + return -ENODEV; context = filp->private_data; - spin_lock(&context->lock); list_for_each_entry(portal, &context->portals, list) { - if (portal->user.type == usdpaa_portal_bman && - portal->user.addr.cinh == hint) { + if (portal->user.type == ptype && + portal->user.addr.cinh == cinh) { + if (ptype == usdpaa_portal_qman) { + *irq = portal->qportal->public_cfg.irq; + *iir_reg = portal->qportal->addr_virt[1] + QM_REG_IIR; + } else { + *irq = portal->bportal->public_cfg.irq; + *iir_reg = portal->bportal->addr_virt[1] + BM_REG_IIR; + } spin_unlock(&context->lock); - return portal->bportal; + return 0; } } spin_unlock(&context->lock); - return NULL; + return -EINVAL; } static const struct file_operations usdpaa_fops = { |