aboutsummaryrefslogtreecommitdiff
path: root/drivers/clk
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2024-07-08 08:45:02 -0600
committerTom Rini <trini@konsulko.com>2024-07-08 08:45:02 -0600
commit4480b53b194e388b37311eb63e1d7d73d3672b32 (patch)
tree77c0bb7a508d69c85f59bce7e1700f9ff243b3a3 /drivers/clk
parent97d638e77a643722911e988a3a0f0ed3874a9101 (diff)
parent3d4c29258f8b4c4a5cf4ce79fb1ac80f66e4cf65 (diff)
downloadu-boot-4480b53b194e388b37311eb63e1d7d73d3672b32.zip
u-boot-4480b53b194e388b37311eb63e1d7d73d3672b32.tar.gz
u-boot-4480b53b194e388b37311eb63e1d7d73d3672b32.tar.bz2
Merge tag 'u-boot-imx-master-20240706' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/21504 - Fixes for i.MX8M and i.MX93 clk-composite. - Set CAN oscillator frequency based on model on verdin-imx8mm. - Enable CAAM for phycore-imx8mp_defconfig. - Miscellaneous improvements for Gateworks i.MX8M boards. - Fix initramfs boot on msc_sm2s_imx8mp. - Fixe EQoS on imx8mp-beacon-kit. - Fix error message in fsl_esdhc_imx.
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/clk-mux.c5
-rw-r--r--drivers/clk/imx/clk-composite-8m.c41
-rw-r--r--drivers/clk/imx/clk-composite-93.c2
3 files changed, 39 insertions, 9 deletions
diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c
index 39e01c3..62477e1 100644
--- a/drivers/clk/clk-mux.c
+++ b/drivers/clk/clk-mux.c
@@ -101,8 +101,7 @@ u8 clk_mux_get_parent(struct clk *clk)
return clk_mux_val_to_index(clk, mux->table, mux->flags, val);
}
-static int clk_fetch_parent_index(struct clk *clk,
- struct clk *parent)
+int clk_mux_fetch_parent_index(struct clk *clk, struct clk *parent)
{
struct clk_mux *mux = to_clk_mux(clk);
@@ -126,7 +125,7 @@ static int clk_mux_set_parent(struct clk *clk, struct clk *parent)
u32 val;
u32 reg;
- index = clk_fetch_parent_index(clk, parent);
+ index = clk_mux_fetch_parent_index(clk, parent);
if (index < 0) {
log_err("Could not fetch index\n");
return index;
diff --git a/drivers/clk/imx/clk-composite-8m.c b/drivers/clk/imx/clk-composite-8m.c
index 45f1bca..64bffa3 100644
--- a/drivers/clk/imx/clk-composite-8m.c
+++ b/drivers/clk/imx/clk-composite-8m.c
@@ -116,6 +116,41 @@ static const struct clk_ops imx8m_clk_composite_divider_ops = {
.set_rate = imx8m_clk_composite_divider_set_rate,
};
+static int imx8m_clk_mux_set_parent(struct clk *clk, struct clk *parent)
+{
+ struct clk_mux *mux = to_clk_mux(clk);
+ int index;
+ u32 val;
+ u32 reg;
+
+ index = clk_mux_fetch_parent_index(clk, parent);
+ if (index < 0) {
+ log_err("Could not fetch index\n");
+ return index;
+ }
+
+ val = clk_mux_index_to_val(mux->table, mux->flags, index);
+
+ reg = readl(mux->reg);
+ reg &= ~(mux->mask << mux->shift);
+ val = val << mux->shift;
+ reg |= val;
+
+ /*
+ * write twice to make sure non-target interface
+ * SEL_A/B point the same clk input.
+ */
+ writel(reg, mux->reg);
+ writel(reg, mux->reg);
+
+ return 0;
+}
+
+const struct clk_ops imx8m_clk_mux_ops = {
+ .get_rate = clk_generic_get_rate,
+ .set_parent = imx8m_clk_mux_set_parent,
+};
+
struct clk *imx8m_clk_composite_flags(const char *name,
const char * const *parent_names,
int num_parents, void __iomem *reg,
@@ -134,7 +169,6 @@ struct clk *imx8m_clk_composite_flags(const char *name,
mux->shift = PCG_PCS_SHIFT;
mux->mask = PCG_PCS_MASK;
mux->num_parents = num_parents;
- mux->flags = flags;
mux->parent_names = parent_names;
div = kzalloc(sizeof(*div), GFP_KERNEL);
@@ -144,7 +178,7 @@ struct clk *imx8m_clk_composite_flags(const char *name,
div->reg = reg;
div->shift = PCG_PREDIV_SHIFT;
div->width = PCG_PREDIV_WIDTH;
- div->flags = CLK_DIVIDER_ROUND_CLOSEST | flags;
+ div->flags = CLK_DIVIDER_ROUND_CLOSEST;
gate = kzalloc(sizeof(*gate), GFP_KERNEL);
if (!gate)
@@ -152,11 +186,10 @@ struct clk *imx8m_clk_composite_flags(const char *name,
gate->reg = reg;
gate->bit_idx = PCG_CGC_SHIFT;
- gate->flags = flags;
clk = clk_register_composite(NULL, name,
parent_names, num_parents,
- &mux->clk, &clk_mux_ops, &div->clk,
+ &mux->clk, &imx8m_clk_mux_ops, &div->clk,
&imx8m_clk_composite_divider_ops,
&gate->clk, &clk_gate_ops, flags);
if (IS_ERR(clk))
diff --git a/drivers/clk/imx/clk-composite-93.c b/drivers/clk/imx/clk-composite-93.c
index 2cf20be..61692d3 100644
--- a/drivers/clk/imx/clk-composite-93.c
+++ b/drivers/clk/imx/clk-composite-93.c
@@ -102,7 +102,6 @@ struct clk *imx93_clk_composite_flags(const char *name,
mux->mask = CCM_MUX_MASK;
mux->num_parents = num_parents;
mux->parent_names = parent_names;
- mux->flags = flags;
div = kzalloc(sizeof(*div), GFP_KERNEL);
if (!div)
@@ -119,7 +118,6 @@ struct clk *imx93_clk_composite_flags(const char *name,
gate->reg = reg;
gate->bit_idx = CCM_OFF_SHIFT;
- gate->flags = flags;
clk = clk_register_composite(NULL, name,
parent_names, num_parents,