From: Abel Vesa <abel.vesa@nxp.com>
To: Jacky Bai <ping.bai@nxp.com>
Cc: shawnguo@kernel.org, robh+dt@kernel.org, sboyd@kernel.org,
s.hauer@pengutronix.de, p.zabel@pengutronix.de,
kernel@pengutronix.de, linux-imx@nxp.com,
devicetree@vger.kernel.org
Subject: Re: [PATCH v3 3/9] clk: imx: Update the compsite driver to support imx8ulp
Date: Tue, 14 Sep 2021 14:30:16 +0300 [thread overview]
Message-ID: <YUCHyHW7COZYiD6B@ryzen> (raw)
In-Reply-To: <20210914065208.3582128-4-ping.bai@nxp.com>
On 21-09-14 14:52:02, Jacky Bai wrote:
> On i.MX8ULP, some peripherals have a sw_rst control resides
> in the per device PCC clock control register, all others are
> same as i.MX7ULP, so update the 7ulp clock composite driver to
> support i.MX8ULP to maxmimize the code reuse.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Abel Vesa <abel.vesa@nxp.com>
> ---
> v3 changs: no
> ---
> drivers/clk/imx/clk-composite-7ulp.c | 61 ++++++++++++++++++++++++++--
> drivers/clk/imx/clk.h | 6 +++
> 2 files changed, 64 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/clk/imx/clk-composite-7ulp.c b/drivers/clk/imx/clk-composite-7ulp.c
> index d85ba78abbb1..50ed383320bf 100644
> --- a/drivers/clk/imx/clk-composite-7ulp.c
> +++ b/drivers/clk/imx/clk-composite-7ulp.c
> @@ -23,11 +23,50 @@
> #define PCG_PCD_WIDTH 3
> #define PCG_PCD_MASK 0x7
>
> -struct clk_hw *imx7ulp_clk_hw_composite(const char *name,
> +#define SW_RST BIT(28)
> +
> +static int pcc_gate_enable(struct clk_hw *hw)
> +{
> + struct clk_gate *gate = to_clk_gate(hw);
> + u32 val;
> + int ret;
> +
> + ret = clk_gate_ops.enable(hw);
> + if (ret)
> + return ret;
> +
> + /*
> + * release the sw reset for peripherals associated with
> + * with this pcc clock.
> + */
> + val = readl(gate->reg);
> + val |= SW_RST;
> + writel(val, gate->reg);
> +
> + return 0;
> +}
> +
> +static void pcc_gate_disable(struct clk_hw *hw)
> +{
> + clk_gate_ops.disable(hw);
> +}
> +
> +static int pcc_gate_is_enabled(struct clk_hw *hw)
> +{
> + return clk_gate_ops.is_enabled(hw);
> +}
> +
> +static const struct clk_ops pcc_gate_ops = {
> + .enable = pcc_gate_enable,
> + .disable = pcc_gate_disable,
> + .is_enabled = pcc_gate_is_enabled,
> +};
> +
> +static struct clk_hw *imx_ulp_clk_hw_composite(const char *name,
> const char * const *parent_names,
> int num_parents, bool mux_present,
> bool rate_present, bool gate_present,
> - void __iomem *reg)
> + void __iomem *reg, bool has_swrst)
> {
> struct clk_hw *mux_hw = NULL, *fd_hw = NULL, *gate_hw = NULL;
> struct clk_fractional_divider *fd = NULL;
> @@ -77,7 +116,7 @@ struct clk_hw *imx7ulp_clk_hw_composite(const char *name,
> hw = clk_hw_register_composite(NULL, name, parent_names, num_parents,
> mux_hw, &clk_mux_ops, fd_hw,
> &clk_fractional_divider_ops, gate_hw,
> - &clk_gate_ops, CLK_SET_RATE_GATE |
> + has_swrst ? &pcc_gate_ops : &clk_gate_ops, CLK_SET_RATE_GATE |
> CLK_SET_PARENT_GATE);
> if (IS_ERR(hw)) {
> kfree(mux);
> @@ -87,3 +126,19 @@ struct clk_hw *imx7ulp_clk_hw_composite(const char *name,
>
> return hw;
> }
> +
> +struct clk_hw *imx7ulp_clk_hw_composite(const char *name, const char * const *parent_names,
> + int num_parents, bool mux_present, bool rate_present,
> + bool gate_present, void __iomem *reg)
> +{
> + return imx_ulp_clk_hw_composite(name, parent_names, num_parents, mux_present, rate_present,
> + gate_present, reg, false);
> +}
> +
> +struct clk_hw *imx8ulp_clk_hw_composite(const char *name, const char * const *parent_names,
> + int num_parents, bool mux_present, bool rate_present,
> + bool gate_present, void __iomem *reg, bool has_swrst)
> +{
> + return imx_ulp_clk_hw_composite(name, parent_names, num_parents, mux_present, rate_present,
> + gate_present, reg, has_swrst);
> +}
> diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h
> index 3f518559b8f9..a9bcfee7a75b 100644
> --- a/drivers/clk/imx/clk.h
> +++ b/drivers/clk/imx/clk.h
> @@ -237,6 +237,12 @@ struct clk_hw *imx7ulp_clk_hw_composite(const char *name,
> bool rate_present, bool gate_present,
> void __iomem *reg);
>
> +struct clk_hw *imx8ulp_clk_hw_composite(const char *name,
> + const char * const *parent_names,
> + int num_parents, bool mux_present,
> + bool rate_present, bool gate_present,
> + void __iomem *reg, bool has_swrst);
> +
> struct clk_hw *imx_clk_hw_fixup_divider(const char *name, const char *parent,
> void __iomem *reg, u8 shift, u8 width,
> void (*fixup)(u32 *val));
> --
> 2.26.2
>
next prev parent reply other threads:[~2021-09-14 11:30 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-14 6:51 [PATCH v3 0/9] Add imx8ulp clock & reset driver support Jacky Bai
2021-09-14 6:52 ` [PATCH v3 1/9] dt-bindings: clock: Add imx8ulp clock support Jacky Bai
2021-09-14 11:25 ` Abel Vesa
2021-09-14 13:11 ` Jacky Bai
2021-09-14 15:30 ` Abel Vesa
2021-09-20 21:44 ` Rob Herring
2021-09-14 6:52 ` [PATCH v3 2/9] clk: imx: Update the pllv4 to support imx8ulp Jacky Bai
2021-09-14 11:29 ` Abel Vesa
2021-09-14 6:52 ` [PATCH v3 3/9] clk: imx: Update the compsite driver " Jacky Bai
2021-09-14 11:30 ` Abel Vesa [this message]
2021-09-14 6:52 ` [PATCH v3 4/9] clk: imx: disable i.mx7ulp composite clock during initialization Jacky Bai
2021-09-14 11:32 ` Abel Vesa
2021-09-14 6:52 ` [PATCH v3 5/9] clk: imx: Add 'CLK_SET_RATE_NO_REPARENT' for composite-7ulp Jacky Bai
2021-09-14 11:33 ` Abel Vesa
2021-09-14 6:52 ` [PATCH v3 6/9] clk: imx: disable the pfd when set pfdv2 clock rate Jacky Bai
2021-09-14 11:34 ` Abel Vesa
2021-09-14 6:52 ` [PATCH v3 7/9] clk: imx: Update the pfdv2 for 8ulp specific support Jacky Bai
2021-09-14 11:35 ` Abel Vesa
2021-09-14 6:52 ` [PATCH v3 8/9] clk: imx: Add clock driver for imx8ulp Jacky Bai
2021-09-14 11:55 ` Abel Vesa
2021-09-14 6:52 ` [PATCH v3 9/9] clk: imx: Add the pcc reset controller support on imx8ulp Jacky Bai
2021-09-14 12:09 ` Abel Vesa
2021-09-14 13:07 ` Jacky Bai
2021-09-14 15:19 ` Abel Vesa
2021-09-14 11:17 ` [PATCH v3 0/9] Add imx8ulp clock & reset driver support Abel Vesa
2021-09-16 6:46 ` Abel Vesa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YUCHyHW7COZYiD6B@ryzen \
--to=abel.vesa@nxp.com \
--cc=devicetree@vger.kernel.org \
--cc=kernel@pengutronix.de \
--cc=linux-imx@nxp.com \
--cc=p.zabel@pengutronix.de \
--cc=ping.bai@nxp.com \
--cc=robh+dt@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=sboyd@kernel.org \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).