Commit 6e2bfc35 authored by Alexandre Mergnat's avatar Alexandre Mergnat Committed by Jerome Brunet

clk: meson: gxbb-aoclk: migrate to the new parent description method

This clock controller use the string comparison method to describe parent
relation between the clocks, which is not optimized.

Migrate to the new way by using .parent_hws where possible (when parent
clocks are localy declared in the controller) and use .parent_data
otherwise.

Remove clk input helper and all bypass clocks (declared in probe function)
which are no longer used since we are able to use device-tree clock name
directly.
Signed-off-by: default avatarAlexandre Mergnat <amergnat@baylibre.com>
Signed-off-by: default avatarJerome Brunet <jbrunet@baylibre.com>
parent ba626081
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
#include "clk-regmap.h" #include "clk-regmap.h"
#include "clk-dualdiv.h" #include "clk-dualdiv.h"
#define IN_PREFIX "ao-in-"
/* AO Configuration Clock registers offsets */ /* AO Configuration Clock registers offsets */
#define AO_RTI_PWR_CNTL_REG1 0x0c #define AO_RTI_PWR_CNTL_REG1 0x0c
#define AO_RTI_PWR_CNTL_REG0 0x10 #define AO_RTI_PWR_CNTL_REG0 0x10
...@@ -31,7 +29,9 @@ static struct clk_regmap _name##_ao = { \ ...@@ -31,7 +29,9 @@ static struct clk_regmap _name##_ao = { \
.hw.init = &(struct clk_init_data) { \ .hw.init = &(struct clk_init_data) { \
.name = #_name "_ao", \ .name = #_name "_ao", \
.ops = &clk_regmap_gate_ops, \ .ops = &clk_regmap_gate_ops, \
.parent_names = (const char *[]){ IN_PREFIX "mpeg-clk" }, \ .parent_data = &(const struct clk_parent_data) { \
.fw_name = "mpeg-clk", \
}, \
.num_parents = 1, \ .num_parents = 1, \
.flags = CLK_IGNORE_UNUSED, \ .flags = CLK_IGNORE_UNUSED, \
}, \ }, \
...@@ -52,7 +52,9 @@ static struct clk_regmap ao_cts_oscin = { ...@@ -52,7 +52,9 @@ static struct clk_regmap ao_cts_oscin = {
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "ao_cts_oscin", .name = "ao_cts_oscin",
.ops = &clk_regmap_gate_ro_ops, .ops = &clk_regmap_gate_ro_ops,
.parent_names = (const char *[]){ IN_PREFIX "xtal" }, .parent_data = &(const struct clk_parent_data) {
.fw_name = "xtal",
},
.num_parents = 1, .num_parents = 1,
}, },
}; };
...@@ -65,7 +67,7 @@ static struct clk_regmap ao_32k_pre = { ...@@ -65,7 +67,7 @@ static struct clk_regmap ao_32k_pre = {
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "ao_32k_pre", .name = "ao_32k_pre",
.ops = &clk_regmap_gate_ops, .ops = &clk_regmap_gate_ops,
.parent_names = (const char *[]){ "ao_cts_oscin" }, .parent_hws = (const struct clk_hw *[]) { &ao_cts_oscin.hw },
.num_parents = 1, .num_parents = 1,
}, },
}; };
...@@ -112,7 +114,7 @@ static struct clk_regmap ao_32k_div = { ...@@ -112,7 +114,7 @@ static struct clk_regmap ao_32k_div = {
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "ao_32k_div", .name = "ao_32k_div",
.ops = &meson_clk_dualdiv_ops, .ops = &meson_clk_dualdiv_ops,
.parent_names = (const char *[]){ "ao_32k_pre" }, .parent_hws = (const struct clk_hw *[]) { &ao_32k_pre.hw },
.num_parents = 1, .num_parents = 1,
}, },
}; };
...@@ -127,8 +129,10 @@ static struct clk_regmap ao_32k_sel = { ...@@ -127,8 +129,10 @@ static struct clk_regmap ao_32k_sel = {
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "ao_32k_sel", .name = "ao_32k_sel",
.ops = &clk_regmap_mux_ops, .ops = &clk_regmap_mux_ops,
.parent_names = (const char *[]){ "ao_32k_div", .parent_hws = (const struct clk_hw *[]) {
"ao_32k_pre" }, &ao_32k_div.hw,
&ao_32k_pre.hw
},
.num_parents = 2, .num_parents = 2,
.flags = CLK_SET_RATE_PARENT, .flags = CLK_SET_RATE_PARENT,
}, },
...@@ -142,7 +146,7 @@ static struct clk_regmap ao_32k = { ...@@ -142,7 +146,7 @@ static struct clk_regmap ao_32k = {
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "ao_32k", .name = "ao_32k",
.ops = &clk_regmap_gate_ops, .ops = &clk_regmap_gate_ops,
.parent_names = (const char *[]){ "ao_32k_sel" }, .parent_hws = (const struct clk_hw *[]) { &ao_32k_sel.hw },
.num_parents = 1, .num_parents = 1,
.flags = CLK_SET_RATE_PARENT, .flags = CLK_SET_RATE_PARENT,
}, },
...@@ -159,10 +163,12 @@ static struct clk_regmap ao_cts_rtc_oscin = { ...@@ -159,10 +163,12 @@ static struct clk_regmap ao_cts_rtc_oscin = {
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "ao_cts_rtc_oscin", .name = "ao_cts_rtc_oscin",
.ops = &clk_regmap_mux_ops, .ops = &clk_regmap_mux_ops,
.parent_names = (const char *[]){ IN_PREFIX "ext-32k-0", .parent_data = (const struct clk_parent_data []) {
IN_PREFIX "ext-32k-1", { .fw_name = "ext-32k-0", },
IN_PREFIX "ext-32k-2", { .fw_name = "ext-32k-1", },
"ao_32k" }, { .fw_name = "ext-32k-2", },
{ .hw = &ao_32k.hw },
},
.num_parents = 4, .num_parents = 4,
.flags = CLK_SET_RATE_PARENT, .flags = CLK_SET_RATE_PARENT,
}, },
...@@ -178,8 +184,10 @@ static struct clk_regmap ao_clk81 = { ...@@ -178,8 +184,10 @@ static struct clk_regmap ao_clk81 = {
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "ao_clk81", .name = "ao_clk81",
.ops = &clk_regmap_mux_ro_ops, .ops = &clk_regmap_mux_ro_ops,
.parent_names = (const char *[]){ IN_PREFIX "mpeg-clk", .parent_data = (const struct clk_parent_data []) {
"ao_cts_rtc_oscin" }, { .fw_name = "mpeg-clk", },
{ .hw = &ao_cts_rtc_oscin.hw },
},
.num_parents = 2, .num_parents = 2,
.flags = CLK_SET_RATE_PARENT, .flags = CLK_SET_RATE_PARENT,
}, },
...@@ -208,8 +216,10 @@ static struct clk_regmap ao_cts_cec = { ...@@ -208,8 +216,10 @@ static struct clk_regmap ao_cts_cec = {
* Until CCF gets fixed, adding this fake parent that won't * Until CCF gets fixed, adding this fake parent that won't
* ever be registered should work around the problem * ever be registered should work around the problem
*/ */
.parent_names = (const char *[]){ "fixme", .parent_data = (const struct clk_parent_data []) {
"ao_cts_rtc_oscin" }, { .name = "fixme", .index = -1, },
{ .hw = &ao_cts_rtc_oscin.hw },
},
.num_parents = 2, .num_parents = 2,
.flags = CLK_SET_RATE_PARENT, .flags = CLK_SET_RATE_PARENT,
}, },
...@@ -261,14 +271,6 @@ static const struct clk_hw_onecell_data gxbb_aoclk_onecell_data = { ...@@ -261,14 +271,6 @@ static const struct clk_hw_onecell_data gxbb_aoclk_onecell_data = {
.num = NR_CLKS, .num = NR_CLKS,
}; };
static const struct meson_aoclk_input gxbb_aoclk_inputs[] = {
{ .name = "xtal", .required = true, },
{ .name = "mpeg-clk", .required = true, },
{. name = "ext-32k-0", .required = false, },
{. name = "ext-32k-1", .required = false, },
{. name = "ext-32k-2", .required = false, },
};
static const struct meson_aoclk_data gxbb_aoclkc_data = { static const struct meson_aoclk_data gxbb_aoclkc_data = {
.reset_reg = AO_RTI_GEN_CNTL_REG0, .reset_reg = AO_RTI_GEN_CNTL_REG0,
.num_reset = ARRAY_SIZE(gxbb_aoclk_reset), .num_reset = ARRAY_SIZE(gxbb_aoclk_reset),
...@@ -276,9 +278,6 @@ static const struct meson_aoclk_data gxbb_aoclkc_data = { ...@@ -276,9 +278,6 @@ static const struct meson_aoclk_data gxbb_aoclkc_data = {
.num_clks = ARRAY_SIZE(gxbb_aoclk), .num_clks = ARRAY_SIZE(gxbb_aoclk),
.clks = gxbb_aoclk, .clks = gxbb_aoclk,
.hw_data = &gxbb_aoclk_onecell_data, .hw_data = &gxbb_aoclk_onecell_data,
.inputs = gxbb_aoclk_inputs,
.num_inputs = ARRAY_SIZE(gxbb_aoclk_inputs),
.input_prefix = IN_PREFIX,
}; };
static const struct of_device_id gxbb_aoclkc_match_table[] = { static const struct of_device_id gxbb_aoclkc_match_table[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment