The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno  <angelogioacchino.delregno@collabora.com>
To: "Garmin.Chang" <Garmin.Chang@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Richard Cochran <richardcochran@gmail.com>
Cc: Project_Global_Chrome_Upstream_Group@mediatek.com,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org
Subject: Re: [PATCH v2 03/19] clk: mediatek: Add MT8188 topckgen clock support
Date: Thu, 27 Oct 2022 10:21:04 +0200	[thread overview]
Message-ID: <875b601c-bc41-2d6b-2e93-4c98e3b6c371@collabora.com> (raw)
In-Reply-To: <20221024094254.29218-4-Garmin.Chang@mediatek.com>

Il 24/10/22 11:42, Garmin.Chang ha scritto:
> Add MT8188 topckgen clock controller which provides muxes, dividers
> to handle variety clock selection in other IP blocks.
> 
> Signed-off-by: Garmin.Chang <Garmin.Chang@mediatek.com>
> ---
>   drivers/clk/mediatek/Makefile              |    2 +-
>   drivers/clk/mediatek/clk-mt8188-topckgen.c | 1337 ++++++++++++++++++++
>   2 files changed, 1338 insertions(+), 1 deletion(-)
>   create mode 100644 drivers/clk/mediatek/clk-mt8188-topckgen.c
> 
> diff --git a/drivers/clk/mediatek/Makefile b/drivers/clk/mediatek/Makefile
> index 957530b4303f..4fc7de25f036 100644
> --- a/drivers/clk/mediatek/Makefile
> +++ b/drivers/clk/mediatek/Makefile
> @@ -82,7 +82,7 @@ obj-$(CONFIG_COMMON_CLK_MT8186) += clk-mt8186-mcu.o clk-mt8186-topckgen.o clk-mt
>   				   clk-mt8186-mfg.o clk-mt8186-mm.o clk-mt8186-wpe.o \
>   				   clk-mt8186-img.o clk-mt8186-vdec.o clk-mt8186-venc.o \
>   				   clk-mt8186-cam.o clk-mt8186-mdp.o clk-mt8186-ipe.o
> -obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o
> +obj-$(CONFIG_COMMON_CLK_MT8188) += clk-mt8188-apmixedsys.o clk-mt8188-topckgen.o
>   obj-$(CONFIG_COMMON_CLK_MT8192) += clk-mt8192.o
>   obj-$(CONFIG_COMMON_CLK_MT8192_AUDSYS) += clk-mt8192-aud.o
>   obj-$(CONFIG_COMMON_CLK_MT8192_CAMSYS) += clk-mt8192-cam.o
> diff --git a/drivers/clk/mediatek/clk-mt8188-topckgen.c b/drivers/clk/mediatek/clk-mt8188-topckgen.c
> new file mode 100644
> index 000000000000..c6ac6c2558ae
> --- /dev/null
> +++ b/drivers/clk/mediatek/clk-mt8188-topckgen.c
> @@ -0,0 +1,1337 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +//
> +// Copyright (c) 2022 MediaTek Inc.
> +// Author: Garmin Chang <garmin.chang@mediatek.com>
> +
> +#include <linux/of_device.h>
> +#include <linux/platform_device.h>
> +#include <dt-bindings/clock/mediatek,mt8188-clk.h>
> +
> +#include "clk-gate.h"
> +#include "clk-mtk.h"
> +#include "clk-mux.h"
> +
> +static DEFINE_SPINLOCK(mt8188_clk_lock);
> +
> +static const struct mtk_fixed_clk top_fixed_clks[] = {
> +	FIXED_CLK(CLK_TOP_ULPOSC1, "ulposc_ck1", NULL, 260000000),
> +	FIXED_CLK(CLK_TOP_MPHONE_SLAVE_BCK, "mphone_slave_bck", NULL, 49152000),
> +	FIXED_CLK(CLK_TOP_PAD_FPC, "pad_fpc_ck", NULL, 50000000),
> +	FIXED_CLK(CLK_TOP_466M_FMEM, "hd_466m_fmem_ck", NULL, 533000000),
> +	FIXED_CLK(CLK_TOP_PEXTP_PIPE, "pextp_pipe", NULL, 250000000),
> +	FIXED_CLK(CLK_TOP_DSI_PHY, "dsi_phy", NULL, 500000000),
> +};
> +
> +static const struct mtk_fixed_factor top_divs[] = {
> +	FACTOR(CLK_TOP_MFGPLL, "mfgpll_ck", "mfgpll", 1, 1),
> +	FACTOR(CLK_TOP_MAINPLL, "mainpll_ck", "mainpll", 1, 1),

Are you sure that mainpll and univpll should have CLK_SET_RATE_PARENT?
This will give issues in GPU DVFS, as this is the case with all MediaTek SoCs.

Please check this series and add it as a dependency of yours:
https://patchwork.kernel.org/project/linux-mediatek/list/?series=688135

> +	FACTOR(CLK_TOP_MAINPLL_D3, "mainpll_d3", "mainpll_ck", 1, 3),
> +	FACTOR(CLK_TOP_MAINPLL_D4, "mainpll_d4", "mainpll_ck", 1, 4),

..snip..

> +
> +static struct mtk_composite top_muxes[] = {
> +	/* CLK_MISC_CFG_3 */
> +	MUX(CLK_TOP_MFG_CK_FAST_REF, "mfg_ck_fast_ref", mfg_fast_ref_parents, 0x0250, 8, 1),
> +};

CLK_TOP_MFG_CK_FAST_REF is not a composite clock: you can register it with a call
to devm_clk_hw_register_mux() in the probe function.

Check clk-mt8195-topckgen.c upstream for an example.

Regards,
Angelo


       reply	other threads:[~2022-10-27  8:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20221024094254.29218-1-Garmin.Chang@mediatek.com>
     [not found] ` <20221024094254.29218-4-Garmin.Chang@mediatek.com>
2022-10-27  8:21   ` AngeloGioacchino Del Regno [this message]
2022-12-23  7:36     ` [PATCH v2 03/19] clk: mediatek: Add MT8188 topckgen clock support Garmin Chang (張家銘)
     [not found] ` <20221024094254.29218-3-Garmin.Chang@mediatek.com>
2022-10-27  8:21   ` [PATCH v2 02/19] clk: mediatek: Add MT8188 apmixedsys " AngeloGioacchino Del Regno
2022-12-23  7:35     ` Garmin Chang (張家銘)
     [not found] ` <20221024094254.29218-5-Garmin.Chang@mediatek.com>
2022-10-27  8:22   ` [PATCH v2 04/19] clk: mediatek: Add MT8188 peripheral " AngeloGioacchino Del Regno
2022-12-23  7:33     ` Garmin Chang (張家銘)
     [not found] ` <20221024094254.29218-11-Garmin.Chang@mediatek.com>
2022-10-27  8:23   ` [PATCH v2 10/19] clk: mediatek: Add MT8188 mfgcfg " AngeloGioacchino Del Regno
2022-12-23  1:36     ` Garmin Chang (張家銘)
     [not found] ` <20221024094254.29218-9-Garmin.Chang@mediatek.com>
2022-10-27  8:25   ` [PATCH v2 08/19] clk: mediatek: Add MT8188 imgsys " AngeloGioacchino Del Regno
2022-12-12  7:53     ` Garmin Chang (張家銘)
     [not found] ` <20221024094254.29218-2-Garmin.Chang@mediatek.com>
2022-10-27 13:42   ` [PATCH v2 01/19] dt-bindings: ARM: MediaTek: Add new document bindings of MT8188 clock Krzysztof Kozlowski
2022-12-23  8:20     ` Garmin Chang (張家銘)

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=875b601c-bc41-2d6b-2e93-4c98e3b6c371@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=Garmin.Chang@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mturquette@baylibre.com \
    --cc=richardcochran@gmail.com \
    --cc=robh+dt@kernel.org \
    --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