diff options
author | Wu Hao <hao.wu@intel.com> | 2018-06-30 08:53:26 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-07-15 13:55:46 +0200 |
commit | 5ebae801d960d46e39574cb83ec24ab44d1a6c2a (patch) | |
tree | 738588147e3e82501c52666f2a666c6471c32fef /drivers/fpga | |
parent | af275ec6160ba68714371cfe0575f9aa478ce02f (diff) |
fpga: dfl: fme-mgr: add compat_id support
This patch adds compat_id support to fme manager driver, it
reads the ID from the hardware register. And it could be used
for compatibility check before partial reconfiguration.
Signed-off-by: Wu Hao <hao.wu@intel.com>
Acked-by: Alan Tull <atull@kernel.org>
Acked-by: Moritz Fischer <mdf@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/fpga')
-rw-r--r-- | drivers/fpga/dfl-fme-mgr.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/fpga/dfl-fme-mgr.c b/drivers/fpga/dfl-fme-mgr.c index df843b51c663..b5ef405b6d88 100644 --- a/drivers/fpga/dfl-fme-mgr.c +++ b/drivers/fpga/dfl-fme-mgr.c @@ -272,9 +272,17 @@ static const struct fpga_manager_ops fme_mgr_ops = { .status = fme_mgr_status, }; +static void fme_mgr_get_compat_id(void __iomem *fme_pr, + struct fpga_compat_id *id) +{ + id->id_l = readq(fme_pr + FME_PR_INTFC_ID_L); + id->id_h = readq(fme_pr + FME_PR_INTFC_ID_H); +} + static int fme_mgr_probe(struct platform_device *pdev) { struct dfl_fme_mgr_pdata *pdata = dev_get_platdata(&pdev->dev); + struct fpga_compat_id *compat_id; struct device *dev = &pdev->dev; struct fme_mgr_priv *priv; struct fpga_manager *mgr; @@ -295,11 +303,18 @@ static int fme_mgr_probe(struct platform_device *pdev) return PTR_ERR(priv->ioaddr); } + compat_id = devm_kzalloc(dev, sizeof(*compat_id), GFP_KERNEL); + if (!compat_id) + return -ENOMEM; + + fme_mgr_get_compat_id(priv->ioaddr, compat_id); + mgr = fpga_mgr_create(dev, "DFL FME FPGA Manager", &fme_mgr_ops, priv); if (!mgr) return -ENOMEM; + mgr->compat_id = compat_id; platform_set_drvdata(pdev, mgr); ret = fpga_mgr_register(mgr); |