diff mbox series

[v5] PCI: qcom: Use default config space read function

Message ID 66ae38dc-1c0c-5a76-be23-fb87db90b327@free.fr (mailing list archive)
State Accepted, archived
Commit 915347f67d41857a514bed77053b212f3696e8a3
Headers show
Series [v5] PCI: qcom: Use default config space read function | expand

Commit Message

Marc Gonzalez March 25, 2019, 3:42 p.m. UTC
Move the device class fudge to a proper fixup function, and remove
qcom_pcie_rd_own_conf() which has become useless.

NB: dw_pcie_setup_rc() already did the right thing, but it's broken
on older qcom chips, such as 8064.

Signed-off-by: Marc Gonzalez <marc.w.gonzalez@free.fr>
---
Changes from v4 to v5: Apply fixup to all qcom chips, the same way it was before
(thus the code remains functionally equivalent)
Drop Srinivas' Tested-by tag because of the change
---
 drivers/pci/controller/dwc/pcie-qcom.c | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

Comments

Marc Gonzalez March 29, 2019, 1:48 p.m. UTC | #1
Bjorn,

I think this patch is good enough to land now.

Regards.

On 25/03/2019 16:42, Marc Gonzalez wrote:

> Move the device class fudge to a proper fixup function, and remove
> qcom_pcie_rd_own_conf() which has become useless.
> 
> NB: dw_pcie_setup_rc() already did the right thing, but it's broken
> on older qcom chips, such as 8064.
> 
> Signed-off-by: Marc Gonzalez <marc.w.gonzalez@free.fr>
> ---
> Changes from v4 to v5: Apply fixup to all qcom chips, the same way it was before
> (thus the code remains functionally equivalent)
> Drop Srinivas' Tested-by tag because of the change
> ---
>  drivers/pci/controller/dwc/pcie-qcom.c | 23 ++++++-----------------
>  1 file changed, 6 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
> index a7f703556790..0ed235d560e3 100644
> --- a/drivers/pci/controller/dwc/pcie-qcom.c
> +++ b/drivers/pci/controller/dwc/pcie-qcom.c
> @@ -1129,25 +1129,8 @@ static int qcom_pcie_host_init(struct pcie_port *pp)
>  	return ret;
>  }
>  
> -static int qcom_pcie_rd_own_conf(struct pcie_port *pp, int where, int size,
> -				 u32 *val)
> -{
> -	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
> -
> -	/* the device class is not reported correctly from the register */
> -	if (where == PCI_CLASS_REVISION && size == 4) {
> -		*val = readl(pci->dbi_base + PCI_CLASS_REVISION);
> -		*val &= 0xff;	/* keep revision id */
> -		*val |= PCI_CLASS_BRIDGE_PCI << 16;
> -		return PCIBIOS_SUCCESSFUL;
> -	}
> -
> -	return dw_pcie_read(pci->dbi_base + where, size, val);
> -}
> -
>  static const struct dw_pcie_host_ops qcom_pcie_dw_ops = {
>  	.host_init = qcom_pcie_host_init,
> -	.rd_own_conf = qcom_pcie_rd_own_conf,
>  };
>  
>  /* Qcom IP rev.: 2.1.0	Synopsys IP rev.: 4.01a */
> @@ -1309,6 +1292,12 @@ static const struct of_device_id qcom_pcie_match[] = {
>  	{ }
>  };
>  
> +static void qcom_fixup_class(struct pci_dev *dev)
> +{
> +	dev->class = PCI_CLASS_BRIDGE_PCI << 8;
> +}
> +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, PCI_ANY_ID, qcom_fixup_class);
> +
>  static struct platform_driver qcom_pcie_driver = {
>  	.probe = qcom_pcie_probe,
>  	.driver = {
Stanimir Varbanov March 29, 2019, 3:55 p.m. UTC | #2
Hi Marc,

Thanks for the patch!

On 3/25/19 5:42 PM, Marc Gonzalez wrote:
> Move the device class fudge to a proper fixup function, and remove
> qcom_pcie_rd_own_conf() which has become useless.
> 
> NB: dw_pcie_setup_rc() already did the right thing, but it's broken
> on older qcom chips, such as 8064.
> 
> Signed-off-by: Marc Gonzalez <marc.w.gonzalez@free.fr>
> ---
> Changes from v4 to v5: Apply fixup to all qcom chips, the same way it was before
> (thus the code remains functionally equivalent)
> Drop Srinivas' Tested-by tag because of the change
> ---
>  drivers/pci/controller/dwc/pcie-qcom.c | 23 ++++++-----------------
>  1 file changed, 6 insertions(+), 17 deletions(-)

Acked-by: Stanimir Varbanov <svarbanov@mm-sol.com>
Lorenzo Pieralisi March 29, 2019, 4:38 p.m. UTC | #3
On Mon, Mar 25, 2019 at 04:42:55PM +0100, Marc Gonzalez wrote:
> Move the device class fudge to a proper fixup function, and remove
> qcom_pcie_rd_own_conf() which has become useless.
> 
> NB: dw_pcie_setup_rc() already did the right thing, but it's broken
> on older qcom chips, such as 8064.
> 
> Signed-off-by: Marc Gonzalez <marc.w.gonzalez@free.fr>
> ---
> Changes from v4 to v5: Apply fixup to all qcom chips, the same way it was before
> (thus the code remains functionally equivalent)
> Drop Srinivas' Tested-by tag because of the change
> ---
>  drivers/pci/controller/dwc/pcie-qcom.c | 23 ++++++-----------------
>  1 file changed, 6 insertions(+), 17 deletions(-)

Applied to pci/dwc for v5.2, thanks.

Lorenzo

> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
> index a7f703556790..0ed235d560e3 100644
> --- a/drivers/pci/controller/dwc/pcie-qcom.c
> +++ b/drivers/pci/controller/dwc/pcie-qcom.c
> @@ -1129,25 +1129,8 @@ static int qcom_pcie_host_init(struct pcie_port *pp)
>  	return ret;
>  }
>  
> -static int qcom_pcie_rd_own_conf(struct pcie_port *pp, int where, int size,
> -				 u32 *val)
> -{
> -	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
> -
> -	/* the device class is not reported correctly from the register */
> -	if (where == PCI_CLASS_REVISION && size == 4) {
> -		*val = readl(pci->dbi_base + PCI_CLASS_REVISION);
> -		*val &= 0xff;	/* keep revision id */
> -		*val |= PCI_CLASS_BRIDGE_PCI << 16;
> -		return PCIBIOS_SUCCESSFUL;
> -	}
> -
> -	return dw_pcie_read(pci->dbi_base + where, size, val);
> -}
> -
>  static const struct dw_pcie_host_ops qcom_pcie_dw_ops = {
>  	.host_init = qcom_pcie_host_init,
> -	.rd_own_conf = qcom_pcie_rd_own_conf,
>  };
>  
>  /* Qcom IP rev.: 2.1.0	Synopsys IP rev.: 4.01a */
> @@ -1309,6 +1292,12 @@ static const struct of_device_id qcom_pcie_match[] = {
>  	{ }
>  };
>  
> +static void qcom_fixup_class(struct pci_dev *dev)
> +{
> +	dev->class = PCI_CLASS_BRIDGE_PCI << 8;
> +}
> +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, PCI_ANY_ID, qcom_fixup_class);
> +
>  static struct platform_driver qcom_pcie_driver = {
>  	.probe = qcom_pcie_probe,
>  	.driver = {
> -- 
> 2.17.1
Marc Gonzalez April 1, 2019, 10:39 a.m. UTC | #4
On 29/03/2019 17:38, Lorenzo Pieralisi wrote:

> On Mon, Mar 25, 2019 at 04:42:55PM +0100, Marc Gonzalez wrote:
>
>> Move the device class fudge to a proper fixup function, and remove
>> qcom_pcie_rd_own_conf() which has become useless.
>>
>> NB: dw_pcie_setup_rc() already did the right thing, but it's broken
>> on older qcom chips, such as 8064.
>>
>> Signed-off-by: Marc Gonzalez <marc.w.gonzalez@free.fr>
>> ---
>> Changes from v4 to v5: Apply fixup to all qcom chips, the same way it was before
>> (thus the code remains functionally equivalent)
>> Drop Srinivas' Tested-by tag because of the change
>> ---
>>  drivers/pci/controller/dwc/pcie-qcom.c | 23 ++++++-----------------
>>  1 file changed, 6 insertions(+), 17 deletions(-)
> 
> Applied to pci/dwc for v5.2, thanks.

Thanks!

Do you push to linux-next? (The patch is not in next-20190401)

Regards.
Lorenzo Pieralisi April 1, 2019, 11:12 a.m. UTC | #5
On Mon, Apr 01, 2019 at 12:39:33PM +0200, Marc Gonzalez wrote:
> On 29/03/2019 17:38, Lorenzo Pieralisi wrote:
> 
> > On Mon, Mar 25, 2019 at 04:42:55PM +0100, Marc Gonzalez wrote:
> >
> >> Move the device class fudge to a proper fixup function, and remove
> >> qcom_pcie_rd_own_conf() which has become useless.
> >>
> >> NB: dw_pcie_setup_rc() already did the right thing, but it's broken
> >> on older qcom chips, such as 8064.
> >>
> >> Signed-off-by: Marc Gonzalez <marc.w.gonzalez@free.fr>
> >> ---
> >> Changes from v4 to v5: Apply fixup to all qcom chips, the same way it was before
> >> (thus the code remains functionally equivalent)
> >> Drop Srinivas' Tested-by tag because of the change
> >> ---
> >>  drivers/pci/controller/dwc/pcie-qcom.c | 23 ++++++-----------------
> >>  1 file changed, 6 insertions(+), 17 deletions(-)
> > 
> > Applied to pci/dwc for v5.2, thanks.
> 
> Thanks!
> 
> Do you push to linux-next? (The patch is not in next-20190401)

Bjorn will push it into linux-next in due course.

Thanks,
Lorenzo
diff mbox series

Patch

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index a7f703556790..0ed235d560e3 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1129,25 +1129,8 @@  static int qcom_pcie_host_init(struct pcie_port *pp)
 	return ret;
 }
 
-static int qcom_pcie_rd_own_conf(struct pcie_port *pp, int where, int size,
-				 u32 *val)
-{
-	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
-
-	/* the device class is not reported correctly from the register */
-	if (where == PCI_CLASS_REVISION && size == 4) {
-		*val = readl(pci->dbi_base + PCI_CLASS_REVISION);
-		*val &= 0xff;	/* keep revision id */
-		*val |= PCI_CLASS_BRIDGE_PCI << 16;
-		return PCIBIOS_SUCCESSFUL;
-	}
-
-	return dw_pcie_read(pci->dbi_base + where, size, val);
-}
-
 static const struct dw_pcie_host_ops qcom_pcie_dw_ops = {
 	.host_init = qcom_pcie_host_init,
-	.rd_own_conf = qcom_pcie_rd_own_conf,
 };
 
 /* Qcom IP rev.: 2.1.0	Synopsys IP rev.: 4.01a */
@@ -1309,6 +1292,12 @@  static const struct of_device_id qcom_pcie_match[] = {
 	{ }
 };
 
+static void qcom_fixup_class(struct pci_dev *dev)
+{
+	dev->class = PCI_CLASS_BRIDGE_PCI << 8;
+}
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_QCOM, PCI_ANY_ID, qcom_fixup_class);
+
 static struct platform_driver qcom_pcie_driver = {
 	.probe = qcom_pcie_probe,
 	.driver = {