Skip to content

Commit

Permalink
fpga: dfl: afu: update reset handling of Rev 2 of the Port feature
Browse files Browse the repository at this point in the history
Revision 2 of the Device Feature List (DFL) Port can encompass more
than one PCIe Physical Funtion. As such resetting the port must
be handled differently. Disable actually resetting port for Rev 2
except for the Partial Reconfiguration flow.

Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>
  • Loading branch information
matthew-gerlach authored and fpgamatt committed May 13, 2024
1 parent 7896664 commit 1c82071
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion drivers/fpga/dfl-afu-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,36 @@ static int __port_reset(struct dfl_feature_dev_data *fdata)
return __afu_port_enable(fdata);
}

static u8 get_port_rev(struct dfl_feature_dev_data *fdata)
{
void __iomem *base;

base = dfl_get_feature_ioaddr_by_id(fdata, PORT_FEATURE_ID_HEADER);

if (!base)
return ~0;

return dfl_feature_revision(base);
}

static int port_reset(struct platform_device *pdev)
{
struct dfl_feature_dev_data *fdata;
int ret;
u8 rev;

fdata = to_dfl_feature_dev_data(&pdev->dev);

rev = get_port_rev(fdata);

if (rev == 2)
return 0;

if (rev > 2) {
dev_info(&pdev->dev, "unexpected port feature revision, %u\n", rev);
return 0;
}

mutex_lock(&fdata->lock);
ret = __port_reset(fdata);
mutex_unlock(&fdata->lock);
Expand Down Expand Up @@ -702,7 +725,9 @@ static int afu_release(struct inode *inode, struct file *filp)
dfl_fpga_dev_for_each_feature(fdata, feature)
dfl_fpga_set_irq_triggers(feature, 0,
feature->nr_irqs, NULL);
__port_reset(fdata);
if (get_port_rev(fdata) < 2)
__port_reset(fdata);

afu_dma_region_destroy(fdata);
}
mutex_unlock(&fdata->lock);
Expand Down

0 comments on commit 1c82071

Please sign in to comment.