diff mbox series

[v3,2/3] PCI: qcom: Set linkup_irq if global IRQ handler is present

Message ID 20241101-remove_wait-v3-2-7accf27f7202@quicinc.com (mailing list archive)
State New
Delegated to: Manivannan Sadhasivam
Headers show
Series PCI: dwc: Skip waiting for link up if vendor drivers can detect Link up event | expand

Commit Message

Krishna Chaitanya Chundru Nov. 1, 2024, 11:34 a.m. UTC
In cases where a global IRQ handler is present to manage link up
interrupts, it may not be necessary to wait for the link to be up
during PCI initialization which optimizes the bootup time.

So, set linkup_irq flag if global IRQ is present and In order to set the
linkup_irq flag before calling dw_pcie_host_init() API, which waits for
link to be up, move platform_get_irq_byname_optional() API
above dw_pcie_host_init().

Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
---
 drivers/pci/controller/dwc/pcie-qcom.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Bjorn Andersson Nov. 1, 2024, 3:30 p.m. UTC | #1
On Fri, Nov 01, 2024 at 05:04:13PM GMT, Krishna chaitanya chundru wrote:
> In cases where a global IRQ handler is present to manage link up
> interrupts, it may not be necessary to wait for the link to be up
> during PCI initialization which optimizes the bootup time.
> 
> So, set linkup_irq flag if global IRQ is present and In order to set the
> linkup_irq flag before calling dw_pcie_host_init() API, which waits for
> link to be up, move platform_get_irq_byname_optional() API
> above dw_pcie_host_init().
> 
> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
> ---
>  drivers/pci/controller/dwc/pcie-qcom.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
> index ef44a82be058..474b7525442d 100644
> --- a/drivers/pci/controller/dwc/pcie-qcom.c
> +++ b/drivers/pci/controller/dwc/pcie-qcom.c
> @@ -1692,6 +1692,10 @@ static int qcom_pcie_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, pcie);
>  
> +	irq = platform_get_irq_byname_optional(pdev, "global");
> +	if (irq > 0)
> +		pp->linkup_irq = true;

This seems to only ever being used in dw_pcie_host_init(), would it make
sense to use a argument to the function to pass the parameter instead of
stashing it in the persistent data structure?

Regards,
Bjorn

> +
>  	ret = dw_pcie_host_init(pp);
>  	if (ret) {
>  		dev_err(dev, "cannot initialize host\n");
> @@ -1705,7 +1709,6 @@ static int qcom_pcie_probe(struct platform_device *pdev)
>  		goto err_host_deinit;
>  	}
>  
> -	irq = platform_get_irq_byname_optional(pdev, "global");
>  	if (irq > 0) {
>  		ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
>  						qcom_pcie_global_irq_thread,
> 
> -- 
> 2.34.1
> 
>
Krishna Chaitanya Chundru Nov. 4, 2024, 6:17 a.m. UTC | #2
On 11/1/2024 9:00 PM, Bjorn Andersson wrote:
> On Fri, Nov 01, 2024 at 05:04:13PM GMT, Krishna chaitanya chundru wrote:
>> In cases where a global IRQ handler is present to manage link up
>> interrupts, it may not be necessary to wait for the link to be up
>> during PCI initialization which optimizes the bootup time.
>>
>> So, set linkup_irq flag if global IRQ is present and In order to set the
>> linkup_irq flag before calling dw_pcie_host_init() API, which waits for
>> link to be up, move platform_get_irq_byname_optional() API
>> above dw_pcie_host_init().
>>
>> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
>> ---
>>   drivers/pci/controller/dwc/pcie-qcom.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
>> index ef44a82be058..474b7525442d 100644
>> --- a/drivers/pci/controller/dwc/pcie-qcom.c
>> +++ b/drivers/pci/controller/dwc/pcie-qcom.c
>> @@ -1692,6 +1692,10 @@ static int qcom_pcie_probe(struct platform_device *pdev)
>>   
>>   	platform_set_drvdata(pdev, pcie);
>>   
>> +	irq = platform_get_irq_byname_optional(pdev, "global");
>> +	if (irq > 0)
>> +		pp->linkup_irq = true;
> 
> This seems to only ever being used in dw_pcie_host_init(), would it make
> sense to use a argument to the function to pass the parameter instead of
> stashing it in the persistent data structure?
> 
dw_pcie_host_init() API is being used by multiple vendors under
drivers/pci/controller/dwc/* it may not be ideal to change the argument
here.

- Krishna Chaitanya.
> Regards,
> Bjorn
> 
>> +
>>   	ret = dw_pcie_host_init(pp);
>>   	if (ret) {
>>   		dev_err(dev, "cannot initialize host\n");
>> @@ -1705,7 +1709,6 @@ static int qcom_pcie_probe(struct platform_device *pdev)
>>   		goto err_host_deinit;
>>   	}
>>   
>> -	irq = platform_get_irq_byname_optional(pdev, "global");
>>   	if (irq > 0) {
>>   		ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
>>   						qcom_pcie_global_irq_thread,
>>
>> -- 
>> 2.34.1
>>
>>
diff mbox series

Patch

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index ef44a82be058..474b7525442d 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1692,6 +1692,10 @@  static int qcom_pcie_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, pcie);
 
+	irq = platform_get_irq_byname_optional(pdev, "global");
+	if (irq > 0)
+		pp->linkup_irq = true;
+
 	ret = dw_pcie_host_init(pp);
 	if (ret) {
 		dev_err(dev, "cannot initialize host\n");
@@ -1705,7 +1709,6 @@  static int qcom_pcie_probe(struct platform_device *pdev)
 		goto err_host_deinit;
 	}
 
-	irq = platform_get_irq_byname_optional(pdev, "global");
 	if (irq > 0) {
 		ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
 						qcom_pcie_global_irq_thread,