Merge tag 'memory-controller-drv-tegra-5.13' of git://git.kernel.org/pub/scm/linux...
[linux-2.6-microblaze.git] / drivers / fpga / dfl-afu-main.c
index 3fa2c59..753cda4 100644 (file)
@@ -530,6 +530,30 @@ static const struct dfl_feature_ops port_stp_ops = {
        .init = port_stp_init,
 };
 
+static long
+port_uint_ioctl(struct platform_device *pdev, struct dfl_feature *feature,
+               unsigned int cmd, unsigned long arg)
+{
+       switch (cmd) {
+       case DFL_FPGA_PORT_UINT_GET_IRQ_NUM:
+               return dfl_feature_ioctl_get_num_irqs(pdev, feature, arg);
+       case DFL_FPGA_PORT_UINT_SET_IRQ:
+               return dfl_feature_ioctl_set_irq(pdev, feature, arg);
+       default:
+               dev_dbg(&pdev->dev, "%x cmd not handled", cmd);
+               return -ENODEV;
+       }
+}
+
+static const struct dfl_feature_id port_uint_id_table[] = {
+       {.id = PORT_FEATURE_ID_UINT,},
+       {0,}
+};
+
+static const struct dfl_feature_ops port_uint_ops = {
+       .ioctl = port_uint_ioctl,
+};
+
 static struct dfl_feature_driver port_feature_drvs[] = {
        {
                .id_table = port_hdr_id_table,
@@ -547,6 +571,10 @@ static struct dfl_feature_driver port_feature_drvs[] = {
                .id_table = port_stp_id_table,
                .ops = &port_stp_ops,
        },
+       {
+               .id_table = port_uint_id_table,
+               .ops = &port_uint_ops,
+       },
        {
                .ops = NULL,
        }
@@ -578,6 +606,7 @@ static int afu_release(struct inode *inode, struct file *filp)
 {
        struct platform_device *pdev = filp->private_data;
        struct dfl_feature_platform_data *pdata;
+       struct dfl_feature *feature;
 
        dev_dbg(&pdev->dev, "Device File Release\n");
 
@@ -587,6 +616,9 @@ static int afu_release(struct inode *inode, struct file *filp)
        dfl_feature_dev_use_end(pdata);
 
        if (!dfl_feature_dev_use_count(pdata)) {
+               dfl_fpga_dev_for_each_feature(pdata, feature)
+                       dfl_fpga_set_irq_triggers(feature, 0,
+                                                 feature->nr_irqs, NULL);
                __port_reset(pdev);
                afu_dma_region_destroy(pdata);
        }