Commit 2513a28c authored by Jerome Brunet's avatar Jerome Brunet Committed by Neil Armstrong

clk: meson: migrate muxes to clk_regmap

Move meson8b, gxbb and axg clocks using clk_mux to clk_regmap
Also remove a few useless tables in the process
Signed-off-by: default avatarJerome Brunet <jbrunet@baylibre.com>
Signed-off-by: default avatarNeil Armstrong <narmstrong@baylibre.com>
parent f06ddd28
...@@ -418,16 +418,16 @@ static const char * const clk81_parent_names[] = { ...@@ -418,16 +418,16 @@ static const char * const clk81_parent_names[] = {
"fclk_div3", "fclk_div5" "fclk_div3", "fclk_div5"
}; };
static struct clk_mux axg_mpeg_clk_sel = { static struct clk_regmap axg_mpeg_clk_sel = {
.reg = (void *)HHI_MPEG_CLK_CNTL, .data = &(struct clk_regmap_mux_data){
.mask = 0x7, .offset = HHI_MPEG_CLK_CNTL,
.shift = 12, .mask = 0x7,
.flags = CLK_MUX_READ_ONLY, .shift = 12,
.table = mux_table_clk81, .table = mux_table_clk81,
.lock = &meson_clk_lock, },
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "mpeg_clk_sel", .name = "mpeg_clk_sel",
.ops = &clk_mux_ro_ops, .ops = &clk_regmap_mux_ro_ops,
.parent_names = clk81_parent_names, .parent_names = clk81_parent_names,
.num_parents = ARRAY_SIZE(clk81_parent_names), .num_parents = ARRAY_SIZE(clk81_parent_names),
}, },
...@@ -474,14 +474,15 @@ static const char * const axg_sd_emmc_clk0_parent_names[] = { ...@@ -474,14 +474,15 @@ static const char * const axg_sd_emmc_clk0_parent_names[] = {
}; };
/* SDcard clock */ /* SDcard clock */
static struct clk_mux axg_sd_emmc_b_clk0_sel = { static struct clk_regmap axg_sd_emmc_b_clk0_sel = {
.reg = (void *)HHI_SD_EMMC_CLK_CNTL, .data = &(struct clk_regmap_mux_data){
.mask = 0x7, .offset = HHI_SD_EMMC_CLK_CNTL,
.shift = 25, .mask = 0x7,
.lock = &meson_clk_lock, .shift = 25,
},
.hw.init = &(struct clk_init_data) { .hw.init = &(struct clk_init_data) {
.name = "sd_emmc_b_clk0_sel", .name = "sd_emmc_b_clk0_sel",
.ops = &clk_mux_ops, .ops = &clk_regmap_mux_ops,
.parent_names = axg_sd_emmc_clk0_parent_names, .parent_names = axg_sd_emmc_clk0_parent_names,
.num_parents = ARRAY_SIZE(axg_sd_emmc_clk0_parent_names), .num_parents = ARRAY_SIZE(axg_sd_emmc_clk0_parent_names),
.flags = CLK_SET_RATE_PARENT, .flags = CLK_SET_RATE_PARENT,
...@@ -519,14 +520,15 @@ static struct clk_regmap axg_sd_emmc_b_clk0 = { ...@@ -519,14 +520,15 @@ static struct clk_regmap axg_sd_emmc_b_clk0 = {
}; };
/* EMMC/NAND clock */ /* EMMC/NAND clock */
static struct clk_mux axg_sd_emmc_c_clk0_sel = { static struct clk_regmap axg_sd_emmc_c_clk0_sel = {
.reg = (void *)HHI_NAND_CLK_CNTL, .data = &(struct clk_regmap_mux_data){
.mask = 0x7, .offset = HHI_NAND_CLK_CNTL,
.shift = 9, .mask = 0x7,
.lock = &meson_clk_lock, .shift = 9,
},
.hw.init = &(struct clk_init_data) { .hw.init = &(struct clk_init_data) {
.name = "sd_emmc_c_clk0_sel", .name = "sd_emmc_c_clk0_sel",
.ops = &clk_mux_ops, .ops = &clk_regmap_mux_ops,
.parent_names = axg_sd_emmc_clk0_parent_names, .parent_names = axg_sd_emmc_clk0_parent_names,
.num_parents = ARRAY_SIZE(axg_sd_emmc_clk0_parent_names), .num_parents = ARRAY_SIZE(axg_sd_emmc_clk0_parent_names),
.flags = CLK_SET_RATE_PARENT, .flags = CLK_SET_RATE_PARENT,
...@@ -703,12 +705,6 @@ static struct meson_clk_mpll *const axg_clk_mplls[] = { ...@@ -703,12 +705,6 @@ static struct meson_clk_mpll *const axg_clk_mplls[] = {
&axg_mpll3, &axg_mpll3,
}; };
static struct clk_mux *const axg_clk_muxes[] = {
&axg_mpeg_clk_sel,
&axg_sd_emmc_b_clk0_sel,
&axg_sd_emmc_c_clk0_sel,
};
static struct clk_regmap *const axg_clk_regmaps[] = { static struct clk_regmap *const axg_clk_regmaps[] = {
&axg_clk81, &axg_clk81,
&axg_ddr, &axg_ddr,
...@@ -760,6 +756,9 @@ static struct clk_regmap *const axg_clk_regmaps[] = { ...@@ -760,6 +756,9 @@ static struct clk_regmap *const axg_clk_regmaps[] = {
&axg_mpeg_clk_div, &axg_mpeg_clk_div,
&axg_sd_emmc_b_clk0_div, &axg_sd_emmc_b_clk0_div,
&axg_sd_emmc_c_clk0_div, &axg_sd_emmc_c_clk0_div,
&axg_mpeg_clk_sel,
&axg_sd_emmc_b_clk0_sel,
&axg_sd_emmc_c_clk0_sel,
}; };
struct clkc_data { struct clkc_data {
...@@ -767,8 +766,6 @@ struct clkc_data { ...@@ -767,8 +766,6 @@ struct clkc_data {
unsigned int clk_mplls_count; unsigned int clk_mplls_count;
struct meson_clk_pll *const *clk_plls; struct meson_clk_pll *const *clk_plls;
unsigned int clk_plls_count; unsigned int clk_plls_count;
struct clk_mux *const *clk_muxes;
unsigned int clk_muxes_count;
struct clk_hw_onecell_data *hw_onecell_data; struct clk_hw_onecell_data *hw_onecell_data;
}; };
...@@ -777,8 +774,6 @@ static const struct clkc_data axg_clkc_data = { ...@@ -777,8 +774,6 @@ static const struct clkc_data axg_clkc_data = {
.clk_mplls_count = ARRAY_SIZE(axg_clk_mplls), .clk_mplls_count = ARRAY_SIZE(axg_clk_mplls),
.clk_plls = axg_clk_plls, .clk_plls = axg_clk_plls,
.clk_plls_count = ARRAY_SIZE(axg_clk_plls), .clk_plls_count = ARRAY_SIZE(axg_clk_plls),
.clk_muxes = axg_clk_muxes,
.clk_muxes_count = ARRAY_SIZE(axg_clk_muxes),
.hw_onecell_data = &axg_hw_onecell_data, .hw_onecell_data = &axg_hw_onecell_data,
}; };
...@@ -829,11 +824,6 @@ static int axg_clkc_probe(struct platform_device *pdev) ...@@ -829,11 +824,6 @@ static int axg_clkc_probe(struct platform_device *pdev)
for (i = 0; i < clkc_data->clk_mplls_count; i++) for (i = 0; i < clkc_data->clk_mplls_count; i++)
clkc_data->clk_mplls[i]->base = clk_base; clkc_data->clk_mplls[i]->base = clk_base;
/* Populate base address for muxes */
for (i = 0; i < clkc_data->clk_muxes_count; i++)
clkc_data->clk_muxes[i]->reg = clk_base +
(u64)clkc_data->clk_muxes[i]->reg;
/* Populate regmap for the regmap backed clocks */ /* Populate regmap for the regmap backed clocks */
for (i = 0; i < ARRAY_SIZE(axg_clk_regmaps); i++) for (i = 0; i < ARRAY_SIZE(axg_clk_regmaps); i++)
axg_clk_regmaps[i]->map = map; axg_clk_regmaps[i]->map = map;
......
This diff is collapsed.
...@@ -370,17 +370,16 @@ static struct meson_clk_cpu meson8b_cpu_clk = { ...@@ -370,17 +370,16 @@ static struct meson_clk_cpu meson8b_cpu_clk = {
}; };
static u32 mux_table_clk81[] = { 6, 5, 7 }; static u32 mux_table_clk81[] = { 6, 5, 7 };
static struct clk_regmap meson8b_mpeg_clk_sel = {
struct clk_mux meson8b_mpeg_clk_sel = { .data = &(struct clk_regmap_mux_data){
.reg = (void *)HHI_MPEG_CLK_CNTL, .offset = HHI_MPEG_CLK_CNTL,
.mask = 0x7, .mask = 0x7,
.shift = 12, .shift = 12,
.flags = CLK_MUX_READ_ONLY, .table = mux_table_clk81,
.table = mux_table_clk81, },
.lock = &meson_clk_lock,
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "mpeg_clk_sel", .name = "mpeg_clk_sel",
.ops = &clk_mux_ro_ops, .ops = &clk_regmap_mux_ro_ops,
/* /*
* FIXME bits 14:12 selects from 8 possible parents: * FIXME bits 14:12 selects from 8 possible parents:
* xtal, 1'b0 (wtf), fclk_div7, mpll_clkout1, mpll_clkout2, * xtal, 1'b0 (wtf), fclk_div7, mpll_clkout1, mpll_clkout2,
...@@ -620,10 +619,6 @@ static struct meson_clk_mpll *const meson8b_clk_mplls[] = { ...@@ -620,10 +619,6 @@ static struct meson_clk_mpll *const meson8b_clk_mplls[] = {
&meson8b_mpll2, &meson8b_mpll2,
}; };
static struct clk_mux *const meson8b_clk_muxes[] = {
&meson8b_mpeg_clk_sel,
};
static struct clk_regmap *const meson8b_clk_regmaps[] = { static struct clk_regmap *const meson8b_clk_regmaps[] = {
&meson8b_clk81, &meson8b_clk81,
&meson8b_ddr, &meson8b_ddr,
...@@ -704,6 +699,7 @@ static struct clk_regmap *const meson8b_clk_regmaps[] = { ...@@ -704,6 +699,7 @@ static struct clk_regmap *const meson8b_clk_regmaps[] = {
&meson8b_ao_ahb_bus, &meson8b_ao_ahb_bus,
&meson8b_ao_iface, &meson8b_ao_iface,
&meson8b_mpeg_clk_div, &meson8b_mpeg_clk_div,
&meson8b_mpeg_clk_sel,
}; };
static const struct meson8b_clk_reset_line { static const struct meson8b_clk_reset_line {
...@@ -837,11 +833,6 @@ static int meson8b_clkc_probe(struct platform_device *pdev) ...@@ -837,11 +833,6 @@ static int meson8b_clkc_probe(struct platform_device *pdev)
/* Populate the base address for CPU clk */ /* Populate the base address for CPU clk */
meson8b_cpu_clk.base = clk_base; meson8b_cpu_clk.base = clk_base;
/* Populate base address for muxes */
for (i = 0; i < ARRAY_SIZE(meson8b_clk_muxes); i++)
meson8b_clk_muxes[i]->reg = clk_base +
(u32)meson8b_clk_muxes[i]->reg;
/* Populate regmap for the regmap backed clocks */ /* Populate regmap for the regmap backed clocks */
for (i = 0; i < ARRAY_SIZE(meson8b_clk_regmaps); i++) for (i = 0; i < ARRAY_SIZE(meson8b_clk_regmaps); i++)
meson8b_clk_regmaps[i]->map = map; meson8b_clk_regmaps[i]->map = map;
......
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