From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate
Date: Thu, 9 May 2019 00:27:26 +0200 [thread overview]
Message-ID: <20190509002726.1d7aa7a0@jawa> (raw)
In-Reply-To: <AM0PR04MB4481CA9756DD261332D5FBD988320@AM0PR04MB4481.eurprd04.prod.outlook.com>
On Wed, 8 May 2019 07:45:39 +0000
Peng Fan <peng.fan@nxp.com> wrote:
> > -----Original Message-----
> > From: Lukasz Majewski [mailto:lukma at denx.de]
> > Sent: 2019年5月8日 15:40
> > To: Peng Fan <peng.fan@nxp.com>
> > Cc: sbabic at denx.de; festevam at gmail.com; dl-uboot-imx
> > <uboot-imx@nxp.com>; sjg at chromium.org; jagan at amarulasolutions.com;
> > sr at denx.de; u-boot at lists.denx.de; trini at konsulko.com
> > Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export
> > clk_fixed_rate
> >
> > On Wed, 8 May 2019 06:51:46 +0000
> > Peng Fan <peng.fan@nxp.com> wrote:
> >
> > > > -----Original Message-----
> > > > From: Lukasz Majewski [mailto:lukma at denx.de]
> > > > Sent: 2019年5月8日 14:46
> > > > To: Peng Fan <peng.fan@nxp.com>
> > > > Cc: sbabic at denx.de; festevam at gmail.com; dl-uboot-imx
> > > > <uboot-imx@nxp.com>; sjg at chromium.org;
> > jagan at amarulasolutions.com;
> > > > sr at denx.de; u-boot at lists.denx.de; trini at konsulko.com
> > > > Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export
> > > > clk_fixed_rate
> > > >
> > > > On Tue, 7 May 2019 13:27:45 +0000
> > > > Peng Fan <peng.fan@nxp.com> wrote:
> > > >
> > > > > > Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export
> > > > > > clk_fixed_rate
> > > > > >
> > > > > > Hi Peng,
> > > > > >
> > > > > > > Export the structure for others to use.
> > > > > > >
> > > > > > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > > > > > ---
> > > > > > > drivers/clk/clk_fixed_rate.c | 8 +-------
> > > > > > > include/linux/clk-provider.h | 7 +++++++
> > > > > > > 2 files changed, 8 insertions(+), 7 deletions(-)
> > > > > > >
> > > > > > > diff --git a/drivers/clk/clk_fixed_rate.c
> > > > > > > b/drivers/clk/clk_fixed_rate.c index
> > > > > > > 089f060a23..069e643fbc 100644 ---
> > > > > > > a/drivers/clk/clk_fixed_rate.c +++
> > > > > > > b/drivers/clk/clk_fixed_rate.c @@ -6,13 +6,7 @@
> > > > > > > #include <common.h>
> > > > > > > #include <clk-uclass.h>
> > > > > > > #include <dm.h>
> > > > > > > -
> > > > > > > -struct clk_fixed_rate {
> > > > > > > - struct clk clk;
> > > > > > > - unsigned long fixed_rate;
> > > > > > > -};
> > > > > > > -
> > > > > > > -#define to_clk_fixed_rate(dev) ((struct
> > > > > > > clk_fixed_rate *)dev_get_platdata(dev)) +#include
> > > > > > > <linux/clk-provider.h>
> > > > > > >
> > > > > > > static ulong clk_fixed_rate_get_rate(struct clk *clk)
> > > > > > > { diff --git a/include/linux/clk-provider.h
> > > > > > > b/include/linux/clk-provider.h index
> > > > > > > 3ed0db86d2..b2bed768b6 100644 ---
> > > > > > > a/include/linux/clk-provider.h +++
> > > > > > > b/include/linux/clk-provider.h @@ -112,6 +112,13 @@
> > > > > > > struct clk_fixed_factor { #define
> > > > > > > to_clk_fixed_factor(_clk) container_of(_clk, struct
> > > > > > > clk_fixed_factor,\ clk)
> > > > > > >
> > > > > > > +struct clk_fixed_rate {
> > > > > > > + struct clk clk;
> > > > > > > + unsigned long fixed_rate;
> > > > > > > +};
> > > > > >
> > > > > > I think that this struct shall stay where it was. Moreover,
> > > > > > the clk-provider.h is not the API to be used by other parts
> > > > > > of the clock API.
> > > > > >
> > > > > > The clk_fixed_rate shall be accessed via get_rate() only
> > > > > > and in IMX6Q it is available in early SPL (parsed from
> > > > > > dts /clocks property
> > > > > > - the 24MHz OSC)
> > > > > > > +
> > > > > > > +#define to_clk_fixed_rate(dev) ((struct
> > > > > > > clk_fixed_rate *)dev_get_platdata(dev)) +
> > > > > > > int clk_register(struct clk *clk, const char *drv_name,
> > > > > > > ulong drv_data, const char *name,
> > > > > > > const char *parent_name);
> > > > > >
> > > > > > Please explain why iMX8MM needs such global export?
> > > > >
> > > > > In clk-imx8mm.c, first configure ARM clk to osc24M fixed clk
> > > > > to change pll clock.
> > > > > + /* Configure ARM to osc24M */
> > > > > + clk_get_by_id(IMX8MM_CLK_A53_SRC, &clkp);
> > > > > + uclass_get_device_by_name(UCLASS_CLK,
> > > > > "clock-osc-24m",
> > > > &devp);
> > > > > + clkp1 = &to_clk_fixed_rate(devp)->clk;
> > > > > + clk_set_parent(clkp, clkp1);
> > > >
> > > > This code looks a bit strange to me. Why imx8mm sets parent
> > > > here?
> > >
> > > The A53 clk could not change on the fly. There is a mux here, one
> > > is PLL, one is OSC, And there are others. If we want to change
> > > the pll clock which is currently being used by A53, we need first
> > > switch the A53 clk to source from OSC, then change pll clock,
> > > then switch A53 clk back to PLL.
> >
> > The above description looks like a "standard" procedure for
> > bypassing PLL when it is going to be locked.
> >
> > The same is also performed on IMX6Q:
> >
> > https://elixir.bootlin.com/linux/v5.1/source/drivers/clk/imx/clk-imx6q.c#L88
> >
> > But I've not ported that part from the original Linux source code.
>
> i.MX8MM is different.
>
> This is how Linux change cpu's clock.
> https://elixir.bootlin.com/linux/v5.1/source/drivers/clk/imx/clk-imx8mm.c#L655
>
> It has a new cpu clk driver, I do not want to introduce that
> complexity in U-Boot.
Ok.
>
> This patch is just a simplified step of the upper Linux code.
My point is that this driver pollutes the fixed-clock code and makes it
imx8 specific.
>
> The reason to configure the clk here is that ROM not configure the
> clock following datasheet even it not hurt, but better to configure
> it right in SPL.
So this code is for fixing bugs (incomplete initialisation) in SoC's
ROM?
>
> Thanks,
> Peng.
>
> >
> > >
> > > >
> > > > In the imx6q I write "osc" as a part of the clock tree:
> > > >
> > > > clk_dm(IMX6QDL_CLK_PLL2,
> > > > imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2_bus",
> > > > "osc", base + 0x30, 0x1));
> > > >
> > > > And here the parent is set as "osc".
> > > >
> > > > Moreover, the "osc" or in your case "clock-osc-24m" shall be
> > > > available in "clocks" DTS node and hence parsed / setup from
> > > > there (and be available in the clk uclass list).
> > > >
> > > > > +
> > > > > + /* Configure ARM PLL to 1.2GHz */
> > > > > + clk_get_by_id(IMX8MM_ARM_PLL, &clkp1);
> > > > > + clk_set_rate(clkp1, 1200000000UL);
> > > >
> > > > Shouldn't this be set in DTS ? As it is now - it seems like a
> > > > hardcoded value for early SPL clock setup. Am I right?
> > >
> > > You mean get freq from cpu opp and set cpu freq? I do not have
> > > good idea how to set in DTS.
> >
> > I'm thinking about following description of the "osc" fixed clock:
> > https://elixir.bootlin.com/linux/v5.1/source/arch/arm/boot/dts/imx6qdl.dtsi#
> > L64
> >
> > and
> >
> > http://git.denx.de/?p=u-boot/u-boot-imx.git;a=blob;f=arch/arm/dts/imx6qdl.
> > dtsi;h=c0a94780087382a6e2805b7d6572f3e5e294e302;hb=HEAD#l53
> >
> > The "fixed-clock" code has been adjusted to comply with the above
> > DTS (which is provided in pre-reloc SPL - even before console and
> > ddr setup).
> >
> > (I had to use debug uart for debugging).
> >
> > >
> > > Thanks,
> > > Peng.
> > >
> > > >
> > > > > + clk_get_by_id(IMX8MM_ARM_PLL_OUT, &clkp1);
> > > > > + clk_enable(clkp1);
> > > > > + clk_set_parent(clkp, clkp1);
> > > > > +
> > > > > + /* Configure DIV to 1.2GHz */
> > > > > + clk_get_by_id(IMX8MM_CLK_A53_DIV, &clkp1);
> > > > > + clk_set_rate(clkp1, 1200000000UL);
> > > > >
> > > > > Regards,
> > > > > Peng.
> > > > >
> > > > > >
> > > > > >
> > > > > > Best regards,
> > > > > >
> > > > > > Lukasz Majewski
> > > > > >
> > > > > > --
> > > > > >
> > > > > > DENX Software Engineering GmbH, Managing Director:
> > Wolfgang
> > > > > > Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194
> > > > > > Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
> > > > > > (+49)-8142-66989-80 Email: lukma at denx.de
> > > >
> > > >
> > > >
> > > >
> > > > Best regards,
> > > >
> > > > Lukasz Majewski
> > > >
> > > > --
> > > >
> > > > DENX Software Engineering GmbH, Managing Director: Wolfgang
> > > > Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194
> > > > Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
> > > > (+49)-8142-66989-80 Email: lukma at denx.de
> >
> >
> >
> >
> > Best regards,
> >
> > Lukasz Majewski
> >
> > --
> >
> > DENX Software Engineering GmbH, Managing Director: Wolfgang
> > Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell,
> > Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> > lukma at denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190509/30c7aa3c/attachment.sig>
next prev parent reply other threads:[~2019-05-08 22:27 UTC|newest]
Thread overview: 84+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-30 10:17 [U-Boot] [i.MX8MM+CCF 00/41] i.MX8MM + CCF Peng Fan
2019-04-30 10:17 ` [U-Boot] [i.MX8MM+CCF 01/41] clk: correct get clk_x pointer Peng Fan
2019-05-06 21:36 ` Lukasz Majewski
2019-04-30 10:17 ` [U-Boot] [i.MX8MM+CCF 02/41] clk: fixed-factor: fix get clk_fixed_factor Peng Fan
2019-05-06 21:41 ` Lukasz Majewski
2019-04-30 10:17 ` [U-Boot] [i.MX8MM+CCF 03/41] clk: introduce clk_dev_binded Peng Fan
2019-05-06 21:57 ` Lukasz Majewski
2019-05-07 13:22 ` Peng Fan
2019-05-08 7:30 ` Lukasz Majewski
2019-05-08 7:41 ` Peng Fan
2019-05-08 22:24 ` Lukasz Majewski
2019-04-30 10:17 ` [U-Boot] [i.MX8MM+CCF 04/41] clk: use clk_dev_binded Peng Fan
2019-05-06 21:59 ` Lukasz Majewski
2019-05-08 7:27 ` Lukasz Majewski
2019-04-30 10:17 ` [U-Boot] [i.MX8MM+CCF 05/41] clk-provider: sync more clk flags from Linux Kernel Peng Fan
2019-05-06 22:01 ` Lukasz Majewski
2019-04-30 10:17 ` [U-Boot] [i.MX8MM+CCF 06/41] cmd: clk: print err value when clk_get_rate failed Peng Fan
2019-05-06 22:03 ` Lukasz Majewski
2019-04-30 10:17 ` [U-Boot] [i.MX8MM+CCF 07/41] clk: mux: add set parent support Peng Fan
2019-05-06 22:04 ` Lukasz Majewski
2019-05-07 13:23 ` Peng Fan
2019-04-30 10:17 ` [U-Boot] [i.MX8MM+CCF 08/41] clk: export mux/divider ops Peng Fan
2019-05-06 22:06 ` Lukasz Majewski
2019-05-07 13:25 ` Peng Fan
2019-05-08 6:31 ` Lukasz Majewski
2019-05-08 6:35 ` Peng Fan
2019-04-30 10:18 ` [U-Boot] [i.MX8MM+CCF 09/41] clk: add clk-gate support Peng Fan
2019-04-30 10:18 ` [U-Boot] [i.MX8MM+CCF 10/41] divider set rate supporrt Peng Fan
2019-05-06 22:08 ` Lukasz Majewski
2019-04-30 10:18 ` [U-Boot] [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate Peng Fan
2019-05-06 22:15 ` Lukasz Majewski
2019-05-07 13:27 ` Peng Fan
2019-05-08 6:46 ` Lukasz Majewski
2019-05-08 6:51 ` Peng Fan
2019-05-08 7:40 ` Lukasz Majewski
2019-05-08 7:45 ` Peng Fan
2019-05-08 22:27 ` Lukasz Majewski [this message]
2019-05-09 1:13 ` Peng Fan
2019-05-16 8:55 ` Lukasz Majewski
2019-05-16 9:58 ` Peng Fan
2019-05-16 10:08 ` Lukasz Majewski
2019-04-30 10:18 ` [U-Boot] [i.MX8MM+CCF 12/41] clk: fixed_rate: add pre reloc flag Peng Fan
2019-05-06 22:16 ` Lukasz Majewski
2019-05-07 13:29 ` Peng Fan
2019-05-07 14:00 ` Bin Meng
2019-05-08 7:00 ` Lukasz Majewski
2019-05-08 6:57 ` Lukasz Majewski
2019-05-08 7:21 ` Peng Fan
2019-04-30 10:18 ` [U-Boot] [i.MX8MM+CCF 13/41] clk: imx: import clk heplers Peng Fan
2019-05-06 22:17 ` Lukasz Majewski
2019-04-30 10:18 ` [U-Boot] [i.MX8MM+CCF 14/41] clk: imx: gate2 add set rate Peng Fan
2019-04-30 10:18 ` [U-Boot] [i.MX8MM+CCF 15/41] linux: compat: guard PAGE_SIZE Peng Fan
2019-04-30 10:18 ` [U-Boot] [i.MX8MM+CCF 16/41] drivers: core: use strcmp when find device by name Peng Fan
2019-04-30 10:18 ` [U-Boot] [i.MX8MM+CCF 17/41] ddr: imx8m: fix ddr firmware location when enable SPL OF Peng Fan
2019-04-30 10:18 ` [U-Boot] [i.MX8MM+CCF 18/41] imx: add IMX8MQ kconfig entry Peng Fan
2019-04-30 10:18 ` [U-Boot] [i.MX8MM+CCF 19/41] imx: add IMX8MM " Peng Fan
2019-04-30 10:18 ` [U-Boot] [i.MX8MM+CCF 20/41] imx: imx8mm: add clock bindings header Peng Fan
2019-04-30 10:18 ` [U-Boot] [i.MX8MM+CCF 21/41] imx: add i.MX8MM cpu type Peng Fan
2019-04-30 10:18 ` [U-Boot] [i.MX8MM+CCF 22/41] imx: spl: add spl_board_boot_device for i.MX8MM Peng Fan
2019-04-30 10:18 ` [U-Boot] [i.MX8MM+CCF 23/41] imx8m: update imx-regs " Peng Fan
2019-04-30 10:18 ` [U-Boot] [i.MX8MM+CCF 24/41] imx: add get_cpu_rev support " Peng Fan
2019-04-30 10:18 ` [U-Boot] [i.MX8MM+CCF 25/41] imx8m: rename clock to clock_imx8mq Peng Fan
2019-04-30 10:19 ` [U-Boot] [i.MX8MM+CCF 26/41] imx8m: restructure clock.h Peng Fan
2019-04-30 10:19 ` [U-Boot] [i.MX8MM+CCF 27/41] imx8m: add clk support for i.MX8MM Peng Fan
2019-04-30 10:19 ` [U-Boot] [i.MX8MM+CCF 28/41] imx8m: soc: probe clk before relocation Peng Fan
2019-04-30 10:19 ` [U-Boot] [i.MX8MM+CCF 29/41] imx8m: add pin header for i.MX8MM Peng Fan
2019-04-30 10:19 ` [U-Boot] [i.MX8MM+CCF 30/41] imx: add i.MX8MM PE property Peng Fan
2019-04-30 10:19 ` [U-Boot] [i.MX8MM+CCF 31/41] imx8m: Fix MMU table issue for OPTEE memory Peng Fan
2019-04-30 10:19 ` [U-Boot] [i.MX8MM+CCF 32/41] imx8m: set BYPASS ID SWAP to avoid AXI bus errors Peng Fan
2019-04-30 10:19 ` [U-Boot] [i.MX8MM+CCF 33/41] imx8m: Configure trustzone region 0 for non-secure access Peng Fan
2019-04-30 10:19 ` [U-Boot] [i.MX8MM+CCF 34/41] imx8m: soc: enable SCTR clock before timer init Peng Fan
2019-04-30 10:19 ` [U-Boot] [i.MX8MM+CCF 35/41] serial: Kconfig: make MXC_UART usable for MX7 and IMX8M Peng Fan
2019-04-30 10:19 ` [U-Boot] [i.MX8MM+CCF 36/41] clk: imx: add Kconfig entry for i.MX8MM Peng Fan
2019-04-30 10:19 ` [U-Boot] [i.MX8MM+CCF 37/41] clk: imx: add pll14xx driver Peng Fan
2019-04-30 10:19 ` [U-Boot] [i.MX8MM+CCF 38/41] clk: add composite clk support Peng Fan
2019-04-30 10:19 ` [U-Boot] [i.MX8MM+CCF 39/41] clk: imx: add i.MX8MM " Peng Fan
2019-04-30 10:19 ` [U-Boot] [i.MX8MM+CCF 40/41] clk: imx: add i.MX8MM clk driver Peng Fan
2019-04-30 10:19 ` [U-Boot] [i.MX8MM+CCF 41/41] imx: add i.MX8MM EVK board support Peng Fan
2019-05-06 7:57 ` [U-Boot] [i.MX8MM+CCF 00/41] i.MX8MM + CCF Schrempf Frieder
2019-05-06 8:26 ` Schrempf Frieder
2019-05-06 9:08 ` Peng Fan
2019-05-06 9:55 ` Lukasz Majewski
2019-05-06 21:32 ` Lukasz Majewski
2019-05-07 13:16 ` Peng Fan
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=20190509002726.1d7aa7a0@jawa \
--to=lukma@denx.de \
--cc=u-boot@lists.denx.de \
/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