Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1606004 > unrolled thread

Re: [PATCH v5 2/4] fpga pr ip: Core driver support for Altera Partial Reconfiguration IP.

Started byAnatolij Gustschin <agust@denx.de>
First post2017-03-21 22:20 +0100
Last post2017-03-22 17:50 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v5 2/4] fpga pr ip: Core driver support for Altera  Partial Reconfiguration IP. Anatolij Gustschin <agust@denx.de> - 2017-03-21 22:20 +0100
    Re: [PATCH v5 2/4] fpga pr ip: Core driver support for Altera Partial  Reconfiguration IP. matthew.gerlach@linux.intel.com - 2017-03-22 17:10 +0100
      Re: [PATCH v5 2/4] fpga pr ip: Core driver support for Altera  Partial Reconfiguration IP. Anatolij Gustschin <agust@denx.de> - 2017-03-22 17:50 +0100

#1606004 — Re: [PATCH v5 2/4] fpga pr ip: Core driver support for Altera Partial Reconfiguration IP.

FromAnatolij Gustschin <agust@denx.de>
Date2017-03-21 22:20 +0100
SubjectRe: [PATCH v5 2/4] fpga pr ip: Core driver support for Altera Partial Reconfiguration IP.
Message-ID<tnzma-yy-17@gated-at.bofh.it>
Hi Matthew,

On Fri, 10 Mar 2017 11:40:25 -0800
matthew.gerlach@linux.intel.com matthew.gerlach@linux.intel.com wrote:
...
>+int alt_pr_unregister(struct device *dev)
>+{
>+	dev_dbg(dev, "%s\n", __func__);
>+
>+	fpga_mgr_unregister(dev);
>+
>+	return 0;
>+}
>+EXPORT_SYMBOL_GPL(alt_pr_unregister);

Can we also add a function for registering a PCIe device with
PR IP here? Something like:

/**
 * 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]);
        if (IS_ERR(base)) {
                dev_warn(&pdev->dev, "mapping PR-IP BAR failed\n");
                return -ENOMEM;
        }

        return alt_pr_register(&pdev->dev, base + pr_offset);
}
EXPORT_SYMBOL_GPL(alt_pr_pcie_register);

Thanks,
Anatolij

[toc] | [next] | [standalone]


#1606710 — Re: [PATCH v5 2/4] fpga pr ip: Core driver support for Altera Partial Reconfiguration IP.

Frommatthew.gerlach@linux.intel.com
Date2017-03-22 17:10 +0100
SubjectRe: [PATCH v5 2/4] fpga pr ip: Core driver support for Altera Partial Reconfiguration IP.
Message-ID<tnQZJ-586-41@gated-at.bofh.it>
In reply to#1606004

On Tue, 21 Mar 2017, Anatolij Gustschin wrote:

> Hi Matthew,

Hi Anatolij,

>
> On Fri, 10 Mar 2017 11:40:25 -0800
> matthew.gerlach@linux.intel.com matthew.gerlach@linux.intel.com wrote:
> ...
>> +int alt_pr_unregister(struct device *dev)
>> +{
>> +	dev_dbg(dev, "%s\n", __func__);
>> +
>> +	fpga_mgr_unregister(dev);
>> +
>> +	return 0;
>> +}
>> +EXPORT_SYMBOL_GPL(alt_pr_unregister);
>
> 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().

>
> /**
> * 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?


>        if (IS_ERR(base)) {
>                dev_warn(&pdev->dev, "mapping PR-IP BAR failed\n");
>                return -ENOMEM;
>        }
>
>        return alt_pr_register(&pdev->dev, base + pr_offset);
> }
> EXPORT_SYMBOL_GPL(alt_pr_pcie_register);
>
> Thanks,
> Anatolij
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fpga" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

[toc] | [prev] | [next] | [standalone]


#1606737

FromAnatolij Gustschin <agust@denx.de>
Date2017-03-22 17:50 +0100
Message-ID<tnRCq-5tR-5@gated-at.bofh.it>
In reply to#1606710
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web