diff mbox

PCI: keystone: Use PCI_NUM_INTX

Message ID 20170815213724.8111.96859.stgit@bhelgaas-glaptop.roam.corp.google.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Bjorn Helgaas Aug. 15, 2017, 9:37 p.m. UTC
Switch from using a custom MAX_LEGACY_IRQS macro to the generic
PCI_NUM_INTX definition for the number of INTx interrupts.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Murali Karicheri <m-karicheri2@ti.com>
---
 drivers/pci/dwc/pci-keystone-dw.c |    4 ++--
 drivers/pci/dwc/pci-keystone.h    |    1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

Comments

Bjorn Helgaas Aug. 15, 2017, 9:44 p.m. UTC | #1
On Tue, Aug 15, 2017 at 04:37:24PM -0500, Bjorn Helgaas wrote:
> Switch from using a custom MAX_LEGACY_IRQS macro to the generic
> PCI_NUM_INTX definition for the number of INTx interrupts.
> 
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Murali Karicheri <m-karicheri2@ti.com>
> ---
>  drivers/pci/dwc/pci-keystone-dw.c |    4 ++--
>  drivers/pci/dwc/pci-keystone.h    |    1 -
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/pci/dwc/pci-keystone-dw.c b/drivers/pci/dwc/pci-keystone-dw.c
> index df60f48716d9..3b0f206590f9 100644
> --- a/drivers/pci/dwc/pci-keystone-dw.c
> +++ b/drivers/pci/dwc/pci-keystone-dw.c
> @@ -251,7 +251,7 @@ void ks_dw_pcie_enable_legacy_irqs(struct keystone_pcie *ks_pcie)
>  {
>  	int i;
>  
> -	for (i = 0; i < MAX_LEGACY_IRQS; i++)
> +	for (i = 0; i < PCI_NUM_INTX; i++)
>  		ks_dw_app_writel(ks_pcie, IRQ_ENABLE_SET + (i << 4), 0x1);
>  }
>  
> @@ -557,7 +557,7 @@ int __init ks_dw_pcie_host_init(struct keystone_pcie *ks_pcie,
>  	/* Create legacy IRQ domain */
>  	ks_pcie->legacy_irq_domain =
>  			irq_domain_add_linear(ks_pcie->legacy_intc_np,
> -					MAX_LEGACY_IRQS,
> +					PCI_NUM_INTX,
>  					&ks_dw_pcie_legacy_irq_domain_ops,
>  					NULL);
>  	if (!ks_pcie->legacy_irq_domain) {
> diff --git a/drivers/pci/dwc/pci-keystone.h b/drivers/pci/dwc/pci-keystone.h
> index 74c5825882df..69fc60129f45 100644
> --- a/drivers/pci/dwc/pci-keystone.h
> +++ b/drivers/pci/dwc/pci-keystone.h
> @@ -12,7 +12,6 @@
>   * published by the Free Software Foundation.
>   */
>  
> -#define MAX_LEGACY_IRQS			4
>  #define MAX_MSI_HOST_IRQS		8
>  #define MAX_LEGACY_HOST_IRQS		4

BTW, Murali, what is MAX_LEGACY_HOST_IRQS?  Is that something we can
replace by PCI_NUM_INTX also?

(PCI_NUM_INTX is a new definition in include/linux/pci.h for the
number of INTx interrupts: INTA, INTB, INTC, INTD).
Murali Karicheri Aug. 16, 2017, 6:08 p.m. UTC | #2
On 08/15/2017 05:44 PM, Bjorn Helgaas wrote:
> On Tue, Aug 15, 2017 at 04:37:24PM -0500, Bjorn Helgaas wrote:
>> Switch from using a custom MAX_LEGACY_IRQS macro to the generic
>> PCI_NUM_INTX definition for the number of INTx interrupts.
>>
>> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
>> Cc: Murali Karicheri <m-karicheri2@ti.com>
>> ---
>>  drivers/pci/dwc/pci-keystone-dw.c |    4 ++--
>>  drivers/pci/dwc/pci-keystone.h    |    1 -
>>  2 files changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/pci/dwc/pci-keystone-dw.c b/drivers/pci/dwc/pci-keystone-dw.c
>> index df60f48716d9..3b0f206590f9 100644
>> --- a/drivers/pci/dwc/pci-keystone-dw.c
>> +++ b/drivers/pci/dwc/pci-keystone-dw.c
>> @@ -251,7 +251,7 @@ void ks_dw_pcie_enable_legacy_irqs(struct keystone_pcie *ks_pcie)
>>  {
>>  	int i;
>>  
>> -	for (i = 0; i < MAX_LEGACY_IRQS; i++)
>> +	for (i = 0; i < PCI_NUM_INTX; i++)
>>  		ks_dw_app_writel(ks_pcie, IRQ_ENABLE_SET + (i << 4), 0x1);
>>  }
>>  
>> @@ -557,7 +557,7 @@ int __init ks_dw_pcie_host_init(struct keystone_pcie *ks_pcie,
>>  	/* Create legacy IRQ domain */
>>  	ks_pcie->legacy_irq_domain =
>>  			irq_domain_add_linear(ks_pcie->legacy_intc_np,
>> -					MAX_LEGACY_IRQS,
>> +					PCI_NUM_INTX,
>>  					&ks_dw_pcie_legacy_irq_domain_ops,
>>  					NULL);
>>  	if (!ks_pcie->legacy_irq_domain) {
>> diff --git a/drivers/pci/dwc/pci-keystone.h b/drivers/pci/dwc/pci-keystone.h
>> index 74c5825882df..69fc60129f45 100644
>> --- a/drivers/pci/dwc/pci-keystone.h
>> +++ b/drivers/pci/dwc/pci-keystone.h
>> @@ -12,7 +12,6 @@
>>   * published by the Free Software Foundation.
>>   */
>>  
>> -#define MAX_LEGACY_IRQS			4
>>  #define MAX_MSI_HOST_IRQS		8
>>  #define MAX_LEGACY_HOST_IRQS		4
> 
> BTW, Murali, what is MAX_LEGACY_HOST_IRQS?  Is that something we can
> replace by PCI_NUM_INTX also?
> 

It is the number of interrupts going to the ARM GIC controller for Legacy
PCI interrupts. Corresponding for MSI is MAX_MSI_HOST_IRQS.  MAX_LEGACY_IRQS
is for number of PCI Legacy irq line one PCI bus. In keystone case, it is
1 to 1. So it can be changed. 

Murali

> (PCI_NUM_INTX is a new definition in include/linux/pci.h for the
> number of INTx interrupts: INTA, INTB, INTC, INTD).
>
diff mbox

Patch

diff --git a/drivers/pci/dwc/pci-keystone-dw.c b/drivers/pci/dwc/pci-keystone-dw.c
index df60f48716d9..3b0f206590f9 100644
--- a/drivers/pci/dwc/pci-keystone-dw.c
+++ b/drivers/pci/dwc/pci-keystone-dw.c
@@ -251,7 +251,7 @@  void ks_dw_pcie_enable_legacy_irqs(struct keystone_pcie *ks_pcie)
 {
 	int i;
 
-	for (i = 0; i < MAX_LEGACY_IRQS; i++)
+	for (i = 0; i < PCI_NUM_INTX; i++)
 		ks_dw_app_writel(ks_pcie, IRQ_ENABLE_SET + (i << 4), 0x1);
 }
 
@@ -557,7 +557,7 @@  int __init ks_dw_pcie_host_init(struct keystone_pcie *ks_pcie,
 	/* Create legacy IRQ domain */
 	ks_pcie->legacy_irq_domain =
 			irq_domain_add_linear(ks_pcie->legacy_intc_np,
-					MAX_LEGACY_IRQS,
+					PCI_NUM_INTX,
 					&ks_dw_pcie_legacy_irq_domain_ops,
 					NULL);
 	if (!ks_pcie->legacy_irq_domain) {
diff --git a/drivers/pci/dwc/pci-keystone.h b/drivers/pci/dwc/pci-keystone.h
index 74c5825882df..69fc60129f45 100644
--- a/drivers/pci/dwc/pci-keystone.h
+++ b/drivers/pci/dwc/pci-keystone.h
@@ -12,7 +12,6 @@ 
  * published by the Free Software Foundation.
  */
 
-#define MAX_LEGACY_IRQS			4
 #define MAX_MSI_HOST_IRQS		8
 #define MAX_LEGACY_HOST_IRQS		4