diff mbox series

[PATCHv10,05/13] PCI: mobiveil: Add callback function for interrupt initialization

Message ID 20200213040644.45858-6-Zhiqiang.Hou@nxp.com (mailing list archive)
State Accepted, archived
Delegated to: Lorenzo Pieralisi
Headers show
Series PCI: Recode Mobiveil driver and add PCIe Gen4 driver for NXP Layerscape SoCs | expand

Commit Message

Z.Q. Hou Feb. 13, 2020, 4:06 a.m. UTC
From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>

The Mobiveil GPEX internal MSI/INTx controller may not be used
by other platforms in which the Mobiveil GPEX is integrated.
This patch is to allow these platforms to implement their
specific interrupt initialization.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
---
V10:
 - Introduced a helper function mobiveil_pcie_integrated_interrupt_init().

 drivers/pci/controller/mobiveil/pcie-mobiveil-host.c | 12 +++++++++++-
 drivers/pci/controller/mobiveil/pcie-mobiveil.h      |  7 +++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

Comments

Andrew Murray Feb. 20, 2020, 5:25 p.m. UTC | #1
On Thu, Feb 13, 2020 at 12:06:36PM +0800, Zhiqiang Hou wrote:
> From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> 
> The Mobiveil GPEX internal MSI/INTx controller may not be used
> by other platforms in which the Mobiveil GPEX is integrated.
> This patch is to allow these platforms to implement their
> specific interrupt initialization.
> 
> Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>

Reviewed-by: Andrew Murray <amurray@thegoodpenguin.co.uk>

> ---
> V10:
>  - Introduced a helper function mobiveil_pcie_integrated_interrupt_init().
> 
>  drivers/pci/controller/mobiveil/pcie-mobiveil-host.c | 12 +++++++++++-
>  drivers/pci/controller/mobiveil/pcie-mobiveil.h      |  7 +++++++
>  2 files changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c b/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
> index ea90d2f8692e..53ab8412a1de 100644
> --- a/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
> +++ b/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
> @@ -499,7 +499,7 @@ static int mobiveil_pcie_init_irq_domain(struct mobiveil_pcie *pcie)
>  	return 0;
>  }
>  
> -static int mobiveil_pcie_interrupt_init(struct mobiveil_pcie *pcie)
> +static int mobiveil_pcie_integrated_interrupt_init(struct mobiveil_pcie *pcie)
>  {
>  	struct platform_device *pdev = pcie->pdev;
>  	struct device *dev = &pdev->dev;
> @@ -539,6 +539,16 @@ static int mobiveil_pcie_interrupt_init(struct mobiveil_pcie *pcie)
>  	return 0;
>  }
>  
> +static int mobiveil_pcie_interrupt_init(struct mobiveil_pcie *pcie)
> +{
> +	struct mobiveil_root_port *rp = &pcie->rp;
> +
> +	if (rp->ops->interrupt_init)
> +		return rp->ops->interrupt_init(pcie);
> +
> +	return mobiveil_pcie_integrated_interrupt_init(pcie);
> +}
> +
>  int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie)
>  {
>  	struct mobiveil_root_port *rp = &pcie->rp;
> diff --git a/drivers/pci/controller/mobiveil/pcie-mobiveil.h b/drivers/pci/controller/mobiveil/pcie-mobiveil.h
> index 81ffbbd48c08..0e6b5468c026 100644
> --- a/drivers/pci/controller/mobiveil/pcie-mobiveil.h
> +++ b/drivers/pci/controller/mobiveil/pcie-mobiveil.h
> @@ -130,10 +130,17 @@ struct mobiveil_msi {			/* MSI information */
>  	DECLARE_BITMAP(msi_irq_in_use, PCI_NUM_MSI);
>  };
>  
> +struct mobiveil_pcie;
> +
> +struct mobiveil_rp_ops {
> +	int (*interrupt_init)(struct mobiveil_pcie *pcie);
> +};
> +
>  struct mobiveil_root_port {
>  	char root_bus_nr;
>  	void __iomem *config_axi_slave_base;	/* endpoint config base */
>  	struct resource *ob_io_res;
> +	struct mobiveil_rp_ops *ops;
>  	int irq;
>  	raw_spinlock_t intx_mask_lock;
>  	struct irq_domain *intx_domain;
> -- 
> 2.17.1
>
Z.Q. Hou Feb. 24, 2020, 5:49 a.m. UTC | #2
Hi Andrew,

Thanks a lot for your review!

Thanks,
Zhiqiang

> -----Original Message-----
> From: Andrew Murray <amurray@thegoodpenguin.co.uk>
> Sent: 2020年2月21日 1:25
> To: Z.q. Hou <zhiqiang.hou@nxp.com>
> Cc: linux-pci@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> devicetree@vger.kernel.org; linux-kernel@vger.kernel.org;
> bhelgaas@google.com; robh+dt@kernel.org; andrew.murray@arm.com;
> arnd@arndb.de; mark.rutland@arm.com; l.subrahmanya@mobiveil.co.in;
> shawnguo@kernel.org; m.karthikeyan@mobiveil.co.in; Leo Li
> <leoyang.li@nxp.com>; lorenzo.pieralisi@arm.com;
> catalin.marinas@arm.com; will.deacon@arm.com; Mingkai Hu
> <mingkai.hu@nxp.com>; M.h. Lian <minghuan.lian@nxp.com>; Xiaowei Bao
> <xiaowei.bao@nxp.com>
> Subject: Re: [PATCHv10 05/13] PCI: mobiveil: Add callback function for
> interrupt initialization
> 
> On Thu, Feb 13, 2020 at 12:06:36PM +0800, Zhiqiang Hou wrote:
> > From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> >
> > The Mobiveil GPEX internal MSI/INTx controller may not be used by
> > other platforms in which the Mobiveil GPEX is integrated.
> > This patch is to allow these platforms to implement their specific
> > interrupt initialization.
> >
> > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> 
> Reviewed-by: Andrew Murray <amurray@thegoodpenguin.co.uk>
> 
> > ---
> > V10:
> >  - Introduced a helper function mobiveil_pcie_integrated_interrupt_init().
> >
> >  drivers/pci/controller/mobiveil/pcie-mobiveil-host.c | 12 +++++++++++-
> >  drivers/pci/controller/mobiveil/pcie-mobiveil.h      |  7 +++++++
> >  2 files changed, 18 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
> > b/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
> > index ea90d2f8692e..53ab8412a1de 100644
> > --- a/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
> > +++ b/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
> > @@ -499,7 +499,7 @@ static int mobiveil_pcie_init_irq_domain(struct
> mobiveil_pcie *pcie)
> >  	return 0;
> >  }
> >
> > -static int mobiveil_pcie_interrupt_init(struct mobiveil_pcie *pcie)
> > +static int mobiveil_pcie_integrated_interrupt_init(struct
> > +mobiveil_pcie *pcie)
> >  {
> >  	struct platform_device *pdev = pcie->pdev;
> >  	struct device *dev = &pdev->dev;
> > @@ -539,6 +539,16 @@ static int mobiveil_pcie_interrupt_init(struct
> mobiveil_pcie *pcie)
> >  	return 0;
> >  }
> >
> > +static int mobiveil_pcie_interrupt_init(struct mobiveil_pcie *pcie) {
> > +	struct mobiveil_root_port *rp = &pcie->rp;
> > +
> > +	if (rp->ops->interrupt_init)
> > +		return rp->ops->interrupt_init(pcie);
> > +
> > +	return mobiveil_pcie_integrated_interrupt_init(pcie);
> > +}
> > +
> >  int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie)  {
> >  	struct mobiveil_root_port *rp = &pcie->rp; diff --git
> > a/drivers/pci/controller/mobiveil/pcie-mobiveil.h
> > b/drivers/pci/controller/mobiveil/pcie-mobiveil.h
> > index 81ffbbd48c08..0e6b5468c026 100644
> > --- a/drivers/pci/controller/mobiveil/pcie-mobiveil.h
> > +++ b/drivers/pci/controller/mobiveil/pcie-mobiveil.h
> > @@ -130,10 +130,17 @@ struct mobiveil_msi {			/* MSI
> information */
> >  	DECLARE_BITMAP(msi_irq_in_use, PCI_NUM_MSI);  };
> >
> > +struct mobiveil_pcie;
> > +
> > +struct mobiveil_rp_ops {
> > +	int (*interrupt_init)(struct mobiveil_pcie *pcie); };
> > +
> >  struct mobiveil_root_port {
> >  	char root_bus_nr;
> >  	void __iomem *config_axi_slave_base;	/* endpoint config base */
> >  	struct resource *ob_io_res;
> > +	struct mobiveil_rp_ops *ops;
> >  	int irq;
> >  	raw_spinlock_t intx_mask_lock;
> >  	struct irq_domain *intx_domain;
> > --
> > 2.17.1
> >
diff mbox series

Patch

diff --git a/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c b/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
index ea90d2f8692e..53ab8412a1de 100644
--- a/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
+++ b/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
@@ -499,7 +499,7 @@  static int mobiveil_pcie_init_irq_domain(struct mobiveil_pcie *pcie)
 	return 0;
 }
 
-static int mobiveil_pcie_interrupt_init(struct mobiveil_pcie *pcie)
+static int mobiveil_pcie_integrated_interrupt_init(struct mobiveil_pcie *pcie)
 {
 	struct platform_device *pdev = pcie->pdev;
 	struct device *dev = &pdev->dev;
@@ -539,6 +539,16 @@  static int mobiveil_pcie_interrupt_init(struct mobiveil_pcie *pcie)
 	return 0;
 }
 
+static int mobiveil_pcie_interrupt_init(struct mobiveil_pcie *pcie)
+{
+	struct mobiveil_root_port *rp = &pcie->rp;
+
+	if (rp->ops->interrupt_init)
+		return rp->ops->interrupt_init(pcie);
+
+	return mobiveil_pcie_integrated_interrupt_init(pcie);
+}
+
 int mobiveil_pcie_host_probe(struct mobiveil_pcie *pcie)
 {
 	struct mobiveil_root_port *rp = &pcie->rp;
diff --git a/drivers/pci/controller/mobiveil/pcie-mobiveil.h b/drivers/pci/controller/mobiveil/pcie-mobiveil.h
index 81ffbbd48c08..0e6b5468c026 100644
--- a/drivers/pci/controller/mobiveil/pcie-mobiveil.h
+++ b/drivers/pci/controller/mobiveil/pcie-mobiveil.h
@@ -130,10 +130,17 @@  struct mobiveil_msi {			/* MSI information */
 	DECLARE_BITMAP(msi_irq_in_use, PCI_NUM_MSI);
 };
 
+struct mobiveil_pcie;
+
+struct mobiveil_rp_ops {
+	int (*interrupt_init)(struct mobiveil_pcie *pcie);
+};
+
 struct mobiveil_root_port {
 	char root_bus_nr;
 	void __iomem *config_axi_slave_base;	/* endpoint config base */
 	struct resource *ob_io_res;
+	struct mobiveil_rp_ops *ops;
 	int irq;
 	raw_spinlock_t intx_mask_lock;
 	struct irq_domain *intx_domain;