linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anson Huang <anson.huang@nxp.com>
To: "mturquette@baylibre.com" <mturquette@baylibre.com>,
	"sboyd@kernel.org" <sboyd@kernel.org>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"festevam@gmail.com" <festevam@gmail.com>,
	Leonard Crestez <leonard.crestez@nxp.com>,
	Abel Vesa <abel.vesa@nxp.com>, Peng Fan <peng.fan@nxp.com>,
	Jacky Bai <ping.bai@nxp.com>, Fancy Fang <chen.fang@nxp.com>,
	"S.j. Wang" <shengjiu.wang@nxp.com>,
	Aisheng Dong <aisheng.dong@nxp.com>,
	"sfr@canb.auug.org.au" <sfr@canb.auug.org.au>,
	"l.stach@pengutronix.de" <l.stach@pengutronix.de>,
	"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: dl-linux-imx <linux-imx@nxp.com>
Subject: RE: [PATCH V2 1/2] clk: imx8mm: Move 1443X/1416X PLL clock structure to common place
Date: Fri, 20 Sep 2019 01:27:39 +0000	[thread overview]
Message-ID: <AM6PR0402MB39110BCD655C354F8A295621F5880@AM6PR0402MB3911.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <1567776846-6373-1-git-send-email-Anson.Huang@nxp.com>

Gentle ping...

> Subject: [PATCH V2 1/2] clk: imx8mm: Move 1443X/1416X PLL clock structure
> to common place
> 
> Many i.MX8M SoCs use same 1443X/1416X PLL, such as i.MX8MM, i.MX8MN
> and later i.MX8M SoCs, moving these PLL definitions to pll14xx driver can
> save a lot of duplicated code on each platform.
> 
> Meanwhile, no need to define PLL clock structure for every module which
> uses same type of PLL, e.g., audio/video/dram use 1443X PLL,
> arm/gpu/vpu/sys use 1416X PLL, define 2 PLL clock structure for each group
> is enough.
> 
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> ---
> Changes since V1:
> 	- Move 1443X/1416X PLL clock table/structure to pll14xx driver.
> ---
>  drivers/clk/imx/clk-imx8mm.c  | 87 +++++--------------------------------------
>  drivers/clk/imx/clk-pll14xx.c | 30 +++++++++++++++
>  drivers/clk/imx/clk.h         |  3 ++
>  3 files changed, 43 insertions(+), 77 deletions(-)
> 
> diff --git a/drivers/clk/imx/clk-imx8mm.c b/drivers/clk/imx/clk-imx8mm.c
> index 2758e3f..9649250 100644
> --- a/drivers/clk/imx/clk-imx8mm.c
> +++ b/drivers/clk/imx/clk-imx8mm.c
> @@ -26,73 +26,6 @@ static u32 share_count_disp;  static u32
> share_count_pdm;  static u32 share_count_nand;
> 
> -static const struct imx_pll14xx_rate_table imx8mm_pll1416x_tbl[] = {
> -	PLL_1416X_RATE(1800000000U, 225, 3, 0),
> -	PLL_1416X_RATE(1600000000U, 200, 3, 0),
> -	PLL_1416X_RATE(1200000000U, 300, 3, 1),
> -	PLL_1416X_RATE(1000000000U, 250, 3, 1),
> -	PLL_1416X_RATE(800000000U,  200, 3, 1),
> -	PLL_1416X_RATE(750000000U,  250, 2, 2),
> -	PLL_1416X_RATE(700000000U,  350, 3, 2),
> -	PLL_1416X_RATE(600000000U,  300, 3, 2),
> -};
> -
> -static const struct imx_pll14xx_rate_table imx8mm_audiopll_tbl[] = {
> -	PLL_1443X_RATE(393216000U, 262, 2, 3, 9437),
> -	PLL_1443X_RATE(361267200U, 361, 3, 3, 17511),
> -};
> -
> -static const struct imx_pll14xx_rate_table imx8mm_videopll_tbl[] = {
> -	PLL_1443X_RATE(650000000U, 325, 3, 2, 0),
> -	PLL_1443X_RATE(594000000U, 198, 2, 2, 0),
> -};
> -
> -static const struct imx_pll14xx_rate_table imx8mm_drampll_tbl[] = {
> -	PLL_1443X_RATE(650000000U, 325, 3, 2, 0),
> -};
> -
> -static struct imx_pll14xx_clk imx8mm_audio_pll = {
> -		.type = PLL_1443X,
> -		.rate_table = imx8mm_audiopll_tbl,
> -		.rate_count = ARRAY_SIZE(imx8mm_audiopll_tbl),
> -};
> -
> -static struct imx_pll14xx_clk imx8mm_video_pll = {
> -		.type = PLL_1443X,
> -		.rate_table = imx8mm_videopll_tbl,
> -		.rate_count = ARRAY_SIZE(imx8mm_videopll_tbl),
> -};
> -
> -static struct imx_pll14xx_clk imx8mm_dram_pll = {
> -		.type = PLL_1443X,
> -		.rate_table = imx8mm_drampll_tbl,
> -		.rate_count = ARRAY_SIZE(imx8mm_drampll_tbl),
> -};
> -
> -static struct imx_pll14xx_clk imx8mm_arm_pll = {
> -		.type = PLL_1416X,
> -		.rate_table = imx8mm_pll1416x_tbl,
> -		.rate_count = ARRAY_SIZE(imx8mm_pll1416x_tbl),
> -};
> -
> -static struct imx_pll14xx_clk imx8mm_gpu_pll = {
> -		.type = PLL_1416X,
> -		.rate_table = imx8mm_pll1416x_tbl,
> -		.rate_count = ARRAY_SIZE(imx8mm_pll1416x_tbl),
> -};
> -
> -static struct imx_pll14xx_clk imx8mm_vpu_pll = {
> -		.type = PLL_1416X,
> -		.rate_table = imx8mm_pll1416x_tbl,
> -		.rate_count = ARRAY_SIZE(imx8mm_pll1416x_tbl),
> -};
> -
> -static struct imx_pll14xx_clk imx8mm_sys_pll = {
> -		.type = PLL_1416X,
> -		.rate_table = imx8mm_pll1416x_tbl,
> -		.rate_count = ARRAY_SIZE(imx8mm_pll1416x_tbl),
> -};
> -
>  static const char *pll_ref_sels[] = { "osc_24m", "dummy", "dummy",
> "dummy", };  static const char *audio_pll1_bypass_sels[] = {"audio_pll1",
> "audio_pll1_ref_sel", };  static const char *audio_pll2_bypass_sels[] =
> {"audio_pll2", "audio_pll2_ref_sel", }; @@ -396,16 +329,16 @@ static int
> imx8mm_clocks_probe(struct platform_device *pdev)
>  	clks[IMX8MM_SYS_PLL2_REF_SEL] = imx_clk_mux("sys_pll2_ref_sel",
> base + 0x104, 0, 2, pll_ref_sels, ARRAY_SIZE(pll_ref_sels));
>  	clks[IMX8MM_SYS_PLL3_REF_SEL] = imx_clk_mux("sys_pll3_ref_sel",
> base + 0x114, 0, 2, pll_ref_sels, ARRAY_SIZE(pll_ref_sels));
> 
> -	clks[IMX8MM_AUDIO_PLL1] = imx_clk_pll14xx("audio_pll1",
> "audio_pll1_ref_sel", base, &imx8mm_audio_pll);
> -	clks[IMX8MM_AUDIO_PLL2] = imx_clk_pll14xx("audio_pll2",
> "audio_pll2_ref_sel", base + 0x14, &imx8mm_audio_pll);
> -	clks[IMX8MM_VIDEO_PLL1] = imx_clk_pll14xx("video_pll1",
> "video_pll1_ref_sel", base + 0x28, &imx8mm_video_pll);
> -	clks[IMX8MM_DRAM_PLL] = imx_clk_pll14xx("dram_pll",
> "dram_pll_ref_sel", base + 0x50, &imx8mm_dram_pll);
> -	clks[IMX8MM_GPU_PLL] = imx_clk_pll14xx("gpu_pll",
> "gpu_pll_ref_sel", base + 0x64, &imx8mm_gpu_pll);
> -	clks[IMX8MM_VPU_PLL] = imx_clk_pll14xx("vpu_pll",
> "vpu_pll_ref_sel", base + 0x74, &imx8mm_vpu_pll);
> -	clks[IMX8MM_ARM_PLL] = imx_clk_pll14xx("arm_pll",
> "arm_pll_ref_sel", base + 0x84, &imx8mm_arm_pll);
> -	clks[IMX8MM_SYS_PLL1] = imx_clk_pll14xx("sys_pll1",
> "sys_pll1_ref_sel", base + 0x94, &imx8mm_sys_pll);
> -	clks[IMX8MM_SYS_PLL2] = imx_clk_pll14xx("sys_pll2",
> "sys_pll2_ref_sel", base + 0x104, &imx8mm_sys_pll);
> -	clks[IMX8MM_SYS_PLL3] = imx_clk_pll14xx("sys_pll3",
> "sys_pll3_ref_sel", base + 0x114, &imx8mm_sys_pll);
> +	clks[IMX8MM_AUDIO_PLL1] = imx_clk_pll14xx("audio_pll1",
> "audio_pll1_ref_sel", base, &imx_1443x_pll);
> +	clks[IMX8MM_AUDIO_PLL2] = imx_clk_pll14xx("audio_pll2",
> "audio_pll2_ref_sel", base + 0x14, &imx_1443x_pll);
> +	clks[IMX8MM_VIDEO_PLL1] = imx_clk_pll14xx("video_pll1",
> "video_pll1_ref_sel", base + 0x28, &imx_1443x_pll);
> +	clks[IMX8MM_DRAM_PLL] = imx_clk_pll14xx("dram_pll",
> "dram_pll_ref_sel", base + 0x50, &imx_1443x_pll);
> +	clks[IMX8MM_GPU_PLL] = imx_clk_pll14xx("gpu_pll",
> "gpu_pll_ref_sel", base + 0x64, &imx_1416x_pll);
> +	clks[IMX8MM_VPU_PLL] = imx_clk_pll14xx("vpu_pll",
> "vpu_pll_ref_sel", base + 0x74, &imx_1416x_pll);
> +	clks[IMX8MM_ARM_PLL] = imx_clk_pll14xx("arm_pll",
> "arm_pll_ref_sel", base + 0x84, &imx_1416x_pll);
> +	clks[IMX8MM_SYS_PLL1] = imx_clk_pll14xx("sys_pll1",
> "sys_pll1_ref_sel", base + 0x94, &imx_1416x_pll);
> +	clks[IMX8MM_SYS_PLL2] = imx_clk_pll14xx("sys_pll2",
> "sys_pll2_ref_sel", base + 0x104, &imx_1416x_pll);
> +	clks[IMX8MM_SYS_PLL3] = imx_clk_pll14xx("sys_pll3",
> +"sys_pll3_ref_sel", base + 0x114, &imx_1416x_pll);
> 
>  	/* PLL bypass out */
>  	clks[IMX8MM_AUDIO_PLL1_BYPASS] =
> imx_clk_mux_flags("audio_pll1_bypass", base, 4, 1, audio_pll1_bypass_sels,
> ARRAY_SIZE(audio_pll1_bypass_sels), CLK_SET_RATE_PARENT); diff --git
> a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c index
> b721302..4a61743 100644
> --- a/drivers/clk/imx/clk-pll14xx.c
> +++ b/drivers/clk/imx/clk-pll14xx.c
> @@ -41,6 +41,36 @@ struct clk_pll14xx {
> 
>  #define to_clk_pll14xx(_hw) container_of(_hw, struct clk_pll14xx, hw)
> 
> +const struct imx_pll14xx_rate_table imx_pll1416x_tbl[] = {
> +	PLL_1416X_RATE(1800000000U, 225, 3, 0),
> +	PLL_1416X_RATE(1600000000U, 200, 3, 0),
> +	PLL_1416X_RATE(1200000000U, 300, 3, 1),
> +	PLL_1416X_RATE(1000000000U, 250, 3, 1),
> +	PLL_1416X_RATE(800000000U,  200, 3, 1),
> +	PLL_1416X_RATE(750000000U,  250, 2, 2),
> +	PLL_1416X_RATE(700000000U,  350, 3, 2),
> +	PLL_1416X_RATE(600000000U,  300, 3, 2), };
> +
> +const struct imx_pll14xx_rate_table imx_pll1443x_tbl[] = {
> +	PLL_1443X_RATE(650000000U, 325, 3, 2, 0),
> +	PLL_1443X_RATE(594000000U, 198, 2, 2, 0),
> +	PLL_1443X_RATE(393216000U, 262, 2, 3, 9437),
> +	PLL_1443X_RATE(361267200U, 361, 3, 3, 17511), };
> +
> +struct imx_pll14xx_clk imx_1443x_pll = {
> +	.type = PLL_1443X,
> +	.rate_table = imx_pll1443x_tbl,
> +	.rate_count = ARRAY_SIZE(imx_pll1443x_tbl), };
> +
> +struct imx_pll14xx_clk imx_1416x_pll = {
> +	.type = PLL_1416X,
> +	.rate_table = imx_pll1416x_tbl,
> +	.rate_count = ARRAY_SIZE(imx_pll1416x_tbl), };
> +
>  static const struct imx_pll14xx_rate_table *imx_get_pll_settings(
>  		struct clk_pll14xx *pll, unsigned long rate)  { diff --git
> a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index f7a389a..bc5bb6a
> 100644
> --- a/drivers/clk/imx/clk.h
> +++ b/drivers/clk/imx/clk.h
> @@ -50,6 +50,9 @@ struct imx_pll14xx_clk {
>  	int flags;
>  };
> 
> +extern struct imx_pll14xx_clk imx_1416x_pll; extern struct
> +imx_pll14xx_clk imx_1443x_pll;
> +
>  #define imx_clk_cpu(name, parent_name, div, mux, pll, step) \
>  	imx_clk_hw_cpu(name, parent_name, div, mux, pll, step)->clk
> 
> --
> 2.7.4


  parent reply	other threads:[~2019-09-20  1:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-06 13:34 [PATCH V2 1/2] clk: imx8mm: Move 1443X/1416X PLL clock structure to common place Anson Huang
2019-09-06 13:34 ` [PATCH V2 2/2] clk: imx8mn: Use common 1443X/1416X PLL clock structure Anson Huang
2019-09-06 13:56 ` [PATCH V2 1/2] clk: imx8mm: Move 1443X/1416X PLL clock structure to common place Leonard Crestez
2019-09-20  1:27 ` Anson Huang [this message]
2019-09-20 16:55   ` Stephen Boyd
2019-10-06  2:16 ` Shawn Guo

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=AM6PR0402MB39110BCD655C354F8A295621F5880@AM6PR0402MB3911.eurprd04.prod.outlook.com \
    --to=anson.huang@nxp.com \
    --cc=abel.vesa@nxp.com \
    --cc=aisheng.dong@nxp.com \
    --cc=chen.fang@nxp.com \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=l.stach@pengutronix.de \
    --cc=leonard.crestez@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=peng.fan@nxp.com \
    --cc=ping.bai@nxp.com \
    --cc=s.hauer@pengutronix.de \
    --cc=sboyd@kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=shawnguo@kernel.org \
    --cc=shengjiu.wang@nxp.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;
as well as URLs for NNTP newsgroup(s).