diff mbox

[v5,1/1] PCI: kirin: Add MSI support

Message ID 20180628124803.110315-2-songxiaowei@hisilicon.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Song Xiaowei June 28, 2018, 12:48 p.m. UTC
Add support for MSI.

Signed-off-by: Xiaowei Song <songxiaowei@hisilicon.com>
---
 drivers/pci/dwc/pcie-kirin.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

Comments

Song Xiaowei July 9, 2018, 1:54 a.m. UTC | #1
Hi Bjorn Helgaas,

Would you help to review this patch?

Best regards,

Xiaowei.

> -----邮件原件-----

> 发件人: Songxiaowei (Kirin_DRV)

> 发送时间: 2018年6月28日 20:48

> 收件人: Wangbinghui <wangbinghui@hisilicon.com>; bhelgaas@google.com;

> robh+dt@kernel.org; linux-pci@vger.kernel.org; linux-kernel@vger.kernel.org;

> dimitrysh@google.com

> 抄送: chenyao (F) <chenyao11@huawei.com>; Songxiaowei (Kirin_DRV)

> <songxiaowei@hisilicon.com>

> 主题: [PATCH v5 1/1] PCI: kirin: Add MSI support

> 

> Add support for MSI.

> 

> Signed-off-by: Xiaowei Song <songxiaowei@hisilicon.com>

> ---

>  drivers/pci/dwc/pcie-kirin.c | 28 ++++++++++++++++++++++++++++

>  1 file changed, 28 insertions(+)

> 

> diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c index

> d2970a009eb5..6997276eb69c 100644

> --- a/drivers/pci/dwc/pcie-kirin.c

> +++ b/drivers/pci/dwc/pcie-kirin.c

> @@ -430,6 +430,9 @@ static int kirin_pcie_host_init(struct pcie_port *pp)

> {

>  	kirin_pcie_establish_link(pp);

> 

> +	if (IS_ENABLED(CONFIG_PCI_MSI))

> +		dw_pcie_msi_init(pp);

> +

>  	return 0;

>  }

> 

> @@ -445,9 +448,34 @@ static const struct dw_pcie_host_ops

> kirin_pcie_host_ops = {

>  	.host_init = kirin_pcie_host_init,

>  };

> 

> +static int kirin_pcie_add_msi(struct dw_pcie *pci,

> +				struct platform_device *pdev)

> +{

> +	int ret = 0;

> +

> +	if (IS_ENABLED(CONFIG_PCI_MSI)) {

> +		ret = platform_get_irq(pdev, 0);

> +		if (ret < 0) {

> +			dev_err(&pdev->dev,

> +				"failed to get MSI IRQ (%d)\n", ret);

> +			return ret;

> +		}

> +

> +		pci->pp.msi_irq = ret;

> +	}

> +

> +	return ret;

> +}

> +

>  static int __init kirin_add_pcie_port(struct dw_pcie *pci,

>  				      struct platform_device *pdev)  {

> +	int ret;

> +

> +	ret = kirin_pcie_add_msi(pci, pdev);

> +	if (ret)

> +		return ret;

> +

>  	pci->pp.ops = &kirin_pcie_host_ops;

> 

>  	return dw_pcie_host_init(&pci->pp);

> --

> 2.11.GIT
Lorenzo Pieralisi July 10, 2018, 3:40 p.m. UTC | #2
On Mon, Jul 09, 2018 at 01:54:07AM +0000, Songxiaowei (Kirin_DRV) wrote:
> Hi Bjorn Helgaas,
> 
> Would you help to review this patch?
> 
> Best regards,
> 
> Xiaowei.
> 
> > -----邮件原件-----
> > 发件人: Songxiaowei (Kirin_DRV)
> > 发送时间: 2018年6月28日 20:48
> > 收件人: Wangbinghui <wangbinghui@hisilicon.com>; bhelgaas@google.com;
> > robh+dt@kernel.org; linux-pci@vger.kernel.org; linux-kernel@vger.kernel.org;
> > dimitrysh@google.com
> > 抄送: chenyao (F) <chenyao11@huawei.com>; Songxiaowei (Kirin_DRV)
> > <songxiaowei@hisilicon.com>
> > 主题: [PATCH v5 1/1] PCI: kirin: Add MSI support
> > 
> > Add support for MSI.
> > 
> > Signed-off-by: Xiaowei Song <songxiaowei@hisilicon.com>
> > ---
> >  drivers/pci/dwc/pcie-kirin.c | 28 ++++++++++++++++++++++++++++
> >  1 file changed, 28 insertions(+)
> > 
> > diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c index
> > d2970a009eb5..6997276eb69c 100644
> > --- a/drivers/pci/dwc/pcie-kirin.c
> > +++ b/drivers/pci/dwc/pcie-kirin.c
> > @@ -430,6 +430,9 @@ static int kirin_pcie_host_init(struct pcie_port *pp)
> > {
> >  	kirin_pcie_establish_link(pp);
> > 
> > +	if (IS_ENABLED(CONFIG_PCI_MSI))
> > +		dw_pcie_msi_init(pp);
> > +
> >  	return 0;
> >  }
> > 
> > @@ -445,9 +448,34 @@ static const struct dw_pcie_host_ops
> > kirin_pcie_host_ops = {
> >  	.host_init = kirin_pcie_host_init,
> >  };
> > 
> > +static int kirin_pcie_add_msi(struct dw_pcie *pci,
> > +				struct platform_device *pdev)
> > +{
> > +	int ret = 0;
> > +
> > +	if (IS_ENABLED(CONFIG_PCI_MSI)) {
> > +		ret = platform_get_irq(pdev, 0);
> > +		if (ret < 0) {
> > +			dev_err(&pdev->dev,
> > +				"failed to get MSI IRQ (%d)\n", ret);
> > +			return ret;
> > +		}
> > +
> > +		pci->pp.msi_irq = ret;
> > +	}
> > +
> > +	return ret;
> > +}
> > +
> >  static int __init kirin_add_pcie_port(struct dw_pcie *pci,
> >  				      struct platform_device *pdev)  {
> > +	int ret;
> > +
> > +	ret = kirin_pcie_add_msi(pci, pdev);
> > +	if (ret)
> > +		return ret;

If kirin_pcie_add_msi() returns an IRQ number we return from
this function here, is that what you really want ?

Lorenzo

> > +
> >  	pci->pp.ops = &kirin_pcie_host_ops;
> > 
> >  	return dw_pcie_host_init(&pci->pp);
> > --
> > 2.11.GIT
>
Song Xiaowei July 11, 2018, 2:22 a.m. UTC | #3
> -----邮件原件-----

> 发件人: Lorenzo Pieralisi [mailto:lorenzo.pieralisi@arm.com]

> 发送时间: 2018年7月10日 23:40

> 收件人: Songxiaowei (Kirin_DRV) <songxiaowei@hisilicon.com>

> 抄送: bhelgaas@google.com; robh+dt@kernel.org; linux-pci@vger.kernel.org;

> linux-kernel@vger.kernel.org; chenyao (F) <chenyao11@huawei.com>

> 主题: Re: 答复: [PATCH v5 1/1] PCI: kirin: Add MSI support

> 

> On Mon, Jul 09, 2018 at 01:54:07AM +0000, Songxiaowei (Kirin_DRV) wrote:

> > Hi Bjorn Helgaas,

> >

> > Would you help to review this patch?

> >

> > Best regards,

> >

> > Xiaowei.

> >

> > > -----邮件原件-----

> > > 发件人: Songxiaowei (Kirin_DRV)

> > > 发送时间: 2018年6月28日 20:48

> > > 收件人: Wangbinghui <wangbinghui@hisilicon.com>;

> bhelgaas@google.com;

> > > robh+dt@kernel.org; linux-pci@vger.kernel.org;

> > > robh+linux-kernel@vger.kernel.org;

> > > dimitrysh@google.com

> > > 抄送: chenyao (F) <chenyao11@huawei.com>; Songxiaowei (Kirin_DRV)

> > > <songxiaowei@hisilicon.com>

> > > 主题: [PATCH v5 1/1] PCI: kirin: Add MSI support

> > >

> > > Add support for MSI.

> > >

> > > Signed-off-by: Xiaowei Song <songxiaowei@hisilicon.com>

> > > ---

> > >  drivers/pci/dwc/pcie-kirin.c | 28 ++++++++++++++++++++++++++++

> > >  1 file changed, 28 insertions(+)

> > >

> > > diff --git a/drivers/pci/dwc/pcie-kirin.c

> > > b/drivers/pci/dwc/pcie-kirin.c index d2970a009eb5..6997276eb69c

> > > 100644

> > > --- a/drivers/pci/dwc/pcie-kirin.c

> > > +++ b/drivers/pci/dwc/pcie-kirin.c

> > > @@ -430,6 +430,9 @@ static int kirin_pcie_host_init(struct pcie_port

> > > *pp) {

> > >  	kirin_pcie_establish_link(pp);

> > >

> > > +	if (IS_ENABLED(CONFIG_PCI_MSI))

> > > +		dw_pcie_msi_init(pp);

> > > +

> > >  	return 0;

> > >  }

> > >

> > > @@ -445,9 +448,34 @@ static const struct dw_pcie_host_ops

> > > kirin_pcie_host_ops = {

> > >  	.host_init = kirin_pcie_host_init,  };

> > >

> > > +static int kirin_pcie_add_msi(struct dw_pcie *pci,

> > > +				struct platform_device *pdev)

> > > +{

> > > +	int ret = 0;

> > > +

> > > +	if (IS_ENABLED(CONFIG_PCI_MSI)) {

> > > +		ret = platform_get_irq(pdev, 0);

> > > +		if (ret < 0) {

> > > +			dev_err(&pdev->dev,

> > > +				"failed to get MSI IRQ (%d)\n", ret);

> > > +			return ret;

> > > +		}

> > > +

> > > +		pci->pp.msi_irq = ret;

> > > +	}

> > > +

> > > +	return ret;

> > > +}

> > > +

> > >  static int __init kirin_add_pcie_port(struct dw_pcie *pci,

> > >  				      struct platform_device *pdev)  {

> > > +	int ret;

> > > +

> > > +	ret = kirin_pcie_add_msi(pci, pdev);

> > > +	if (ret)

> > > +		return ret;

> 

> If kirin_pcie_add_msi() returns an IRQ number we return from this function

> here, is that what you really want ?

[songxiaowei]  Sorry about this issue, I'll check the patch carefully and test it on Hikey960 Board.
			 Thanks a lot for your time.

Best regards,
Xiaowei.
> 

> Lorenzo

> 

> > > +

> > >  	pci->pp.ops = &kirin_pcie_host_ops;

> > >

> > >  	return dw_pcie_host_init(&pci->pp);

> > > --

> > > 2.11.GIT

> >
diff mbox

Patch

diff --git a/drivers/pci/dwc/pcie-kirin.c b/drivers/pci/dwc/pcie-kirin.c
index d2970a009eb5..6997276eb69c 100644
--- a/drivers/pci/dwc/pcie-kirin.c
+++ b/drivers/pci/dwc/pcie-kirin.c
@@ -430,6 +430,9 @@  static int kirin_pcie_host_init(struct pcie_port *pp)
 {
 	kirin_pcie_establish_link(pp);
 
+	if (IS_ENABLED(CONFIG_PCI_MSI))
+		dw_pcie_msi_init(pp);
+
 	return 0;
 }
 
@@ -445,9 +448,34 @@  static const struct dw_pcie_host_ops kirin_pcie_host_ops = {
 	.host_init = kirin_pcie_host_init,
 };
 
+static int kirin_pcie_add_msi(struct dw_pcie *pci,
+				struct platform_device *pdev)
+{
+	int ret = 0;
+
+	if (IS_ENABLED(CONFIG_PCI_MSI)) {
+		ret = platform_get_irq(pdev, 0);
+		if (ret < 0) {
+			dev_err(&pdev->dev,
+				"failed to get MSI IRQ (%d)\n", ret);
+			return ret;
+		}
+
+		pci->pp.msi_irq = ret;
+	}
+
+	return ret;
+}
+
 static int __init kirin_add_pcie_port(struct dw_pcie *pci,
 				      struct platform_device *pdev)
 {
+	int ret;
+
+	ret = kirin_pcie_add_msi(pci, pdev);
+	if (ret)
+		return ret;
+
 	pci->pp.ops = &kirin_pcie_host_ops;
 
 	return dw_pcie_host_init(&pci->pp);