All of lore.kernel.org
 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 08:16:36 +0100	[thread overview]
Message-ID: <20190129081636.645234d4@jawa> (raw)
In-Reply-To: <4f7b8775-b968-fe9d-c147-9f764a4ee46d@denx.de>

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):

1. As it is now - for IMX6Q we need a static table to store clock
pointers. It is around 1KiB of SRAM/SDRAM. This is _a_lot_ for SPL.
For u-boot proper this is not a huge problem.

2. The SPL shall use OF_PLATDATA, as we do need clock management mostly
in SPL. Moreover, I do think that SPL will be bigger (this is a _real_
problem, IMHO).

3. The CCF design needs to be fitted into U-Boot's Driver Model - this
is achievable. The most annoying problem is the lack of .get_rate()
method in the CCF's API.

4. The CCF driver for imx6q uses 

clks: ccm at 020c4000 {

}

Node as a "manager". In its probe we create other (proper) clocks
(hierarchy). Also, this driver is a starting point for getting access
to other clocks.

As said above - I will first post the CCF port very similar to
Barebox/Linux. Afterwards, we can decide if and how we optimise it. 

> 
> >   
> >>
> >> Barebox imports the clock driver from the kernel and it is much
> >> cleaner:
> >> https://git.pengutronix.de/cgit/barebox/tree/drivers/clk/imx/clk-imx6.c  
> > 
> > Yes, it has been trimmed (...a bit...) when compared to original
> > v4.20 :-) .
> >   
> Best regards,
> Stefano
> 




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/e3c34ce3/attachment.sig>

  reply	other threads:[~2019-01-29  7:16 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 [this message]
2019-01-29  7:22           ` Jagan Teki
2019-01-29  8:05             ` Lukasz Majewski
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=20190129081636.645234d4@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.