From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Sam Protsenko <semen.protsenko@linaro.org>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Chanwoo Choi <cw00.choi@samsung.com>
Cc: Tomasz Figa <tomasz.figa@gmail.com>,
Alim Akhtar <alim.akhtar@samsung.com>,
Chanho Park <chanho61.park@samsung.com>,
David Virag <virag.david003@gmail.com>,
Sumit Semwal <sumit.semwal@linaro.org>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 5/6] clk: samsung: Extract parent clock enabling to common function
Date: Mon, 6 Mar 2023 15:35:06 +0100 [thread overview]
Message-ID: <7cbc24bf-6920-c75f-effc-fd9d827ca324@linaro.org> (raw)
In-Reply-To: <20230223041938.22732-6-semen.protsenko@linaro.org>
On 23/02/2023 05:19, Sam Protsenko wrote:
> Extract parent clock enabling from exynos_arm64_register_cmu() to
> dedicated function.
>
> Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
> ---
> Changes in v3:
> - Rebased on top of latest soc/for-next tree
> - Added Marek's Acked-by tag
>
> Changes in v2:
> - Rebased on top of latest soc/for-next tree
> - Improved English in kernel doc comment
> - Added clk_prepare_enable() return value check
> - Added exynos_arm64_enable_bus_clk() check in
> exynos_arm64_register_cmu()
> - Changed the commit message to reflect code changes
>
> drivers/clk/samsung/clk-exynos-arm64.c | 51 ++++++++++++++++++--------
> 1 file changed, 35 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/clk/samsung/clk-exynos-arm64.c b/drivers/clk/samsung/clk-exynos-arm64.c
> index b921b9a1134a..2aa3f0a5644e 100644
> --- a/drivers/clk/samsung/clk-exynos-arm64.c
> +++ b/drivers/clk/samsung/clk-exynos-arm64.c
> @@ -56,6 +56,37 @@ static void __init exynos_arm64_init_clocks(struct device_node *np,
> iounmap(reg_base);
> }
>
> +/**
> + * exynos_arm64_enable_bus_clk - Enable parent clock of specified CMU
> + *
> + * @dev: Device object; may be NULL if this function is not being
> + * called from platform driver probe function
> + * @np: CMU device tree node
> + * @cmu: CMU data
> + *
> + * Keep CMU parent clock running (needed for CMU registers access).
> + *
> + * Return: 0 on success or a negative error code on failure.
> + */
> +static int __init exynos_arm64_enable_bus_clk(struct device *dev,
> + struct device_node *np, const struct samsung_cmu_info *cmu)
> +{
> + struct clk *parent_clk;
> +
> + if (!cmu->clk_name)
> + return 0;
> +
> + if (dev)
> + parent_clk = clk_get(dev, cmu->clk_name);
> + else
> + parent_clk = of_clk_get_by_name(np, cmu->clk_name);
> +
> + if (IS_ERR(parent_clk))
> + return PTR_ERR(parent_clk);
> +
> + return clk_prepare_enable(parent_clk);
> +}
> +
> /**
> * exynos_arm64_register_cmu - Register specified Exynos CMU domain
> * @dev: Device object; may be NULL if this function is not being
> @@ -72,23 +103,11 @@ static void __init exynos_arm64_init_clocks(struct device_node *np,
> void __init exynos_arm64_register_cmu(struct device *dev,
> struct device_node *np, const struct samsung_cmu_info *cmu)
> {
> - /* Keep CMU parent clock running (needed for CMU registers access) */
> - if (cmu->clk_name) {
> - struct clk *parent_clk;
> -
> - if (dev)
> - parent_clk = clk_get(dev, cmu->clk_name);
> - else
> - parent_clk = of_clk_get_by_name(np, cmu->clk_name);
> -
> - if (IS_ERR(parent_clk)) {
> - pr_err("%s: could not find bus clock %s; err = %ld\n",
> - __func__, cmu->clk_name, PTR_ERR(parent_clk));
> - } else {
> - clk_prepare_enable(parent_clk);
> - }
> - }
> + int err;
>
> + err = exynos_arm64_enable_bus_clk(dev, np, cmu);
> + if (err)
> + panic("%s: could not enable bus clock\n", __func__);
The error handling is changed and not equivalent. I would say that we
could still try to boot even if this failed, so kernel should not panic.
Maybe the parent clock is enabled by bootloader.
Best regards,
Krzysztof
next prev parent reply other threads:[~2023-03-06 14:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-23 4:19 [PATCH v3 0/6] clk: samsung: Add PM support for ARM64 Exynos chips Sam Protsenko
2023-02-23 4:19 ` [PATCH v3 1/6] clk: samsung: Don't pass reg_base to samsung_clk_register_pll() Sam Protsenko
2023-03-06 14:49 ` (subset) " Krzysztof Kozlowski
2023-02-23 4:19 ` [PATCH v3 2/6] clk: samsung: Remove np argument from samsung_clk_init() Sam Protsenko
2023-03-06 14:40 ` Krzysztof Kozlowski
2023-03-06 18:56 ` Sam Protsenko
2023-03-06 14:49 ` (subset) " Krzysztof Kozlowski
2023-02-23 4:19 ` [PATCH v3 3/6] clk: samsung: Set dev in samsung_clk_init() Sam Protsenko
2023-03-06 14:49 ` (subset) " Krzysztof Kozlowski
2023-02-23 4:19 ` [PATCH v3 4/6] clk: samsung: Extract clocks registration to common function Sam Protsenko
2023-02-23 4:19 ` [PATCH v3 5/6] clk: samsung: Extract parent clock enabling " Sam Protsenko
2023-03-06 14:35 ` Krzysztof Kozlowski [this message]
2023-03-06 23:47 ` Sam Protsenko
2023-02-23 4:19 ` [PATCH v3 6/6] clk: samsung: exynos5433: Extract PM support to common ARM64 layer Sam Protsenko
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=7cbc24bf-6920-c75f-effc-fd9d827ca324@linaro.org \
--to=krzysztof.kozlowski@linaro.org \
--cc=alim.akhtar@samsung.com \
--cc=chanho61.park@samsung.com \
--cc=cw00.choi@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mturquette@baylibre.com \
--cc=s.nawrocki@samsung.com \
--cc=sboyd@kernel.org \
--cc=semen.protsenko@linaro.org \
--cc=sumit.semwal@linaro.org \
--cc=tomasz.figa@gmail.com \
--cc=virag.david003@gmail.com \
/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
all inboxes | Powered by JetHome®