2022-07-06 22:58:18

by Christian Marangi

[permalink] [raw]
Subject: [PATCH v2 0/4] clk: qcom: Drop use of pxo/cxo_board for rpm devices

Trying to convert every driver used by ipq806x to parent_data api, I notice
RPM was still using pxo_board clk.

pxo and pxo_board are the same clock and are defined just to handle old
clock definition. It was discovered that rpm is the last driver using
pxo_board instead of pxo.

While updating the rpm driver I notice the documentation was also wrong,
so this series also fix that.

v2:
- Add review tag to DTS patch
- Drop clock-output-names patch
- Use pxo/cxo_board clock names
- Remove if nesting from Documentation
- Use min/maxItems in Documentation to describe clocks

Christian Marangi (4):
dt-bindings: clock: fix wrong clock documentation for qcom,rpmcc
ARM: DTS: qcom: add rpmcc missing clocks for apq/ipq8064 and msm8660
clk: qcom: clk-rpm: convert to parent_data API
clk: qcom: gcc-ipq806x: remove cc_register_board for pxo and cxo

.../devicetree/bindings/clock/qcom,rpmcc.yaml | 85 ++++++++++++++++++-
arch/arm/boot/dts/qcom-apq8064.dtsi | 2 +
arch/arm/boot/dts/qcom-ipq8064.dtsi | 2 +
arch/arm/boot/dts/qcom-msm8660.dtsi | 4 +-
drivers/clk/qcom/clk-rpm.c | 24 ++++--
drivers/clk/qcom/gcc-ipq806x.c | 8 --
6 files changed, 106 insertions(+), 19 deletions(-)

--
2.36.1


2022-07-06 22:58:23

by Christian Marangi

[permalink] [raw]
Subject: [PATCH v2 1/4] dt-bindings: clock: fix wrong clock documentation for qcom,rpmcc

qcom,rpmcc describe 2 different kind of device.
Currently we have definition for rpm-smd based device but we lack
Documentation for simple rpm based device.

Add the missing clk for ipq806x, apq8060, msm8660 and apq8064 and
provide additional example to describe these new simple rpm based
devices.

Signed-off-by: Christian Marangi <[email protected]>
---
.../devicetree/bindings/clock/qcom,rpmcc.yaml | 85 ++++++++++++++++++-
1 file changed, 83 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml
index 9d296b89a8d0..d63b45ad06e8 100644
--- a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml
+++ b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml
@@ -49,15 +49,86 @@ properties:
const: 1

clocks:
- maxItems: 1
+ minItems: 1
+ maxItems: 2

clock-names:
- const: xo
+ minItems: 1
+ maxItems: 2

required:
- compatible
- '#clock-cells'

+allOf:
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - qcom,rpmcc-apq8060
+ - qcom,rpmcc-ipq806x
+ - qcom,rpmcc-msm8660
+
+ then:
+ properties:
+ clocks:
+ items:
+ - description: pxo clock
+
+ clock-names:
+ items:
+ - const: pxo
+
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: qcom,rpmcc-apq8064
+ then:
+ properties:
+ clocks:
+ items:
+ - description: pxo clock
+ - description: cxo clock
+
+ clock-names:
+ items:
+ - const: pxo
+ - const: cxo
+
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - qcom,rpmcc-mdm9607
+ - qcom,rpmcc-msm8226
+ - qcom,rpmcc-msm8916
+ - qcom,rpmcc-msm8936
+ - qcom,rpmcc-msm8953
+ - qcom,rpmcc-msm8974
+ - qcom,rpmcc-msm8976
+ - qcom,rpmcc-msm8992
+ - qcom,rpmcc-msm8994
+ - qcom,rpmcc-msm8996
+ - qcom,rpmcc-msm8998
+ - qcom,rpmcc-qcm2290
+ - qcom,rpmcc-qcs404
+ - qcom,rpmcc-sdm660
+ - qcom,rpmcc-sm6115
+ - qcom,rpmcc-sm6125
+
+ then:
+ properties:
+ clocks:
+ items:
+ - description: xo clock
+
+ clock-names:
+ items:
+ - const: xo
+
additionalProperties: false

examples:
@@ -73,3 +144,13 @@ examples:
};
};
};
+
+ - |
+ rpm {
+ clock-controller {
+ compatible = "qcom,rpmcc-ipq806x", "qcom,rpmcc";
+ #clock-cells = <1>;
+ clocks = <&pxo_board>;
+ clock-names = "pxo";
+ };
+ };
--
2.36.1

2022-07-06 22:58:25

by Christian Marangi

[permalink] [raw]
Subject: [PATCH v2 2/4] ARM: DTS: qcom: add rpmcc missing clocks for apq/ipq8064 and msm8660

Add missing rpmcc pxo and cxo clock for apq8064, ipq8064 and
msm8660 dtsi.

Signed-off-by: Christian Marangi <[email protected]>
Reviewed-by: Dmitry Baryshkov <[email protected]>
---
arch/arm/boot/dts/qcom-apq8064.dtsi | 2 ++
arch/arm/boot/dts/qcom-ipq8064.dtsi | 2 ++
arch/arm/boot/dts/qcom-msm8660.dtsi | 4 +++-
3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/qcom-apq8064.dtsi b/arch/arm/boot/dts/qcom-apq8064.dtsi
index 91adcbd54b17..6a88e616ea01 100644
--- a/arch/arm/boot/dts/qcom-apq8064.dtsi
+++ b/arch/arm/boot/dts/qcom-apq8064.dtsi
@@ -853,6 +853,8 @@ rpm@108000 {
rpmcc: clock-controller {
compatible = "qcom,rpmcc-apq8064", "qcom,rpmcc";
#clock-cells = <1>;
+ clocks = <&pxo_board>, <&cxo_board>;
+ clock-names = "pxo", "cxo";
};

regulators {
diff --git a/arch/arm/boot/dts/qcom-ipq8064.dtsi b/arch/arm/boot/dts/qcom-ipq8064.dtsi
index 4b475d98343c..1425a4e4283f 100644
--- a/arch/arm/boot/dts/qcom-ipq8064.dtsi
+++ b/arch/arm/boot/dts/qcom-ipq8064.dtsi
@@ -773,6 +773,8 @@ rpm: rpm@108000 {
rpmcc: clock-controller {
compatible = "qcom,rpmcc-ipq806x", "qcom,rpmcc";
#clock-cells = <1>;
+ clocks = <&pxo_board>;
+ clock-names = "pxo";
};
};

diff --git a/arch/arm/boot/dts/qcom-msm8660.dtsi b/arch/arm/boot/dts/qcom-msm8660.dtsi
index b9cded35b1cc..63a501c63cf8 100644
--- a/arch/arm/boot/dts/qcom-msm8660.dtsi
+++ b/arch/arm/boot/dts/qcom-msm8660.dtsi
@@ -56,7 +56,7 @@ cxo_board {
clock-frequency = <19200000>;
};

- pxo_board {
+ pxo_board: pxo_board {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <27000000>;
@@ -411,6 +411,8 @@ rpm: rpm@104000 {
rpmcc: clock-controller {
compatible = "qcom,rpmcc-msm8660", "qcom,rpmcc";
#clock-cells = <1>;
+ clocks = <&pxo_board>;
+ clock-names = "pxo";
};

pm8901-regulators {
--
2.36.1

2022-07-06 22:58:49

by Christian Marangi

[permalink] [raw]
Subject: [PATCH v2 3/4] clk: qcom: clk-rpm: convert to parent_data API

Convert clk-rpm driver to parent_data API.
We keep the old pxo/cxo_board parent naming to keep compatibility with
old DT and we use the new pxo/cxo for new implementation where these
clock are defined in DTS.

Signed-off-by: Christian Marangi <[email protected]>
---
drivers/clk/qcom/clk-rpm.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/clk/qcom/clk-rpm.c b/drivers/clk/qcom/clk-rpm.c
index a18811c38018..747c473b0b5e 100644
--- a/drivers/clk/qcom/clk-rpm.c
+++ b/drivers/clk/qcom/clk-rpm.c
@@ -23,6 +23,14 @@
#define QCOM_RPM_SCALING_ENABLE_ID 0x2
#define QCOM_RPM_XO_MODE_ON 0x2

+static const struct clk_parent_data gcc_pxo[] = {
+ { .fw_name = "pxo", .name = "pxo_board" },
+};
+
+static const struct clk_parent_data gcc_cxo[] = {
+ { .fw_name = "cxo", .name = "cxo_board" },
+};
+
#define DEFINE_CLK_RPM(_platform, _name, _active, r_id) \
static struct clk_rpm _platform##_##_active; \
static struct clk_rpm _platform##_##_name = { \
@@ -32,8 +40,8 @@
.hw.init = &(struct clk_init_data){ \
.ops = &clk_rpm_ops, \
.name = #_name, \
- .parent_names = (const char *[]){ "pxo_board" }, \
- .num_parents = 1, \
+ .parent_data = gcc_pxo, \
+ .num_parents = ARRAY_SIZE(gcc_pxo), \
}, \
}; \
static struct clk_rpm _platform##_##_active = { \
@@ -44,8 +52,8 @@
.hw.init = &(struct clk_init_data){ \
.ops = &clk_rpm_ops, \
.name = #_active, \
- .parent_names = (const char *[]){ "pxo_board" }, \
- .num_parents = 1, \
+ .parent_data = gcc_pxo, \
+ .num_parents = ARRAY_SIZE(gcc_pxo), \
}, \
}

@@ -56,8 +64,8 @@
.hw.init = &(struct clk_init_data){ \
.ops = &clk_rpm_xo_ops, \
.name = #_name, \
- .parent_names = (const char *[]){ "cxo_board" }, \
- .num_parents = 1, \
+ .parent_data = gcc_cxo, \
+ .num_parents = ARRAY_SIZE(gcc_cxo), \
}, \
}

@@ -68,8 +76,8 @@
.hw.init = &(struct clk_init_data){ \
.ops = &clk_rpm_fixed_ops, \
.name = #_name, \
- .parent_names = (const char *[]){ "pxo" }, \
- .num_parents = 1, \
+ .parent_data = gcc_pxo, \
+ .num_parents = ARRAY_SIZE(gcc_pxo), \
}, \
}

--
2.36.1

2022-07-06 23:14:12

by Christian Marangi

[permalink] [raw]
Subject: [PATCH v2 4/4] clk: qcom: gcc-ipq806x: remove cc_register_board for pxo and cxo

Now that these clock are defined as fixed clk in dts, we can drop the
register_board_clk for cxo_board and pxo_board in gcc_ipq806x_probe.

Signed-off-by: Christian Marangi <[email protected]>
---
drivers/clk/qcom/gcc-ipq806x.c | 8 --------
1 file changed, 8 deletions(-)

diff --git a/drivers/clk/qcom/gcc-ipq806x.c b/drivers/clk/qcom/gcc-ipq806x.c
index 718de17a1e60..883629de2751 100644
--- a/drivers/clk/qcom/gcc-ipq806x.c
+++ b/drivers/clk/qcom/gcc-ipq806x.c
@@ -3384,14 +3384,6 @@ static int gcc_ipq806x_probe(struct platform_device *pdev)
struct regmap *regmap;
int ret;

- ret = qcom_cc_register_board_clk(dev, "cxo_board", "cxo", 25000000);
- if (ret)
- return ret;
-
- ret = qcom_cc_register_board_clk(dev, "pxo_board", "pxo", 25000000);
- if (ret)
- return ret;
-
if (of_machine_is_compatible("qcom,ipq8065")) {
ubi32_core1_src_clk.freq_tbl = clk_tbl_nss_ipq8065;
ubi32_core2_src_clk.freq_tbl = clk_tbl_nss_ipq8065;
--
2.36.1

2022-07-11 19:18:14

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH v2 1/4] dt-bindings: clock: fix wrong clock documentation for qcom,rpmcc

On Thu, 07 Jul 2022 00:53:18 +0200, Christian Marangi wrote:
> qcom,rpmcc describe 2 different kind of device.
> Currently we have definition for rpm-smd based device but we lack
> Documentation for simple rpm based device.
>
> Add the missing clk for ipq806x, apq8060, msm8660 and apq8064 and
> provide additional example to describe these new simple rpm based
> devices.
>
> Signed-off-by: Christian Marangi <[email protected]>
> ---
> .../devicetree/bindings/clock/qcom,rpmcc.yaml | 85 ++++++++++++++++++-
> 1 file changed, 83 insertions(+), 2 deletions(-)
>

Reviewed-by: Rob Herring <[email protected]>

2022-07-19 00:15:37

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH v2 4/4] clk: qcom: gcc-ipq806x: remove cc_register_board for pxo and cxo

On Wed 06 Jul 17:53 CDT 2022, Christian Marangi wrote:

> Now that these clock are defined as fixed clk in dts, we can drop the
> register_board_clk for cxo_board and pxo_board in gcc_ipq806x_probe.
>

Are you trying to say, that now that we have .fw_name based lookup of
these clocks we don't need the globally registered [cp]xo clocks to
bridge towards the [cp]xo_board_clocks which was introduced in:

30fc4212d541 ("arm: dts: qcom: Add more board clocks")

I think this change would work out if you also replace .name = "pxo"
with .name = "pxo_board_clk" (and same for cxo)...


But I don't think we can just drop these, as it would break
compatibility with existing devicetree.

Regards,
Bjorn

> Signed-off-by: Christian Marangi <[email protected]>
> ---
> drivers/clk/qcom/gcc-ipq806x.c | 8 --------
> 1 file changed, 8 deletions(-)
>
> diff --git a/drivers/clk/qcom/gcc-ipq806x.c b/drivers/clk/qcom/gcc-ipq806x.c
> index 718de17a1e60..883629de2751 100644
> --- a/drivers/clk/qcom/gcc-ipq806x.c
> +++ b/drivers/clk/qcom/gcc-ipq806x.c
> @@ -3384,14 +3384,6 @@ static int gcc_ipq806x_probe(struct platform_device *pdev)
> struct regmap *regmap;
> int ret;
>
> - ret = qcom_cc_register_board_clk(dev, "cxo_board", "cxo", 25000000);
> - if (ret)
> - return ret;
> -
> - ret = qcom_cc_register_board_clk(dev, "pxo_board", "pxo", 25000000);
> - if (ret)
> - return ret;
> -
> if (of_machine_is_compatible("qcom,ipq8065")) {
> ubi32_core1_src_clk.freq_tbl = clk_tbl_nss_ipq8065;
> ubi32_core2_src_clk.freq_tbl = clk_tbl_nss_ipq8065;
> --
> 2.36.1
>

2022-07-19 02:39:07

by Christian Marangi

[permalink] [raw]
Subject: Re: [PATCH v2 4/4] clk: qcom: gcc-ipq806x: remove cc_register_board for pxo and cxo

On Mon, Jul 18, 2022 at 07:12:47PM -0500, Bjorn Andersson wrote:
> On Wed 06 Jul 17:53 CDT 2022, Christian Marangi wrote:
>
> > Now that these clock are defined as fixed clk in dts, we can drop the
> > register_board_clk for cxo_board and pxo_board in gcc_ipq806x_probe.
> >
>
> Are you trying to say, that now that we have .fw_name based lookup of
> these clocks we don't need the globally registered [cp]xo clocks to
> bridge towards the [cp]xo_board_clocks which was introduced in:
>
> 30fc4212d541 ("arm: dts: qcom: Add more board clocks")
>
> I think this change would work out if you also replace .name = "pxo"
> with .name = "pxo_board_clk" (and same for cxo)...
>

Mhhh why pxo_board_clk? Why _clk? It should be pxo_board.
Anyway about this, only the rpm clocks use pxo_board as parent,
everything else use pxo. Aside from rpm and gcc the other user of pxo is
the lcc driver and the krait-xcc clock. I sent patches to convert them.

>
> But I don't think we can just drop these, as it would break
> compatibility with existing devicetree.

Wonder if we will be able to drop this ever?

> > Signed-off-by: Christian Marangi <[email protected]>
> > ---
> > drivers/clk/qcom/gcc-ipq806x.c | 8 --------
> > 1 file changed, 8 deletions(-)
> >
> > diff --git a/drivers/clk/qcom/gcc-ipq806x.c b/drivers/clk/qcom/gcc-ipq806x.c
> > index 718de17a1e60..883629de2751 100644
> > --- a/drivers/clk/qcom/gcc-ipq806x.c
> > +++ b/drivers/clk/qcom/gcc-ipq806x.c
> > @@ -3384,14 +3384,6 @@ static int gcc_ipq806x_probe(struct platform_device *pdev)
> > struct regmap *regmap;
> > int ret;
> >
> > - ret = qcom_cc_register_board_clk(dev, "cxo_board", "cxo", 25000000);
> > - if (ret)
> > - return ret;
> > -
> > - ret = qcom_cc_register_board_clk(dev, "pxo_board", "pxo", 25000000);
> > - if (ret)
> > - return ret;
> > -
> > if (of_machine_is_compatible("qcom,ipq8065")) {
> > ubi32_core1_src_clk.freq_tbl = clk_tbl_nss_ipq8065;
> > ubi32_core2_src_clk.freq_tbl = clk_tbl_nss_ipq8065;
> > --
> > 2.36.1
> >

--
Ansuel

2022-07-19 05:06:50

by Bjorn Andersson

[permalink] [raw]
Subject: Re: (subset) [PATCH v2 0/4] clk: qcom: Drop use of pxo/cxo_board for rpm devices

On Thu, 7 Jul 2022 00:53:17 +0200, Christian Marangi wrote:
> Trying to convert every driver used by ipq806x to parent_data api, I notice
> RPM was still using pxo_board clk.
>
> pxo and pxo_board are the same clock and are defined just to handle old
> clock definition. It was discovered that rpm is the last driver using
> pxo_board instead of pxo.
>
> [...]

Applied, thanks!

[2/4] ARM: DTS: qcom: add rpmcc missing clocks for apq/ipq8064 and msm8660
commit: aa7fd3bb6017b343585e97a909f9b7d2fe174018

Best regards,
--
Bjorn Andersson <[email protected]>