diff mbox series

PCI: dwc: Add map irq callback

Message ID 333e87c8ea92cd7442fbe874fc8c9eccabc62f58.1565763869.git.eswara.kota@linux.intel.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show
Series PCI: dwc: Add map irq callback | expand

Commit Message

Dilip Kota Aug. 14, 2019, 6:56 a.m. UTC
Certain platforms like Intel need to configure
registers to enable the interrupts.
Map Irq callback helps to perform platform specific
configurations while assigning or enabling the interrupts.

Signed-off-by: Dilip Kota <eswara.kota@linux.intel.com>
---
 drivers/pci/controller/dwc/pcie-designware-host.c | 2 +-
 drivers/pci/controller/dwc/pcie-designware.h      | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Christoph Hellwig Aug. 14, 2019, 7:36 a.m. UTC | #1
On Wed, Aug 14, 2019 at 02:56:49PM +0800, Dilip Kota wrote:
> Certain platforms like Intel need to configure
> registers to enable the interrupts.
> Map Irq callback helps to perform platform specific
> configurations while assigning or enabling the interrupts.

This seems to miss the hunk that actually assigns the map_irq
callback.

> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index f93252d0da5b..5880d2b72ef8 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -470,7 +470,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
>  	bridge->sysdata = pp;
>  	bridge->busnr = pp->root_bus_nr;
>  	bridge->ops = &dw_pcie_ops;
> -	bridge->map_irq = of_irq_parse_and_map_pci;
> +	bridge->map_irq = pp->map_irq ? pp->map_irq : of_irq_parse_and_map_pci;

Pleae just use a classic if / else to make the code a little easier
to read.
Dilip Kota Aug. 14, 2019, 8:31 a.m. UTC | #2
Hi Christoph Hellwig,

On 8/14/2019 3:36 PM, Christoph Hellwig wrote:
> On Wed, Aug 14, 2019 at 02:56:49PM +0800, Dilip Kota wrote:
>> Certain platforms like Intel need to configure
>> registers to enable the interrupts.
>> Map Irq callback helps to perform platform specific
>> configurations while assigning or enabling the interrupts.
> This seems to miss the hunk that actually assigns the map_irq
> callback.
pp->map_irq() must assign the callback along with the platform specific 
configuration.
In Intel PCIe driver pp->map_irq() does the same. (Driver is not yet 
present in mainline, i will submit for review once this change is approved).
>> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
>> index f93252d0da5b..5880d2b72ef8 100644
>> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
>> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
>> @@ -470,7 +470,7 @@ int dw_pcie_host_init(struct pcie_port *pp)
>>   	bridge->sysdata = pp;
>>   	bridge->busnr = pp->root_bus_nr;
>>   	bridge->ops = &dw_pcie_ops;
>> -	bridge->map_irq = of_irq_parse_and_map_pci;
>> +	bridge->map_irq = pp->map_irq ? pp->map_irq : of_irq_parse_and_map_pci;
> Pleae just use a classic if / else to make the code a little easier
> to read.

Noted, will update it.

--Dilip
Christoph Hellwig Aug. 14, 2019, 10:59 a.m. UTC | #3
On Wed, Aug 14, 2019 at 04:31:14PM +0800, Dilip Kota wrote:
> > callback.
> pp->map_irq() must assign the callback along with the platform specific
> configuration.
> In Intel PCIe driver pp->map_irq() does the same. (Driver is not yet present
> in mainline, i will submit for review once this change is approved).

And that's what I meant.  The standard procedure is to submit your
core changes together with the user, not separately.
Dilip Kota Aug. 15, 2019, 5:42 a.m. UTC | #4
On 8/14/2019 6:59 PM, Christoph Hellwig wrote:
> On Wed, Aug 14, 2019 at 04:31:14PM +0800, Dilip Kota wrote:
>>> callback.
>> pp->map_irq() must assign the callback along with the platform specific
>> configuration.
>> In Intel PCIe driver pp->map_irq() does the same. (Driver is not yet present
>> in mainline, i will submit for review once this change is approved).
> And that's what I meant.  The standard procedure is to submit your
> core changes together with the user, not separately.
Sure, will submit the driver change along with this change. Sorry for 
missing it.

Thanks,
Dilip
diff mbox series

Patch

diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index f93252d0da5b..5880d2b72ef8 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -470,7 +470,7 @@  int dw_pcie_host_init(struct pcie_port *pp)
 	bridge->sysdata = pp;
 	bridge->busnr = pp->root_bus_nr;
 	bridge->ops = &dw_pcie_ops;
-	bridge->map_irq = of_irq_parse_and_map_pci;
+	bridge->map_irq = pp->map_irq ? pp->map_irq : of_irq_parse_and_map_pci;
 	bridge->swizzle_irq = pci_common_swizzle;
 
 	ret = pci_scan_root_bus_bridge(bridge);
diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
index ffed084a0b4f..604abc4fa89b 100644
--- a/drivers/pci/controller/dwc/pcie-designware.h
+++ b/drivers/pci/controller/dwc/pcie-designware.h
@@ -173,6 +173,7 @@  struct pcie_port {
 	struct resource		*busn;
 	int			irq;
 	const struct dw_pcie_host_ops *ops;
+	int (*map_irq)(const struct pci_dev *dev, u8 slot, u8 pin);
 	int			msi_irq;
 	struct irq_domain	*irq_domain;
 	struct irq_domain	*msi_domain;