Skip to content

Commit 5ebae80

Browse files
WuHao270gregkh
authored andcommitted
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 <[email protected]> Acked-by: Alan Tull <[email protected]> Acked-by: Moritz Fischer <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent af275ec commit 5ebae80

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

drivers/fpga/dfl-fme-mgr.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,17 @@ static const struct fpga_manager_ops fme_mgr_ops = {
272272
.status = fme_mgr_status,
273273
};
274274

275+
static void fme_mgr_get_compat_id(void __iomem *fme_pr,
276+
struct fpga_compat_id *id)
277+
{
278+
id->id_l = readq(fme_pr + FME_PR_INTFC_ID_L);
279+
id->id_h = readq(fme_pr + FME_PR_INTFC_ID_H);
280+
}
281+
275282
static int fme_mgr_probe(struct platform_device *pdev)
276283
{
277284
struct dfl_fme_mgr_pdata *pdata = dev_get_platdata(&pdev->dev);
285+
struct fpga_compat_id *compat_id;
278286
struct device *dev = &pdev->dev;
279287
struct fme_mgr_priv *priv;
280288
struct fpga_manager *mgr;
@@ -295,11 +303,18 @@ static int fme_mgr_probe(struct platform_device *pdev)
295303
return PTR_ERR(priv->ioaddr);
296304
}
297305

306+
compat_id = devm_kzalloc(dev, sizeof(*compat_id), GFP_KERNEL);
307+
if (!compat_id)
308+
return -ENOMEM;
309+
310+
fme_mgr_get_compat_id(priv->ioaddr, compat_id);
311+
298312
mgr = fpga_mgr_create(dev, "DFL FME FPGA Manager",
299313
&fme_mgr_ops, priv);
300314
if (!mgr)
301315
return -ENOMEM;
302316

317+
mgr->compat_id = compat_id;
303318
platform_set_drvdata(pdev, mgr);
304319

305320
ret = fpga_mgr_register(mgr);

0 commit comments

Comments
 (0)