linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacky Bai <ping.bai@nxp.com>
To: Stephen Boyd <sboyd@kernel.org>,
	"mturquette@baylibre.com" <mturquette@baylibre.com>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>
Cc: Fabio Estevam <fabio.estevam@nxp.com>,
	Aisheng Dong <aisheng.dong@nxp.com>,
	dl-linux-imx <linux-imx@nxp.com>,
	"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: RE: [PATCH 3/3] clk: imx: Add clock driver support for imx8mm
Date: Thu, 10 Jan 2019 02:14:37 +0000	[thread overview]
Message-ID: <VI1PR0402MB3519F5D070C8C52AE1444C6A87840@VI1PR0402MB3519.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <154706594997.15366.8932514505305165638@swboyd.mtv.corp.google.com>

> Subject: Re: [PATCH 3/3] clk: imx: Add clock driver support for imx8mm
> 
> Quoting Jacky Bai (2019-01-08 01:01:04)
> > +
> > +static int imx8mm_clocks_probe(struct platform_device *pdev) {
> > +       struct device *dev = &pdev->dev;
> > +       struct device_node *np = dev->of_node;
> > +       void __iomem *base;
> > +       int ret = 0;
> 
> Please don't assign ret here. Just let it be assigned later on.
> 

Sure.

> > +
> > +       clks[IMX8MM_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
> > +       clks[IMX8MM_CLK_24M] = of_clk_get_by_name(np, "osc_24m");
> > +       clks[IMX8MM_CLK_32K] = of_clk_get_by_name(np, "osc_32k");
> /* Check more */
> > +       clks[IMX8MM_CLK_EXT1] = of_clk_get_by_name(np, "clk_ext1");
> > +       clks[IMX8MM_CLK_EXT2] = of_clk_get_by_name(np, "clk_ext2");
> > +       clks[IMX8MM_CLK_EXT3] = of_clk_get_by_name(np, "clk_ext3");
> > +       clks[IMX8MM_CLK_EXT4] = of_clk_get_by_name(np, "clk_ext4");
> > +
> > +       np = of_find_compatible_node(NULL, NULL,
> "fsl,imx8mm-anatop");
> > +       base = of_iomap(np, 0);
> > +       if (WARN_ON(!base))
> > +               return -ENOMEM;
> 
> Why do we need to reach into some other node to get the memory region to
> map?
> 

The PLLs' config register is in a sperate memory region. As we registered all the PLLs clocks in this driver, the PLLs memory region
Need to be read out from its corresponding node. This is the method that we used on our all i.MX platform.

> > +
> > +       clks[IMX8MM_AUDIO_PLL1_REF_SEL] =
> imx_clk_mux("audio_pll1_ref_sel", base + 0x0, 0, 2, pll_ref_sels,
> ARRAY_SIZE(pll_ref_sels));
> > +       clks[IMX8MM_AUDIO_PLL2_REF_SEL] =
> imx_clk_mux("audio_pll2_ref_sel", base + 0x14, 0, 2, pll_ref_sels,
> ARRAY_SIZE(pll_ref_sels));
> > +       clks[IMX8MM_VIDEO_PLL1_REF_SEL] =
> imx_clk_mux("video_pll1_ref_sel", base + 0x28, 0, 2, pll_ref_sels,
> ARRAY_SIZE(pll_ref_sels));
> > +       clks[IMX8MM_DRAM_PLL_REF_SEL] =
> > + imx_clk_mux("dram_pll_ref_sel", base + 0x50, 0, 2, pll_ref_sels,
> > + ARRAY_SIZE(pll_ref_sels));
> [...]
> > +       clks[IMX8MM_SYS_PLL2_333M] =
> imx_clk_fixed_factor("sys_pll2_333m", "sys_pll2_out", 1, 3);
> > +       clks[IMX8MM_SYS_PLL2_500M] =
> imx_clk_fixed_factor("sys_pll2_500m", "sys_pll2_out", 1, 2);
> > +       clks[IMX8MM_SYS_PLL2_1000M] =
> > + imx_clk_fixed_factor("sys_pll2_1000m", "sys_pll2_out", 1, 1);
> > +
> > +       np = dev->of_node;
> > +       base = of_iomap(np, 0);
> > +       if (WARN_ON(!base))
> > +               return -ENOMEM;
> 
> This can surely use the platform device APIs to map and retrieve memory
> regions.
> 

Ok, will fix it

> > +
> [...]
> > +
> > +       imx_check_clocks(clks, ARRAY_SIZE(clks));
> > +
> > +       clk_data.clks = clks;
> > +       clk_data.clk_num = ARRAY_SIZE(clks);
> > +       ret = of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
> > +       if (ret < 0) {
> > +               dev_err(dev, "failed to register clks for i.MX8MM\n");
> > +               return -EINVAL;
> > +       }
> > +
> > +       imx_register_uart_clocks(uart_clks);
> > +
> > +       pr_info("i.MX8MM clock driver init done\n");
> 
> Please no "I"m alive" messages.

I will remove it in V2.

BR
> 
> > +
> > +       return 0;
> > +}
> > +

  reply	other threads:[~2019-01-10  2:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-08  9:00 [PATCH 1/3] clk: imx: Add PLLs driver for imx8mm soc Jacky Bai
2019-01-08  9:00 ` [PATCH 2/3] dt-bindings: imx: Add clock binding doc for imx8mm Jacky Bai
2019-01-09 20:36   ` Stephen Boyd
2019-01-10  1:59     ` Jacky Bai
2019-01-21 20:33   ` Rob Herring
2019-01-08  9:01 ` [PATCH 3/3] clk: imx: Add clock driver support " Jacky Bai
2019-01-09 20:32   ` Stephen Boyd
2019-01-10  2:14     ` Jacky Bai [this message]
2019-01-09 20:35 ` [PATCH 1/3] clk: imx: Add PLLs driver for imx8mm soc Stephen Boyd
2019-01-10  2:09   ` Jacky Bai

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=VI1PR0402MB3519F5D070C8C52AE1444C6A87840@VI1PR0402MB3519.eurprd04.prod.outlook.com \
    --to=ping.bai@nxp.com \
    --cc=aisheng.dong@nxp.com \
    --cc=devicetree@vger.kernel.org \
    --cc=fabio.estevam@nxp.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=shawnguo@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;
as well as URLs for NNTP newsgroup(s).