From patchwork Tue Oct 23 09:01:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Puhm X-Patchwork-Id: 10652821 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0EA3613BF for ; Tue, 23 Oct 2018 09:01:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EABEC2932C for ; Tue, 23 Oct 2018 09:01:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE94429341; Tue, 23 Oct 2018 09:01:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A1D02932C for ; Tue, 23 Oct 2018 09:01:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728444AbeJWRYO (ORCPT ); Tue, 23 Oct 2018 13:24:14 -0400 Received: from mx02.busymouse24.de ([83.246.107.20]:44812 "EHLO mx02.busymouse24.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727978AbeJWRYN (ORCPT ); Tue, 23 Oct 2018 13:24:13 -0400 Received: from maskedhost [127.0.0.1] by mx02.busymouse24.de stage1 with esmtps (Exim MailCleaner) id 1gEsZL-0004E2-Pm from ; Tue, 23 Oct 2018 11:01:43 +0200 Received: from SRV188.busymouse24.de (192.168.100.188) by SRV177.busymouse24.de (192.168.100.177) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 23 Oct 2018 11:01:41 +0200 Received: from SRV177.busymouse24.de (192.168.100.177) by SRV188.busymouse24.de (192.168.100.188) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 23 Oct 2018 11:01:41 +0200 Received: from SRV177.busymouse24.de ([fe80::f87a:2c8c:90ef:d29a]) by SRV177.busymouse24.de ([fe80::f87a:2c8c:90ef:d29a%14]) with mapi id 15.00.1263.000; Tue, 23 Oct 2018 11:01:40 +0200 From: Andreas Puhm To: "mdf@kernel.org" CC: "atull@kernel.org" , "linux-fpga@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: [PATCH] fpga: altera-cvp: Fix registration for CvP incapable devices Thread-Topic: [PATCH] fpga: altera-cvp: Fix registration for CvP incapable devices Thread-Index: AdRqrwHSczNMez1jQOOfVT8pKpEdMQ== Date: Tue, 23 Oct 2018 09:01:39 +0000 Message-ID: <9b53d15391054a598ec3a32cee540798@SRV177.busymouse24.de> Accept-Language: de-AT, de-DE, en-US Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: <9b53d15391054a598ec3a32cee540798@SRV177.busymouse24.de> x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [83.246.107.135] x-exclaimer-md-config: 1802f3fe-bc94-4301-9dc2-d59a74e6de3a MIME-Version: 1.0 Sender: linux-fpga-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fpga@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From bfc602900b016f65bc2f183aa93702101a1fdc17 Mon Sep 17 00:00:00 2001 From: Andreas Puhm Date: Tue, 23 Oct 2018 10:24:10 +0200 Subject: [PATCH] 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 34d1dc17ce978ae76e676d401b48fe9d004aa948 ("fpga manager: Add Altera CvP driver") Signed-off-by: Andreas Puhm --- drivers/fpga/altera-cvp.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c index 7fa793672a7a..ece344a56075 100644 --- a/drivers/fpga/altera-cvp.c +++ b/drivers/fpga/altera-cvp.c @@ -403,6 +403,7 @@ static int altera_cvp_probe(struct pci_dev *pdev, struct altera_cvp_conf *conf; struct fpga_manager *mgr; u16 cmd, val; + u32 regval; int ret; /* @@ -416,6 +417,14 @@ static int altera_cvp_probe(struct pci_dev *pdev, return -ENODEV; } + pci_read_config_dword(pdev, VSE_CVP_STATUS, ®val); + if (!(regval & VSE_CVP_STATUS_CVP_EN)) { + dev_err(&pdev->dev, + "CVP is disabled for this device: CVP_STATUS Reg 0x%x\n", + regval); + return -ENODEV; + } + conf = devm_kzalloc(&pdev->dev, sizeof(*conf), GFP_KERNEL); if (!conf) return -ENOMEM;