Skip to content

Commit 68f6053

Browse files
syn1588gregkh
authored andcommitted
fpga: altera-cvp: Fix registration for CvP incapable devices
The probe function needs to verify the CvP enable bit in order to properly determine if FPGA Manager functionality can be safely enabled. Fixes: 34d1dc1 ("fpga manager: Add Altera CvP driver") Signed-off-by: Andreas Puhm <puhm@oregano.at> Signed-off-by: Anatolij Gustschin <agust@denx.de> Reviewed-by: Moritz Fischer <mdf@kernel.org> Acked-by: Alan Tull <atull@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ae66864 commit 68f6053

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎drivers/fpga/altera-cvp.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ static int altera_cvp_probe(struct pci_dev *pdev,
403403
struct altera_cvp_conf *conf;
404404
struct fpga_manager *mgr;
405405
u16 cmd, val;
406+
u32 regval;
406407
int ret;
407408

408409
/*
@@ -416,6 +417,14 @@ static int altera_cvp_probe(struct pci_dev *pdev,
416417
return -ENODEV;
417418
}
418419

420+
pci_read_config_dword(pdev, VSE_CVP_STATUS, &regval);
421+
if (!(regval & VSE_CVP_STATUS_CVP_EN)) {
422+
dev_err(&pdev->dev,
423+
"CVP is disabled for this device: CVP_STATUS Reg 0x%x\n",
424+
regval);
425+
return -ENODEV;
426+
}
427+
419428
conf = devm_kzalloc(&pdev->dev, sizeof(*conf), GFP_KERNEL);
420429
if (!conf)
421430
return -ENOMEM;

0 commit comments

Comments
 (0)