Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935419AbdCVQk6 (ORCPT ); Wed, 22 Mar 2017 12:40:58 -0400 Received: from mail-out.m-online.net ([212.18.0.9]:57129 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935373AbdCVQkp (ORCPT ); Wed, 22 Mar 2017 12:40:45 -0400 X-Auth-Info: Se5y2OavPjm6qFnkkX3FUixOty2X5g+0nCfr1r1RABw= Date: Wed, 22 Mar 2017 17:39:16 +0100 From: Anatolij Gustschin To: matthew.gerlach@linux.intel.com Cc: atull@kernel.org, moritz.fischer@ettus.com, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, robh+dt@kernel.org, mark.rutland@arm.com Subject: Re: [PATCH v5 2/4] fpga pr ip: Core driver support for Altera Partial Reconfiguration IP. Message-ID: <20170322173916.6c55b259@crub> In-Reply-To: References: <1489174827-6033-1-git-send-email-matthew.gerlach@linux.intel.com> <1489174827-6033-3-git-send-email-matthew.gerlach@linux.intel.com> <20170321220437.1fa7efaa@crub> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1695 Lines: 49 Hi Matthew, On Wed, 22 Mar 2017 09:08:18 -0700 (PDT) matthew.gerlach@linux.intel.com matthew.gerlach@linux.intel.com wrote: ... >> Can we also add a function for registering a PCIe device with >> PR IP here? Something like: > >If we have an alt_pr_pcie_register function, we will need the >corresponding alt_pr_pcie_unregister function. Both of these functions >should go into their own file like alt_pr_platform_probe() and >alt_pr_platform_remove(). Okay, thanks. >> /** >> * alt_pr_pcie_register - register PCIe device with PR-IP core >> * @pci_dev: PCI device with PR-IP >> * @bar: PR-IP BAR number >> * @pr_offset: offset of the PR-IP core registers >> * >> * Return: 0 on success, negative error code otherwise. >> * >> * To unregister the PCIe device, use alt_pr_unregister(&pdev->dev). >> */ >> int alt_pr_pcie_register(struct pci_dev *pdev, int bar, int pr_offset) >> { >> void __iomem *base; >> int ret; >> >> if (!pci_is_enabled(pdev)) { >> ret = pci_enable_device(pdev); >> if (ret < 0) { >> dev_err(&pdev->dev, "can't enable device: %d\n", ret); >> return ret; >> } >> } >> >> base = devm_ioremap_resource(&pdev->dev, &pdev->resource[bar]); > >Does this remap the whole bar? If it does, what happens if other >components are also connected to the bar? How do those corresponding >drivers get access to the mapped memory? yes, it remaps the whole bar. I do not know the details of the PR IP, my assumption was that PR IP it is only one component in the bar. Then I could use devm_ioremap() instead. Thanks for the hint! Anatolij