clk: qcom: Add support for SM8150
v2 cover clk: qcom: Add support for SM8150
Add support for rpm clock controller found in SM8150 and while at it update the driver to support parent data clock scheme as suggested by Stephen.
Changes since v2:
- Describe parent clocks for rpmhcc
- Add support for parent data scheme for rpmhcc
Vinod Koul (4):
dt-bindings: clock: Document the parent clocks
clk: qcom: clk-rpmh: Convert to parent data scheme
dt-bindings: clock: Document SM8150 rpmh-clock compatible
clk: qcom: clk-rpmh: Add support for SM8150
.../bindings/clock/qcom,rpmh-clk.txt | 7 +++- drivers/clk/qcom/clk-rpmh.c | 37 ++++++++++++++++++- 2 files changed, 41 insertions(+), 3 deletions(-)
Signature · 1 line
2.20.1
PATCH v2 1/4 dt-bindings: clock: Document the parent clocks
With clock parent data scheme we must specify the parent clocks for the rpmhcc nodes. So describe the parent clock for rpmhcc in the bindings.
--- Documentation/devicetree/bindings/clock/qcom,rpmh-clk.txt | 3 +++ 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/clock/qcom,rpmh-clk.txt +3 -0
@@ -9,6 +9,9 @@ Required properties : - compatible : shall contain "qcom,sdm845-rpmh-clk" - #clock-cells : must contain 1 +- clocks: a list of phandles and clock-specifier pairs, + one for each entry in clock-names. +- clock-names: Parent board clock: "xo". Example :
Signature · 1 line
2.20.1
PATCH v2 2/4 clk: qcom: clk-rpmh: Convert to parent data scheme
In reply to Vinod KoulConvert the rpmh clock driver to use the new parent data scheme by specifying the parent data for board clock.
--- drivers/clk/qcom/clk-rpmh.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/clk/qcom/clk-rpmh.c +8 -2
@@ -95,7 +95,10 @@ static DEFINE_MUTEX(rpmh_clk_lock); .hw.init = &(struct clk_init_data){ \ .ops = &clk_rpmh_ops, \ .name = #_name, \ - .parent_names = (const char *[]){"xo_board" }, \ + .parent_data = &(const struct clk_parent_data ){ \ + .fw_name ="xo" , \ + .name ="xo" , \ + }, \ .num_parents =1 , \ }, \ }; \
@@ -110,7 +113,10 @@ static DEFINE_MUTEX(rpmh_clk_lock); .hw.init = &(struct clk_init_data){ \ .ops = &clk_rpmh_ops, \ .name = #_name_active, \ - .parent_names = (const char *[]){"xo_board" }, \ + .parent_data = &(const struct clk_parent_data ){ \ + .fw_name ="xo" , \ + .name ="xo" , \ + }, \ .num_parents =1 , \ }, \ }
Signature · 1 line
2.20.1
PATCH v2 3/4 dt-bindings: clock: Document SM8150 rpmh-clock compatible
In reply to Vinod KoulDocument the SM8150 rpmh-clock compatible for rpmh clock controller found on SM8150 platforms.
--- Documentation/devicetree/bindings/clock/qcom,rpmh-clk.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/clock/qcom,rpmh-clk.txt +3 -1
@@ -6,7 +6,9 @@ some Qualcomm Technologies Inc. SoCs. It accepts clock requests from other hardware subsystems via RSC to control clocks. Required properties : -- compatible : shall contain "qcom,sdm845-rpmh-clk" +- compatible : must be one of: + "qcom,sdm845-rpmh-clk" + "qcom,sm8150-rpmh-clk" - #clock-cells : must contain 1 - clocks: a list of phandles and clock-specifier pairs,
Signature · 1 line
2.20.1
PATCH v2 4/4 clk: qcom: clk-rpmh: Add support for SM8150
In reply to Vinod KoulAdd support for rpmh clocks found in SM8150
--- drivers/clk/qcom/clk-rpmh.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/clk/qcom/clk-rpmh.c +27 -0
@@ -374,6 +374,32 @@ static const struct clk_rpmh_desc clk_rpmh_sdm845 = { .num_clks = ARRAY_SIZE(sdm845_rpmh_clocks), }; +DEFINE_CLK_RPMH_ARC (sm8150, bi_tcxo, bi_tcxo_ao,"xo.lvl" ,0x3 ,2 ); +DEFINE_CLK_RPMH_VRM (sm8150, ln_bb_clk2, ln_bb_clk2_ao,"lnbclka2" ,2 ); +DEFINE_CLK_RPMH_VRM (sm8150, ln_bb_clk3, ln_bb_clk3_ao,"lnbclka3" ,2 ); +DEFINE_CLK_RPMH_VRM (sm8150, rf_clk1, rf_clk1_ao,"rfclka1" ,1 ); +DEFINE_CLK_RPMH_VRM (sm8150, rf_clk2, rf_clk2_ao,"rfclka2" ,1 ); +DEFINE_CLK_RPMH_VRM (sm8150, rf_clk3, rf_clk3_ao,"rfclka3" ,1 ); + +static struct clk_hw *sm8150_rpmh_clocks[] = { + [RPMH_CXO_CLK ] = &sm8150_bi_tcxo.hw, + [RPMH_CXO_CLK_A ] = &sm8150_bi_tcxo_ao.hw, + [RPMH_LN_BB_CLK2 ] = &sm8150_ln_bb_clk2.hw, + [RPMH_LN_BB_CLK2_A ] = &sm8150_ln_bb_clk2_ao.hw, + [RPMH_LN_BB_CLK3 ] = &sm8150_ln_bb_clk3.hw, + [RPMH_LN_BB_CLK3_A ] = &sm8150_ln_bb_clk3_ao.hw, + [RPMH_RF_CLK1 ] = &sm8150_rf_clk1.hw, + [RPMH_RF_CLK1_A ] = &sm8150_rf_clk1_ao.hw, + [RPMH_RF_CLK2 ] = &sm8150_rf_clk2.hw, + [RPMH_RF_CLK2_A ] = &sm8150_rf_clk2_ao.hw, + [RPMH_RF_CLK3 ] = &sm8150_rf_clk3.hw, + [RPMH_RF_CLK3_A ] = &sm8150_rf_clk3_ao.hw, +}; + +static const struct clk_rpmh_desc clk_rpmh_sm8150 = { + .clks = sm8150_rpmh_clocks, + .num_clks =ARRAY_SIZE (sm8150_rpmh_clocks), +};static struct clk_hw *of_clk_rpmh_hw_get (struct of_phandle_args *clkspec,void *data) {
@@ -453,6 +479,7 @@ static int clk_rpmh_probe(struct platform_device *pdev)static const struct of_device_id clk_rpmh_match_table[] = { { .compatible ="qcom,sdm845-rpmh-clk" , .data = &clk_rpmh_sdm845}, + { .compatible ="qcom,sm8150-rpmh-clk" , .data = &clk_rpmh_sm8150}, { } };MODULE_DEVICE_TABLE (of, clk_rpmh_match_table);
Signature · 1 line
2.20.1
Re: [PATCH v2 1/4] dt-bindings: clock: Document the parent clocks
In reply to Vinod KoulQuoted 3 lines · Vinod Koul
With clock parent data scheme we must specify the parent clocks for the rpmhcc nodes. So describe the parent clock for rpmhcc in the bindings.
Quoted 22 lines
Signed-off-by Vinod Koul <[email protected]>--- Documentation/devicetree/bindings/clock/qcom,rpmh-clk.txt | 3 +++ 1 file changed, 3 insertions(+)Documentation/devicetree/bindings/clock/qcom,rpmh-clk.txt +3
-0@@ -9,6 +9,9 @@ Required properties : - compatible : shall contain "qcom,sdm845-rpmh-clk" - #clock-cells : must contain 1 +- clocks: a list of phandles and clock-specifier pairs, + one for each entry in clock-names. +- clock-names: Parent board clock: "xo". Example :Signature · 1 line
2.20.1
Re: [PATCH v2 2/4] clk: qcom: clk-rpmh: Convert to parent data scheme
In reply to Vinod KoulQuoted 13 lines · Vinod Koul
Convert the rpmh clock driver to use the new parent data scheme by specifying the parent data for board clock.
Signed-off-by Vinod Koul <[email protected]>--- drivers/clk/qcom/clk-rpmh.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)drivers/clk/qcom/clk-rpmh.c +0
-0
drivers/clk/qcom/clk-rpmh.c static DEFINE_MUTEX(rpmh_clk_lock); · line 100
Quoted 7 lines
drivers/clk/qcom/clk-rpmh.c +3
-1@@ -95,7 +95,10 @@ static DEFINE_MUTEX(rpmh_clk_lock); .hw.init = &(struct clk_init_data){ \ .ops = &clk_rpmh_ops, \ .name = #_name, \ - .parent_names = (const char *[]){"xo_board" }, \ + .parent_data = &(const struct clk_parent_data ){ \ + .fw_name ="xo" , \ + .name ="xo" , \
Shouldn't .name be "xo_board" to retain backwards compatibility?
Regards,
Bjorn
Quoted 19 lines
drivers/clk/qcom/clk-rpmh.c +5
-1+ }, \ .num_parents = 1, \ }, \ }; \@@ -110,7 +113,10 @@ static DEFINE_MUTEX(rpmh_clk_lock); .hw.init = &(struct clk_init_data){ \ .ops = &clk_rpmh_ops, \ .name = #_name_active, \ - .parent_names = (const char *[]){"xo_board" }, \ + .parent_data = &(const struct clk_parent_data ){ \ + .fw_name ="xo" , \ + .name ="xo" , \ + }, \ .num_parents =1 , \ }, \ }Signature · 1 line
2.20.1
Re: [PATCH v2 3/4] dt-bindings: clock: Document SM8150 rpmh-clock compatible
In reply to Vinod KoulQuoted 4 lines · Vinod Koul
Document the SM8150 rpmh-clock compatible for rpmh clock controller found on SM8150 platforms.
Signed-off-by Vinod Koul <[email protected]>
Quoted 22 lines
--- Documentation/devicetree/bindings/clock/qcom,rpmh-clk.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/clock/qcom,rpmh-clk.txt +3
-1@@ -6,7 +6,9 @@ some Qualcomm Technologies Inc. SoCs. It accepts clock requests from other hardware subsystems via RSC to control clocks. Required properties : -- compatible : shall contain "qcom,sdm845-rpmh-clk" +- compatible : must be one of: + "qcom,sdm845-rpmh-clk" + "qcom,sm8150-rpmh-clk" - #clock-cells : must contain 1 - clocks: a list of phandles and clock-specifier pairs,Signature · 1 line
2.20.1
Re: [PATCH v2 4/4] clk: qcom: clk-rpmh: Add support for SM8150
In reply to Vinod KoulQuoted 31 lines · Vinod Koul
Add support for rpmh clocks found in SM8150
Signed-off-by Vinod Koul <[email protected]>--- drivers/clk/qcom/clk-rpmh.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)drivers/clk/qcom/clk-rpmh.c +16
-0@@ -374,6 +374,32 @@ static const struct clk_rpmh_desc clk_rpmh_sdm845 = { .num_clks = ARRAY_SIZE(sdm845_rpmh_clocks), }; +DEFINE_CLK_RPMH_ARC (sm8150, bi_tcxo, bi_tcxo_ao,"xo.lvl" ,0x3 ,2 ); +DEFINE_CLK_RPMH_VRM (sm8150, ln_bb_clk2, ln_bb_clk2_ao,"lnbclka2" ,2 ); +DEFINE_CLK_RPMH_VRM (sm8150, ln_bb_clk3, ln_bb_clk3_ao,"lnbclka3" ,2 ); +DEFINE_CLK_RPMH_VRM (sm8150, rf_clk1, rf_clk1_ao,"rfclka1" ,1 ); +DEFINE_CLK_RPMH_VRM (sm8150, rf_clk2, rf_clk2_ao,"rfclka2" ,1 ); +DEFINE_CLK_RPMH_VRM (sm8150, rf_clk3, rf_clk3_ao,"rfclka3" ,1 ); + +static struct clk_hw *sm8150_rpmh_clocks[] = { + [RPMH_CXO_CLK ] = &sm8150_bi_tcxo.hw, + [RPMH_CXO_CLK_A ] = &sm8150_bi_tcxo_ao.hw, + [RPMH_LN_BB_CLK2 ] = &sm8150_ln_bb_clk2.hw, + [RPMH_LN_BB_CLK2_A ] = &sm8150_ln_bb_clk2_ao.hw, + [RPMH_LN_BB_CLK3 ] = &sm8150_ln_bb_clk3.hw, + [RPMH_LN_BB_CLK3_A ] = &sm8150_ln_bb_clk3_ao.hw, + [RPMH_RF_CLK1 ] = &sm8150_rf_clk1.hw, + [RPMH_RF_CLK1_A ] = &sm8150_rf_clk1_ao.hw,
drivers/clk/qcom/clk-rpmh.c static const struct clk_rpmh_desc clk_rpmh_sdm845 = { · line 402
Quoted 10 lines
drivers/clk/qcom/clk-rpmh.c +10
-0+ [RPMH_RF_CLK2] = &sm8150_rf_clk2.hw, + [RPMH_RF_CLK2_A] = &sm8150_rf_clk2_ao.hw, + [RPMH_RF_CLK3] = &sm8150_rf_clk3.hw, + [RPMH_RF_CLK3_A] = &sm8150_rf_clk3_ao.hw, +}; + +static const struct clk_rpmh_desc clk_rpmh_sm8150 = { + .clks = sm8150_rpmh_clocks, + .num_clks =ARRAY_SIZE (sm8150_rpmh_clocks), +};
Maybe an empty line here?
drivers/clk/qcom/clk-rpmh.c static int clk_rpmh_probe(struct platform_device *pdev) · line 485
Quoted 11 lines
drivers/clk/qcom/clk-rpmh.c +1
-0static struct clk_hw *of_clk_rpmh_hw_get (struct of_phandle_args *clkspec,void *data) {@@ -453,6 +479,7 @@ static int clk_rpmh_probe(struct platform_device *pdev)static const struct of_device_id clk_rpmh_match_table[] = { { .compatible ="qcom,sdm845-rpmh-clk" , .data = &clk_rpmh_sdm845}, + { .compatible ="qcom,sm8150-rpmh-clk" , .data = &clk_rpmh_sm8150}, { } };MODULE_DEVICE_TABLE (of, clk_rpmh_match_table);
Regards,
Bjorn
Quoted 3 lines
Signature · 1 line
2.20.1
Re: [PATCH v2 2/4] clk: qcom: clk-rpmh: Convert to parent data scheme
In reply to Bjorn AnderssonQuoted 10 lines · Bjorn Andersson
Quoted 8 lines · Vinod Koul
Convert the rpmh clock driver to use the new parent data scheme by specifying the parent data for board clock.
Signed-off-by Vinod Koul <[email protected]>--- drivers/clk/qcom/clk-rpmh.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
Quoted 14 lines
drivers/clk/qcom/clk-rpmh.c static DEFINE_MUTEX(rpmh_clk_lock); · line 100
Quoted 12 lines
drivers/clk/qcom/clk-rpmh.c +3
-1@@ -95,7 +95,10 @@ static DEFINE_MUTEX(rpmh_clk_lock); .hw.init = &(struct clk_init_data){ \ .ops = &clk_rpmh_ops, \ .name = #_name, \ - .parent_names = (const char *[]){"xo_board" }, \ + .parent_data = &(const struct clk_parent_data ){ \ + .fw_name ="xo" , \ + .name ="xo" , \Shouldn't .name be "
xo_board" to retain backwards compatibility?
Yes I have updated that
Thanks
Signature · 1 line
~Vinod
Re: [PATCH v2 4/4] clk: qcom: clk-rpmh: Add support for SM8150
In reply to Bjorn AnderssonQuoted 7 lines · Bjorn Andersson
drivers/clk/qcom/clk-rpmh.c static const struct clk_rpmh_desc clk_rpmh_sdm845 = { · line 402
Quoted 4 lines · Vinod Koul
drivers/clk/qcom/clk-rpmh.c +4
-0+static const struct clk_rpmh_desc clk_rpmh_sm8150 = { + .clks = sm8150_rpmh_clocks, + .num_clks =ARRAY_SIZE (sm8150_rpmh_clocks), +};Maybe an empty line here?
Sounds better
Quoted 6 lines
Quoted 6 lines
static struct
clk_hw*of_clk_rpmh_hw_get(structof_phandle_args*clkspec,drivers/clk/qcom/clk-rpmh.c +0
-0void *data) {@@ -453,6 +479,7 @@ static int clk_rpmh_probe(struct platform_device *pdev)
Quoted 8 lines
drivers/clk/qcom/clk-rpmh.c static int clk_rpmh_probe(struct platform_device *pdev) · line 485
Quoted 6 lines
drivers/clk/qcom/clk-rpmh.c +1
-0static const struct of_device_id clk_rpmh_match_table[] = { { .compatible ="qcom,sdm845-rpmh-clk" , .data = &clk_rpmh_sdm845}, + { .compatible ="qcom,sm8150-rpmh-clk" , .data = &clk_rpmh_sm8150}, { } };MODULE_DEVICE_TABLE (of, clk_rpmh_match_table);Reviewed-by Bjorn Andersson <[email protected]>
Thanks for the review, will send an update.
Signature · 1 line
~Vinod