From: Jan Dakinevich <jan.dakinevich@salutedevices.com>
To: Jerome Brunet <jbrunet@baylibre.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Stephen Boyd <sboyd@kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>
Cc: <linux-kernel@vger.kernel.org>,
<linux-amlogic@lists.infradead.org>, <linux-clk@vger.kernel.org>
Subject: Re: [RFC PATCH 9/9] clk: amlogic: axg-audio: use the auxiliary reset driver
Date: Sat, 18 May 2024 04:33:25 +0300 [thread overview]
Message-ID: <6944f440-9029-4c08-80f7-b67e23f13dae@salutedevices.com> (raw)
In-Reply-To: <20240516150842.705844-10-jbrunet@baylibre.com>
May be I'm doing something wrong, but "git am" fails on this patch on
tag next-20240517.
On 5/16/24 18:08, Jerome Brunet wrote:
> Remove the implementation of the reset driver in axg audio
> clock driver and migrate to the one provided by reset framework
> on auxiliary bus
>
> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
> ---
> drivers/clk/meson/Kconfig | 1 +
> drivers/clk/meson/axg-audio.c | 108 +++-------------------------------
> 2 files changed, 9 insertions(+), 100 deletions(-)
>
> diff --git a/drivers/clk/meson/Kconfig b/drivers/clk/meson/Kconfig
> index 6905aa2f080c..b89e769a6362 100644
> --- a/drivers/clk/meson/Kconfig
> +++ b/drivers/clk/meson/Kconfig
> @@ -110,6 +110,7 @@ config COMMON_CLK_AXG_AUDIO
> select COMMON_CLK_MESON_PHASE
> select COMMON_CLK_MESON_SCLK_DIV
> select COMMON_CLK_MESON_CLKC_UTILS
> + select COMMON_CLK_MESON_CLK_RST_AUX
> select REGMAP_MMIO
> help
> Support for the audio clock controller on AmLogic A113D devices,
> diff --git a/drivers/clk/meson/axg-audio.c b/drivers/clk/meson/axg-audio.c
> index 93e6a6d321be..dc9191a9ab0f 100644
> --- a/drivers/clk/meson/axg-audio.c
> +++ b/drivers/clk/meson/axg-audio.c
> @@ -15,6 +15,7 @@
> #include <linux/reset-controller.h>
> #include <linux/slab.h>
>
> +#include "meson-clk-rst-aux.h"
> #include "meson-clkc-utils.h"
> #include "axg-audio.h"
> #include "clk-regmap.h"
> @@ -1678,84 +1679,6 @@ static struct clk_regmap *const sm1_clk_regmaps[] = {
> &sm1_earcrx_dmac_clk,
> };
>
> -struct axg_audio_reset_data {
> - struct reset_controller_dev rstc;
> - struct regmap *map;
> - unsigned int offset;
> -};
> -
> -static void axg_audio_reset_reg_and_bit(struct axg_audio_reset_data *rst,
> - unsigned long id,
> - unsigned int *reg,
> - unsigned int *bit)
> -{
> - unsigned int stride = regmap_get_reg_stride(rst->map);
> -
> - *reg = (id / (stride * BITS_PER_BYTE)) * stride;
> - *reg += rst->offset;
> - *bit = id % (stride * BITS_PER_BYTE);
> -}
> -
> -static int axg_audio_reset_update(struct reset_controller_dev *rcdev,
> - unsigned long id, bool assert)
> -{
> - struct axg_audio_reset_data *rst =
> - container_of(rcdev, struct axg_audio_reset_data, rstc);
> - unsigned int offset, bit;
> -
> - axg_audio_reset_reg_and_bit(rst, id, &offset, &bit);
> -
> - regmap_update_bits(rst->map, offset, BIT(bit),
> - assert ? BIT(bit) : 0);
> -
> - return 0;
> -}
> -
> -static int axg_audio_reset_status(struct reset_controller_dev *rcdev,
> - unsigned long id)
> -{
> - struct axg_audio_reset_data *rst =
> - container_of(rcdev, struct axg_audio_reset_data, rstc);
> - unsigned int val, offset, bit;
> -
> - axg_audio_reset_reg_and_bit(rst, id, &offset, &bit);
> -
> - regmap_read(rst->map, offset, &val);
> -
> - return !!(val & BIT(bit));
> -}
> -
> -static int axg_audio_reset_assert(struct reset_controller_dev *rcdev,
> - unsigned long id)
> -{
> - return axg_audio_reset_update(rcdev, id, true);
> -}
> -
> -static int axg_audio_reset_deassert(struct reset_controller_dev *rcdev,
> - unsigned long id)
> -{
> - return axg_audio_reset_update(rcdev, id, false);
> -}
> -
> -static int axg_audio_reset_toggle(struct reset_controller_dev *rcdev,
> - unsigned long id)
> -{
> - int ret;
> -
> - ret = axg_audio_reset_assert(rcdev, id);
> - if (ret)
> - return ret;
> -
> - return axg_audio_reset_deassert(rcdev, id);
> -}
> -
> -static const struct reset_control_ops axg_audio_rstc_ops = {
> - .assert = axg_audio_reset_assert,
> - .deassert = axg_audio_reset_deassert,
> - .reset = axg_audio_reset_toggle,
> - .status = axg_audio_reset_status,
> -};
> -
> static const struct regmap_config axg_audio_regmap_cfg = {
> .reg_bits = 32,
> .val_bits = 32,
> @@ -1766,15 +1689,13 @@ struct audioclk_data {
> struct clk_regmap *const *regmap_clks;
> unsigned int regmap_clk_num;
> struct meson_clk_hw_data hw_clks;
> - unsigned int reset_offset;
> - unsigned int reset_num;
> + const char *rst_drvname;
> };
>
> static int axg_audio_clkc_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> const struct audioclk_data *data;
> - struct axg_audio_reset_data *rst;
> struct regmap *map;
> void __iomem *regs;
> struct clk_hw *hw;
> @@ -1832,22 +1753,11 @@ static int axg_audio_clkc_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> - /* Stop here if there is no reset */
> - if (!data->reset_num)
> - return 0;
> -
> - rst = devm_kzalloc(dev, sizeof(*rst), GFP_KERNEL);
> - if (!rst)
> - return -ENOMEM;
> -
> - rst->map = map;
> - rst->offset = data->reset_offset;
> - rst->rstc.nr_resets = data->reset_num;
> - rst->rstc.ops = &axg_audio_rstc_ops;
> - rst->rstc.of_node = dev->of_node;
> - rst->rstc.owner = THIS_MODULE;
> + /* Register auxiliary reset driver when applicable */
> + if (data->rst_drvname)
> + ret = devm_meson_clk_rst_aux_register(dev, map, data->rst_drvname);
>
> - return devm_reset_controller_register(dev, &rst->rstc);
> + return ret;
> }
>
> static const struct audioclk_data axg_audioclk_data = {
> @@ -1866,8 +1776,7 @@ static const struct audioclk_data g12a_audioclk_data = {
> .hws = g12a_audio_hw_clks,
> .num = ARRAY_SIZE(g12a_audio_hw_clks),
> },
> - .reset_offset = AUDIO_SW_RESET,
> - .reset_num = 26,
> + .rst_drvname = "rst-g12a",
> };
>
> static const struct audioclk_data sm1_audioclk_data = {
> @@ -1877,8 +1786,7 @@ static const struct audioclk_data sm1_audioclk_data = {
> .hws = sm1_audio_hw_clks,
> .num = ARRAY_SIZE(sm1_audio_hw_clks),
> },
> - .reset_offset = AUDIO_SM1_SW_RESET0,
> - .reset_num = 39,
> + .rst_drvname = "rst-sm1",
> };
>
> static const struct of_device_id clkc_match_table[] = {
--
Best regards
Jan Dakinevich
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2024-05-18 1:34 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-16 15:08 [RFC PATCH 0/9] reset: amlogic: move reset drivers out of CCF Jerome Brunet
2024-05-16 15:08 ` [RFC PATCH 1/9] reset: amlogic: convert driver to regmap Jerome Brunet
2024-05-16 15:08 ` [RFC PATCH 2/9] reset: amlogic: add driver parameters Jerome Brunet
2024-05-16 15:08 ` [RFC PATCH 3/9] reset: amlogic: split the device and platform probe Jerome Brunet
2024-05-16 15:08 ` [RFC PATCH 4/9] reset: amlogic: use reset number instead of register count Jerome Brunet
2024-05-16 15:08 ` [RFC PATCH 5/9] reset: amlogic: add reset status support Jerome Brunet
2024-05-16 15:08 ` [RFC PATCH 6/9] reset: amlogic: add toggle reset support Jerome Brunet
2024-05-16 15:08 ` [RFC PATCH 7/9] reset: amlogic: add auxiliary reset driver support Jerome Brunet
2024-05-18 1:28 ` Jan Dakinevich
2024-05-16 15:08 ` [RFC PATCH 8/9] clk: meson: add auxiliary reset helper driver Jerome Brunet
2024-05-30 1:01 ` Stephen Boyd
2024-06-10 10:10 ` Jerome Brunet
2024-07-02 18:58 ` Stephen Boyd
2024-05-16 15:08 ` [RFC PATCH 9/9] clk: amlogic: axg-audio: use the auxiliary reset driver Jerome Brunet
2024-05-18 1:33 ` Jan Dakinevich [this message]
2024-05-18 1:43 ` [RFC PATCH 0/9] reset: amlogic: move reset drivers out of CCF Jan Dakinevich
2024-06-24 13:48 ` Jan Dakinevich
2024-06-27 7:37 ` Jerome Brunet
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=6944f440-9029-4c08-80f7-b67e23f13dae@salutedevices.com \
--to=jan.dakinevich@salutedevices.com \
--cc=jbrunet@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=p.zabel@pengutronix.de \
--cc=sboyd@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
all inboxes | Powered by JetHome®