summaryrefslogtreecommitdiff
path: root/drivers/fpga/dfl-afu-error.c
diff options
context:
space:
mode:
authorRuss Weight <russell.h.weight@intel.com>2021-03-24 01:46:50 +0300
committerMoritz Fischer <mdf@kernel.org>2021-03-24 21:15:04 +0300
commit9a8d3cda8daf54b1f8e67ccb360876379b7e7895 (patch)
tree6b3edaecfaf44801b5bba4e4428b1776ba2bd542 /drivers/fpga/dfl-afu-error.c
parent6f1e376cfc6864a2f46538db909bbd5253c3c146 (diff)
downloadlinux-9a8d3cda8daf54b1f8e67ccb360876379b7e7895.tar.xz
fpga: dfl: afu: harden port enable logic
Port enable is not complete until ACK = 0. Change __afu_port_enable() to guarantee that the enable process is complete by polling for ACK == 0. Signed-off-by: Russ Weight <russell.h.weight@intel.com> Reviewed-by: Tom Rix <trix@redhat.com> Reviewed-by: Matthew Gerlach <matthew.gerlach@linux.intel.com> Acked-by: Wu Hao <hao.wu@intel.com> Signed-off-by: Moritz Fischer <mdf@kernel.org>
Diffstat (limited to 'drivers/fpga/dfl-afu-error.c')
-rw-r--r--drivers/fpga/dfl-afu-error.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/fpga/dfl-afu-error.c b/drivers/fpga/dfl-afu-error.c
index c4691187cca9..ab7be6217368 100644
--- a/drivers/fpga/dfl-afu-error.c
+++ b/drivers/fpga/dfl-afu-error.c
@@ -52,7 +52,7 @@ static int afu_port_err_clear(struct device *dev, u64 err)
struct dfl_feature_platform_data *pdata = dev_get_platdata(dev);
struct platform_device *pdev = to_platform_device(dev);
void __iomem *base_err, *base_hdr;
- int ret = -EBUSY;
+ int enable_ret = 0, ret = -EBUSY;
u64 v;
base_err = dfl_get_feature_ioaddr_by_id(dev, PORT_FEATURE_ID_ERROR);
@@ -96,18 +96,20 @@ static int afu_port_err_clear(struct device *dev, u64 err)
v = readq(base_err + PORT_FIRST_ERROR);
writeq(v, base_err + PORT_FIRST_ERROR);
} else {
+ dev_warn(dev, "%s: received 0x%llx, expected 0x%llx\n",
+ __func__, v, err);
ret = -EINVAL;
}
/* Clear mask */
__afu_port_err_mask(dev, false);
- /* Enable the Port by clear the reset */
- __afu_port_enable(pdev);
+ /* Enable the Port by clearing the reset */
+ enable_ret = __afu_port_enable(pdev);
done:
mutex_unlock(&pdata->lock);
- return ret;
+ return enable_ret ? enable_ret : ret;
}
static ssize_t errors_show(struct device *dev, struct device_attribute *attr,