public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 06/15] dm: clk: imx: Add support for controlling imx6q clocks via Driver Model
Date: Tue, 29 Jan 2019 09:05:12 +0100	[thread overview]
Message-ID: <20190129090512.4ddae656@jawa> (raw)
In-Reply-To: <CAMty3ZBmM9BmKnFvYH-gcVAMeLApzh49K94dJabX1bJS0K6M1w@mail.gmail.com>

Hi Jagan,

> On Tue, Jan 29, 2019 at 12:46 PM Lukasz Majewski <lukma@denx.de>
> wrote:
> >
> > Hi Stefano, Fabio,
> >  
> > > Hi Lukasz,
> > >
> > > On 21/01/19 15:19, Lukasz Majewski wrote:  
> > > > Hi Fabio,
> > > >  
> > > >> Hi Lukasz,
> > > >>
> > > >> On Sat, Jan 19, 2019 at 7:15 AM Lukasz Majewski <lukma@denx.de>
> > > >> wrote:  
> > > >>> +static ulong imx6q_clk_get_rate(struct clk *clk)
> > > >>> +{
> > > >>> +       ulong rate = 0;
> > > >>> +
> > > >>> +       debug("%s(#%lu)\n", __func__, clk->id);
> > > >>> +
> > > >>> +       switch (clk->id) {
> > > >>> +       case IMX6QDL_CLK_ECSPI1:
> > > >>> +       case IMX6QDL_CLK_ECSPI2:
> > > >>> +       case IMX6QDL_CLK_ECSPI3:
> > > >>> +       case IMX6QDL_CLK_ECSPI4:
> > > >>> +               return imx6_get_cspi_clk();
> > > >>> +
> > > >>> +       case IMX6QDL_CLK_USDHC1:
> > > >>> +       case IMX6QDL_CLK_USDHC2:
> > > >>> +       case IMX6QDL_CLK_USDHC3:
> > > >>> +       case IMX6QDL_CLK_USDHC4:
> > > >>> +               return imx6_get_usdhc_clk(clk->id -
> > > >>> IMX6QDL_CLK_USDHC1);  
> > > >>
> > > >> I don't think this scales well as this needs to grow for all
> > > >> other peripherals and for each port instance.  
> > > >  
> > >
> > > I am hiiting the same doubts as Fabio when I reviewed Peng's
> > > patches with clocks for i.MX8M. The current approach was
> > > introduced some years ago with i.MX5, but it does not fit well
> > > now and it does not scale.
> > >
> > >  
> > > > The rationale regarding this approach:
> > > >
> > > > 1. Reuse the clock.c code for iMX6Q as much as possible.
> > > >
> > > > 2, This code is based on the clk-imx8q.c file -  hence the
> > > > question why the Linux clock API was not ported for this new
> > > > SoC?.  
> > >
> > > Many reasons, first there was already a set of functions to get /
> > > set clocks coming from previos i.MX platforms, and this API was
> > > simply reused. And nobody was in charge to port the clock API.
> > >  
> > > >  
> > > >>
> > > >> If we are adding a clock driver for mx6, why don't we add it
> > > >> just like the kernel one?  
> > > >
> > > > I can try to port the Linux code, but IMHO it would be feasible
> > > > to port only relevant (ECSPI, USDHC) parts of it (not all as I
> > > > cannot test it all properly).  
> > >
> > > Fully agree. Further parts will be added on demand. Less is
> > > better. I disagree to add not tested code.  
> >
> > The work is in progress - I will add the same directory structure as
> > Linux's Common Clock Framework [CCF]. I shall finish in 2-3 days.
> >
> > There are a few problems to tackle (when porting code from Linux):  
> 
> Just to add my experience with previous CLK support series[1]. Do we
> really need to port it from Linux, because I'm thinking we can manage
> it as simple as other SoC support in U-Boot.(I have few clocks
> addition on this series other than ENET)
> 
> What do you think?

This patch series seems to me like the one which reuses the "large"
switch/case approach with "fsl,imx6q-ccm" driver [*].

The ENET shall also be handled by the CCF from Linux.

Another problem - the U-boot's clock DM API is not supporting passing
parent clock rate, which is important in the hierarchical clock tree.
The Linux CCF is a hierarchical one built in the driver's [*] probe.



Do we need to port the (trimmed) Common Clock Framework [CCF] from
Linux?

With the first version of this patch I also wanted to re-use the code
from clock.c imx6 file. This would be good enough for now.

However, in the long term (and taking into consideration the fact that
imx6 needs to be converted to DM anyway) it may be beneficial to re-use
CCF.

The _real_ problem is to fit it and reuse in SPL (to avoid footprint
size regression). The CCF port will work correctly in u-boot proper,
but for SPL we would need some hacks (as e.g. by default we now strip
clock properties from DTS when appending to SPL).

Now SPLs for IMX6 use solid code without any unneeded stuff (and
hence we didn't need TPL...) .

> 
> [1] https://patchwork.ozlabs.org/cover/950964/


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/20190129/649a9023/attachment.sig>

  reply	other threads:[~2019-01-29  8:05 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-19  9:15 [U-Boot] [PATCH v1 00/15] imx: dm: Update mccmon6 board to only use DM/DTS in u-boot proper Lukasz Majewski
2019-01-19  9:15 ` [U-Boot] [PATCH v1 01/15] ARM: imx: cosmetic: Remove not needed comment from the mccmon6.h file Lukasz Majewski
2019-01-19  9:15 ` [U-Boot] [PATCH v1 02/15] ARM: imx: config: Disable support for USB on MCCMON6 Lukasz Majewski
2019-01-19  9:15 ` [U-Boot] [PATCH v1 03/15] net: imx: Add support for waiting some time after FEC gpio reset Lukasz Majewski
2019-01-19  9:15 ` [U-Boot] [PATCH v1 04/15] clk: imx: Rename and export get_usdhc_clk() to imx6_get_usdhc_clk() Lukasz Majewski
2019-01-19  9:15 ` [U-Boot] [PATCH v1 05/15] clk: imx: Rename and export get_cspi_clk() to imx6_get_cspi_clk() Lukasz Majewski
2019-01-19  9:15 ` [U-Boot] [PATCH v1 06/15] dm: clk: imx: Add support for controlling imx6q clocks via Driver Model Lukasz Majewski
2019-01-21 13:36   ` Fabio Estevam
2019-01-21 14:19     ` Lukasz Majewski
2019-01-21 14:26       ` Fabio Estevam
2019-01-28 15:02       ` Stefano Babic
2019-01-29  7:16         ` Lukasz Majewski
2019-01-29  7:22           ` Jagan Teki
2019-01-29  8:05             ` Lukasz Majewski [this message]
2019-01-31 11:46               ` Jagan Teki
2019-01-31 12:59                 ` Lukasz Majewski
2019-01-19  9:15 ` [U-Boot] [PATCH v1 07/15] spi: imx: Add support for 'per' clock enabling via driver model Lukasz Majewski
2019-01-19  9:15 ` [U-Boot] [PATCH v1 08/15] ARM: imx: Covnert mccmon6 to use DM/DTS in the u-boot proper Lukasz Majewski
2019-01-19  9:15 ` [U-Boot] [PATCH v1 09/15] ARM: imx: Decouple mccmon6's SPL and u-boot proper code Lukasz Majewski
2019-01-19  9:15 ` [U-Boot] [PATCH v1 10/15] ARM: imx: Disable 1Gbps support on MCCMON6's KSZ9031 PHY Lukasz Majewski
2019-01-19  9:15 ` [U-Boot] [PATCH v1 11/15] Kconfig: Make CMD_SPL_NAND_OFS only available when proper memory is used Lukasz Majewski
2019-01-19  9:15 ` [U-Boot] [PATCH v1 12/15] Kconfig: cosmetic: Update description of CMD_SPL_NAND_OFS Lukasz Majewski
2019-01-19  9:15 ` [U-Boot] [PATCH v1 13/15] Kconfig: Add CMD_SPL_NOR_OFS config for falcon boot argument offset Lukasz Majewski
2019-01-19  9:15 ` [U-Boot] [PATCH v1 14/15] doc: Update parallel NOR flash related information in README.falcon Lukasz Majewski
2019-01-19  9:15 ` [U-Boot] [PATCH v1 15/15] imx: Convert mccmon6 to use fitImage instead of uImage+DTB Lukasz Majewski

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=20190129090512.4ddae656@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