[PATCH 2/3] clk: meson: axg-audio: setup regmap max_register based on the SoC
Neil Armstrong
neil.armstrong at linaro.org
Fri Jul 19 02:59:13 PDT 2024
On 19/07/2024 11:39, Jerome Brunet wrote:
> The register region of axg-audio tends to grow with the addition of
> new supported SoC. Mapping slightly more has not been causing problem
> so far but it is not viable to continue like this long term.
>
> Setup the max register based on what is necessary on the related SoC.
>
> Signed-off-by: Jerome Brunet <jbrunet at baylibre.com>
> ---
> drivers/clk/meson/axg-audio.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clk/meson/axg-audio.c b/drivers/clk/meson/axg-audio.c
> index e03a5bf899c0..2426f3dbb7a2 100644
> --- a/drivers/clk/meson/axg-audio.c
> +++ b/drivers/clk/meson/axg-audio.c
> @@ -1726,11 +1726,10 @@ static const struct reset_control_ops axg_audio_rstc_ops = {
> .status = axg_audio_reset_status,
> };
>
> -static const struct regmap_config axg_audio_regmap_cfg = {
> +static struct regmap_config axg_audio_regmap_cfg = {
> .reg_bits = 32,
> .val_bits = 32,
> .reg_stride = 4,
> - .max_register = AUDIO_CLK_SPDIFOUT_B_CTRL,
> };
>
> struct audioclk_data {
> @@ -1739,6 +1738,7 @@ struct audioclk_data {
> struct meson_clk_hw_data hw_clks;
> unsigned int reset_offset;
> unsigned int reset_num;
> + unsigned int max_register;
> };
>
> static int axg_audio_clkc_probe(struct platform_device *pdev)
> @@ -1760,6 +1760,7 @@ static int axg_audio_clkc_probe(struct platform_device *pdev)
> if (IS_ERR(regs))
> return PTR_ERR(regs);
>
> + axg_audio_regmap_cfg.max_register = data->max_register;
> map = devm_regmap_init_mmio(dev, regs, &axg_audio_regmap_cfg);
> if (IS_ERR(map)) {
> dev_err(dev, "failed to init regmap: %ld\n", PTR_ERR(map));
> @@ -1828,6 +1829,7 @@ static const struct audioclk_data axg_audioclk_data = {
> .hws = axg_audio_hw_clks,
> .num = ARRAY_SIZE(axg_audio_hw_clks),
> },
> + .max_register = AUDIO_CLK_PDMIN_CTRL1,
> };
>
> static const struct audioclk_data g12a_audioclk_data = {
> @@ -1839,6 +1841,7 @@ static const struct audioclk_data g12a_audioclk_data = {
> },
> .reset_offset = AUDIO_SW_RESET,
> .reset_num = 26,
> + .max_register = AUDIO_CLK_SPDIFOUT_B_CTRL,
> };
>
> static const struct audioclk_data sm1_audioclk_data = {
> @@ -1850,6 +1853,7 @@ static const struct audioclk_data sm1_audioclk_data = {
> },
> .reset_offset = AUDIO_SM1_SW_RESET0,
> .reset_num = 39,
> + .max_register = AUDIO_CLK_SPDIFOUT_B_CTRL,
> };
>
> static const struct of_device_id clkc_match_table[] = {
Reviewed-by: Neil Armstrong <neil.armstrong at linaro.org>
More information about the linux-amlogic
mailing list