2022-07-14 07:15:38

by Johan Hovold

[permalink] [raw]
Subject: [PATCH v2 7/8] PCI: qcom: Clean up IP configurations

The various IP versions have different configurations that are encoded
in separate sets of operation callbacks. Currently, there is no need for
also maintaining corresponding sets of data parameters, but it is
conceivable that these may again be found useful (e.g. to implement
minor variations of the operation callbacks).

Rename the default configuration structures after the IP version they
apply to so that they can more easily be reused by different SoCs.

Note that SoC specific configurations can be added later if need arises
(e.g. cfg_sc8280xp).

Reviewed-by: Rob Herring <[email protected]>
Reviewed-by: Manivannan Sadhasivam <[email protected]>
Signed-off-by: Johan Hovold <[email protected]>
---
drivers/pci/controller/dwc/pcie-qcom.c | 89 +++++++++-----------------
1 file changed, 29 insertions(+), 60 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 1339f05bee65..8dddb72f8647 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1606,66 +1606,35 @@ static const struct qcom_pcie_ops ops_2_9_0 = {
.ltssm_enable = qcom_pcie_2_3_2_ltssm_enable,
};

-static const struct qcom_pcie_cfg apq8084_cfg = {
+static const struct qcom_pcie_cfg cfg_1_0_0 = {
.ops = &ops_1_0_0,
};

-static const struct qcom_pcie_cfg ipq8064_cfg = {
+static const struct qcom_pcie_cfg cfg_1_9_0 = {
+ .ops = &ops_1_9_0,
+};
+
+static const struct qcom_pcie_cfg cfg_2_1_0 = {
.ops = &ops_2_1_0,
};

-static const struct qcom_pcie_cfg msm8996_cfg = {
+static const struct qcom_pcie_cfg cfg_2_3_2 = {
.ops = &ops_2_3_2,
};

-static const struct qcom_pcie_cfg ipq8074_cfg = {
+static const struct qcom_pcie_cfg cfg_2_3_3 = {
.ops = &ops_2_3_3,
};

-static const struct qcom_pcie_cfg ipq4019_cfg = {
+static const struct qcom_pcie_cfg cfg_2_4_0 = {
.ops = &ops_2_4_0,
};

-static const struct qcom_pcie_cfg sa8540p_cfg = {
- .ops = &ops_1_9_0,
-};
-
-static const struct qcom_pcie_cfg sc8280xp_cfg = {
- .ops = &ops_1_9_0,
-};
-
-static const struct qcom_pcie_cfg sdm845_cfg = {
+static const struct qcom_pcie_cfg cfg_2_7_0 = {
.ops = &ops_2_7_0,
};

-static const struct qcom_pcie_cfg sm8150_cfg = {
- /* sm8150 has qcom IP rev 1.5.0. However 1.5.0 ops are same as
- * 1.9.0, so reuse the same.
- */
- .ops = &ops_1_9_0,
-};
-
-static const struct qcom_pcie_cfg sm8250_cfg = {
- .ops = &ops_1_9_0,
-};
-
-static const struct qcom_pcie_cfg sm8450_pcie0_cfg = {
- .ops = &ops_1_9_0,
-};
-
-static const struct qcom_pcie_cfg sm8450_pcie1_cfg = {
- .ops = &ops_1_9_0,
-};
-
-static const struct qcom_pcie_cfg sc7280_cfg = {
- .ops = &ops_1_9_0,
-};
-
-static const struct qcom_pcie_cfg sc8180x_cfg = {
- .ops = &ops_1_9_0,
-};
-
-static const struct qcom_pcie_cfg ipq6018_cfg = {
+static const struct qcom_pcie_cfg cfg_2_9_0 = {
.ops = &ops_2_9_0,
};

@@ -1780,24 +1749,24 @@ static int qcom_pcie_remove(struct platform_device *pdev)
}

static const struct of_device_id qcom_pcie_match[] = {
- { .compatible = "qcom,pcie-apq8084", .data = &apq8084_cfg },
- { .compatible = "qcom,pcie-ipq8064", .data = &ipq8064_cfg },
- { .compatible = "qcom,pcie-ipq8064-v2", .data = &ipq8064_cfg },
- { .compatible = "qcom,pcie-apq8064", .data = &ipq8064_cfg },
- { .compatible = "qcom,pcie-msm8996", .data = &msm8996_cfg },
- { .compatible = "qcom,pcie-ipq8074", .data = &ipq8074_cfg },
- { .compatible = "qcom,pcie-ipq4019", .data = &ipq4019_cfg },
- { .compatible = "qcom,pcie-qcs404", .data = &ipq4019_cfg },
- { .compatible = "qcom,pcie-sa8540p", .data = &sa8540p_cfg },
- { .compatible = "qcom,pcie-sdm845", .data = &sdm845_cfg },
- { .compatible = "qcom,pcie-sm8150", .data = &sm8150_cfg },
- { .compatible = "qcom,pcie-sm8250", .data = &sm8250_cfg },
- { .compatible = "qcom,pcie-sc8180x", .data = &sc8180x_cfg },
- { .compatible = "qcom,pcie-sc8280xp", .data = &sc8280xp_cfg },
- { .compatible = "qcom,pcie-sm8450-pcie0", .data = &sm8450_pcie0_cfg },
- { .compatible = "qcom,pcie-sm8450-pcie1", .data = &sm8450_pcie1_cfg },
- { .compatible = "qcom,pcie-sc7280", .data = &sc7280_cfg },
- { .compatible = "qcom,pcie-ipq6018", .data = &ipq6018_cfg },
+ { .compatible = "qcom,pcie-apq8084", .data = &cfg_1_0_0 },
+ { .compatible = "qcom,pcie-ipq8064", .data = &cfg_2_1_0 },
+ { .compatible = "qcom,pcie-ipq8064-v2", .data = &cfg_2_1_0 },
+ { .compatible = "qcom,pcie-apq8064", .data = &cfg_2_1_0 },
+ { .compatible = "qcom,pcie-msm8996", .data = &cfg_2_3_2 },
+ { .compatible = "qcom,pcie-ipq8074", .data = &cfg_2_3_3 },
+ { .compatible = "qcom,pcie-ipq4019", .data = &cfg_2_4_0 },
+ { .compatible = "qcom,pcie-qcs404", .data = &cfg_2_4_0 },
+ { .compatible = "qcom,pcie-sa8540p", .data = &cfg_1_9_0 },
+ { .compatible = "qcom,pcie-sdm845", .data = &cfg_2_7_0 },
+ { .compatible = "qcom,pcie-sm8150", .data = &cfg_1_9_0 },
+ { .compatible = "qcom,pcie-sm8250", .data = &cfg_1_9_0 },
+ { .compatible = "qcom,pcie-sc8180x", .data = &cfg_1_9_0 },
+ { .compatible = "qcom,pcie-sc8280xp", .data = &cfg_1_9_0 },
+ { .compatible = "qcom,pcie-sm8450-pcie0", .data = &cfg_1_9_0 },
+ { .compatible = "qcom,pcie-sm8450-pcie1", .data = &cfg_1_9_0 },
+ { .compatible = "qcom,pcie-sc7280", .data = &cfg_1_9_0 },
+ { .compatible = "qcom,pcie-ipq6018", .data = &cfg_2_9_0 },
{ }
};
MODULE_DEVICE_TABLE(of, qcom_pcie_match);
--
2.35.1


2022-07-14 14:50:30

by Brian Masney

[permalink] [raw]
Subject: Re: [PATCH v2 7/8] PCI: qcom: Clean up IP configurations

On Thu, Jul 14, 2022 at 09:13:47AM +0200, Johan Hovold wrote:
> The various IP versions have different configurations that are encoded
> in separate sets of operation callbacks. Currently, there is no need for
> also maintaining corresponding sets of data parameters, but it is
> conceivable that these may again be found useful (e.g. to implement
> minor variations of the operation callbacks).
>
> Rename the default configuration structures after the IP version they
> apply to so that they can more easily be reused by different SoCs.
>
> Note that SoC specific configurations can be added later if need arises
> (e.g. cfg_sc8280xp).
>
> Reviewed-by: Rob Herring <[email protected]>
> Reviewed-by: Manivannan Sadhasivam <[email protected]>
> Signed-off-by: Johan Hovold <[email protected]>

Reviewed-by: Brian Masney <[email protected]>

2022-07-18 10:44:36

by Dmitry Baryshkov

[permalink] [raw]
Subject: Re: [PATCH v2 7/8] PCI: qcom: Clean up IP configurations

On 14/07/2022 10:13, Johan Hovold wrote:
> The various IP versions have different configurations that are encoded
> in separate sets of operation callbacks. Currently, there is no need for
> also maintaining corresponding sets of data parameters, but it is
> conceivable that these may again be found useful (e.g. to implement
> minor variations of the operation callbacks).
>
> Rename the default configuration structures after the IP version they
> apply to so that they can more easily be reused by different SoCs.
>
> Note that SoC specific configurations can be added later if need arises
> (e.g. cfg_sc8280xp).
>
> Reviewed-by: Rob Herring <[email protected]>
> Reviewed-by: Manivannan Sadhasivam <[email protected]>
> Signed-off-by: Johan Hovold <[email protected]>


If we have nothing left in the qcom_pcie_cfg other than the .ops, what
about dropping the qcom_pcie_cfg completely and using the qcom_pcie_ops
as match data?

This patch is nevertheless:

Reviewed-by: Dmitry Baryshkov <[email protected]>


> ---
> drivers/pci/controller/dwc/pcie-qcom.c | 89 +++++++++-----------------
> 1 file changed, 29 insertions(+), 60 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
> index 1339f05bee65..8dddb72f8647 100644
> --- a/drivers/pci/controller/dwc/pcie-qcom.c
> +++ b/drivers/pci/controller/dwc/pcie-qcom.c
> @@ -1606,66 +1606,35 @@ static const struct qcom_pcie_ops ops_2_9_0 = {
> .ltssm_enable = qcom_pcie_2_3_2_ltssm_enable,
> };
>
> -static const struct qcom_pcie_cfg apq8084_cfg = {
> +static const struct qcom_pcie_cfg cfg_1_0_0 = {
> .ops = &ops_1_0_0,
> };
>
> -static const struct qcom_pcie_cfg ipq8064_cfg = {
> +static const struct qcom_pcie_cfg cfg_1_9_0 = {
> + .ops = &ops_1_9_0,
> +};
> +
> +static const struct qcom_pcie_cfg cfg_2_1_0 = {
> .ops = &ops_2_1_0,
> };
>
> -static const struct qcom_pcie_cfg msm8996_cfg = {
> +static const struct qcom_pcie_cfg cfg_2_3_2 = {
> .ops = &ops_2_3_2,
> };
>
> -static const struct qcom_pcie_cfg ipq8074_cfg = {
> +static const struct qcom_pcie_cfg cfg_2_3_3 = {
> .ops = &ops_2_3_3,
> };
>
> -static const struct qcom_pcie_cfg ipq4019_cfg = {
> +static const struct qcom_pcie_cfg cfg_2_4_0 = {
> .ops = &ops_2_4_0,
> };
>
> -static const struct qcom_pcie_cfg sa8540p_cfg = {
> - .ops = &ops_1_9_0,
> -};
> -
> -static const struct qcom_pcie_cfg sc8280xp_cfg = {
> - .ops = &ops_1_9_0,
> -};
> -
> -static const struct qcom_pcie_cfg sdm845_cfg = {
> +static const struct qcom_pcie_cfg cfg_2_7_0 = {
> .ops = &ops_2_7_0,
> };
>
> -static const struct qcom_pcie_cfg sm8150_cfg = {
> - /* sm8150 has qcom IP rev 1.5.0. However 1.5.0 ops are same as
> - * 1.9.0, so reuse the same.
> - */
> - .ops = &ops_1_9_0,
> -};
> -
> -static const struct qcom_pcie_cfg sm8250_cfg = {
> - .ops = &ops_1_9_0,
> -};
> -
> -static const struct qcom_pcie_cfg sm8450_pcie0_cfg = {
> - .ops = &ops_1_9_0,
> -};
> -
> -static const struct qcom_pcie_cfg sm8450_pcie1_cfg = {
> - .ops = &ops_1_9_0,
> -};
> -
> -static const struct qcom_pcie_cfg sc7280_cfg = {
> - .ops = &ops_1_9_0,
> -};
> -
> -static const struct qcom_pcie_cfg sc8180x_cfg = {
> - .ops = &ops_1_9_0,
> -};
> -
> -static const struct qcom_pcie_cfg ipq6018_cfg = {
> +static const struct qcom_pcie_cfg cfg_2_9_0 = {
> .ops = &ops_2_9_0,
> };
>
> @@ -1780,24 +1749,24 @@ static int qcom_pcie_remove(struct platform_device *pdev)
> }
>
> static const struct of_device_id qcom_pcie_match[] = {
> - { .compatible = "qcom,pcie-apq8084", .data = &apq8084_cfg },
> - { .compatible = "qcom,pcie-ipq8064", .data = &ipq8064_cfg },
> - { .compatible = "qcom,pcie-ipq8064-v2", .data = &ipq8064_cfg },
> - { .compatible = "qcom,pcie-apq8064", .data = &ipq8064_cfg },
> - { .compatible = "qcom,pcie-msm8996", .data = &msm8996_cfg },
> - { .compatible = "qcom,pcie-ipq8074", .data = &ipq8074_cfg },
> - { .compatible = "qcom,pcie-ipq4019", .data = &ipq4019_cfg },
> - { .compatible = "qcom,pcie-qcs404", .data = &ipq4019_cfg },
> - { .compatible = "qcom,pcie-sa8540p", .data = &sa8540p_cfg },
> - { .compatible = "qcom,pcie-sdm845", .data = &sdm845_cfg },
> - { .compatible = "qcom,pcie-sm8150", .data = &sm8150_cfg },
> - { .compatible = "qcom,pcie-sm8250", .data = &sm8250_cfg },
> - { .compatible = "qcom,pcie-sc8180x", .data = &sc8180x_cfg },
> - { .compatible = "qcom,pcie-sc8280xp", .data = &sc8280xp_cfg },
> - { .compatible = "qcom,pcie-sm8450-pcie0", .data = &sm8450_pcie0_cfg },
> - { .compatible = "qcom,pcie-sm8450-pcie1", .data = &sm8450_pcie1_cfg },
> - { .compatible = "qcom,pcie-sc7280", .data = &sc7280_cfg },
> - { .compatible = "qcom,pcie-ipq6018", .data = &ipq6018_cfg },
> + { .compatible = "qcom,pcie-apq8084", .data = &cfg_1_0_0 },
> + { .compatible = "qcom,pcie-ipq8064", .data = &cfg_2_1_0 },
> + { .compatible = "qcom,pcie-ipq8064-v2", .data = &cfg_2_1_0 },
> + { .compatible = "qcom,pcie-apq8064", .data = &cfg_2_1_0 },
> + { .compatible = "qcom,pcie-msm8996", .data = &cfg_2_3_2 },
> + { .compatible = "qcom,pcie-ipq8074", .data = &cfg_2_3_3 },
> + { .compatible = "qcom,pcie-ipq4019", .data = &cfg_2_4_0 },
> + { .compatible = "qcom,pcie-qcs404", .data = &cfg_2_4_0 },
> + { .compatible = "qcom,pcie-sa8540p", .data = &cfg_1_9_0 },
> + { .compatible = "qcom,pcie-sdm845", .data = &cfg_2_7_0 },
> + { .compatible = "qcom,pcie-sm8150", .data = &cfg_1_9_0 },
> + { .compatible = "qcom,pcie-sm8250", .data = &cfg_1_9_0 },
> + { .compatible = "qcom,pcie-sc8180x", .data = &cfg_1_9_0 },
> + { .compatible = "qcom,pcie-sc8280xp", .data = &cfg_1_9_0 },
> + { .compatible = "qcom,pcie-sm8450-pcie0", .data = &cfg_1_9_0 },
> + { .compatible = "qcom,pcie-sm8450-pcie1", .data = &cfg_1_9_0 },
> + { .compatible = "qcom,pcie-sc7280", .data = &cfg_1_9_0 },
> + { .compatible = "qcom,pcie-ipq6018", .data = &cfg_2_9_0 },
> { }
> };
> MODULE_DEVICE_TABLE(of, qcom_pcie_match);


--
With best wishes
Dmitry

2022-07-18 12:57:37

by Johan Hovold

[permalink] [raw]
Subject: Re: [PATCH v2 7/8] PCI: qcom: Clean up IP configurations

On Mon, Jul 18, 2022 at 01:39:32PM +0300, Dmitry Baryshkov wrote:
> On 14/07/2022 10:13, Johan Hovold wrote:
> > The various IP versions have different configurations that are encoded
> > in separate sets of operation callbacks. Currently, there is no need for
> > also maintaining corresponding sets of data parameters, but it is
> > conceivable that these may again be found useful (e.g. to implement
> > minor variations of the operation callbacks).
> >
> > Rename the default configuration structures after the IP version they
> > apply to so that they can more easily be reused by different SoCs.
> >
> > Note that SoC specific configurations can be added later if need arises
> > (e.g. cfg_sc8280xp).
> >
> > Reviewed-by: Rob Herring <[email protected]>
> > Reviewed-by: Manivannan Sadhasivam <[email protected]>
> > Signed-off-by: Johan Hovold <[email protected]>
>
>
> If we have nothing left in the qcom_pcie_cfg other than the .ops, what
> about dropping the qcom_pcie_cfg completely and using the qcom_pcie_ops
> as match data?

As I mention above I decided to keep the config structures as they can
be used to implement minor variations of the ops.

> This patch is nevertheless:
>
> Reviewed-by: Dmitry Baryshkov <[email protected]>

Thanks for reviewing.

Johan