From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 00/11] clk: Port Linux common clock framework [CCF] to U-boot (tag: 5.0-rc3)
Date: Wed, 8 May 2019 09:25:17 +0200 [thread overview]
Message-ID: <20190508092517.7baec06b@jawa> (raw)
In-Reply-To: <20190425102953.5348-1-lukma@denx.de>
Dear All,
> This patch series brings the files from Linux kernel to provide
> clocks support as it is used on the Linux kernel with common clock
> framework [CCF] setup.
>
> This series also fixes several problems with current clocks and
> provides sandbox tests for functions addded to clk-uclass.c file.
>
> Design decisions/issues:
> =========================
>
> - U-boot's DM for clk differs from Linux CCF. The most notably
> difference is the lack of support for hierarchical clocks and "clock
> as a manager driver" (single clock DTS node acts as a starting point
> for all other clocks).
>
> - The clk_get_rate() now caches the previously read data (no need for
> recursive access.
>
> - On purpose the "manager" clk driver (clk-imx6q.c) is not using large
> table to store pointers to clocks - e.g. clk[IMX6QDL_CLK_USDHC2_SEL]
> = .... Instead we use udevice's linked list for the same class
> (UCLASS_CLK). The rationale - when porting the code as is from Linux,
> one would need ~1KiB of RAM to store it. This is way too much if we
> do plan to use this driver in SPL.
>
> - The "central" structure of this patch series is struct udevice and
> its driver_data field contains the struct clk pointer (to the
> originally created one).
>
> - Up till now U-boot's driver model's CLK operates on udevice (main
> access to clock is by udevice ops)
> In the CCF the access to struct clk (comprising pointer to *dev) is
> possible via dev_get_driver_data()
>
> Storing back pointer (from udevice to struct clk) as driver_data is
> a convention for CCF.
>
> - I could use *private_alloc_size to allocate driver's 'private"
> structures (dev->priv) for e.g. divider (struct clk_divider
> *divider) for IMX6Q clock, but this would change the original
> structure of the CCF code.
>
> The question is if it would be better to use private_alloc_size (and
> dev->private) or stay with driver_data.
> The former requires some rewritting in CCF original code (to remove
> (c)malloc, etc), but comply with u-boot DM. The latter allows
> re-using the CCF code as is, but introduces some convention special
> for CCF (I'm not sure thought if dev->priv is NOT another convention
> as well).
>
> - I've added the clk_get_parent(), which reads parent's
> dev->driver_data to provide parent's struct clk pointer. This seems
> the easiest way to get child/parent relationship for struct clk in
> U-boot's udevice based clocks.
>
> - For tests I had to "emulate" CCF code structure to test
> functionality of clk_get_parent_rate() and clk_get_by_id(). Those
> functions will not work properly with "standard" (i.e. non CCF) clock
> setup(with not set dev->driver_data to struct clk).
>
I would be very grateful for comments regarding described above design
decisions.
Thanks in advance.
> Repository:
> https://github.com/lmajewski/u-boot-dfu/commits/CCF-v3
>
>
> Changes in v3:
> - New patch
> - The rate information is now cached into struct clk field
> - The clk_get_parent() is used to get pointer to the parent struct clk
> - Replace -ENODEV with -ENOENT
> - Use **clkp instead of **c
> - New patch
> - New patch
>
> Lukasz Majewski (11):
> dm: Fix documentation entry as there is no UCLASS_CLOCK uclass
> cmd: Do not show frequency for clocks which .get_rate() return error
> clk: Remove clock ID check in .get_rate() of clk_fixed_*
> clk: Extend struct clk to provide information regarding clock rate
> clk: Provide struct clk for fixed rate clock (clk_fixed_rate.c)
> dm: clk: Define clk_get_parent() for clk operations
> dm: clk: Define clk_get_parent_rate() for clk operations
> dm: clk: Define clk_get_by_id() for clk operations
> clk: test: Provide unit test for clk_get_by_id() method
> clk: test: Provide unit test for clk_get_parent_rate() method
> clk: Port Linux common clock framework [CCF] for imx6q to U-boot
> (tag: 5.0-rc3)
>
> arch/sandbox/include/asm/clk.h | 16 ++++
> cmd/clk.c | 5 +-
> drivers/clk/Kconfig | 14 ++++
> drivers/clk/Makefile | 2 +
> drivers/clk/clk-divider.c | 148
> ++++++++++++++++++++++++++++++++++ drivers/clk/clk-fixed-factor.c |
> 87 ++++++++++++++++++++ drivers/clk/clk-mux.c | 164
> +++++++++++++++++++++++++++++++++++++ drivers/clk/clk-uclass.c
> | 59 ++++++++++++++ drivers/clk/clk.c | 56
> +++++++++++++ drivers/clk/clk_fixed_factor.c | 3 -
> drivers/clk/clk_fixed_rate.c | 8 +-
> drivers/clk/clk_sandbox_test.c | 49 +++++++++++
> drivers/clk/imx/Kconfig | 9 +++
> drivers/clk/imx/Makefile | 2 +
> drivers/clk/imx/clk-gate2.c | 113 ++++++++++++++++++++++++++
> drivers/clk/imx/clk-imx6q.c | 179
> +++++++++++++++++++++++++++++++++++++++++
> drivers/clk/imx/clk-pfd.c | 91 +++++++++++++++++++++
> drivers/clk/imx/clk-pllv3.c | 83 +++++++++++++++++++
> drivers/clk/imx/clk.h | 75 +++++++++++++++++
> include/clk.h | 33 +++++++-
> include/linux/clk-provider.h | 94 ++++++++++++++++++++++
> test/dm/clk.c | 4 +- 22 files changed, 1285
> insertions(+), 9 deletions(-) create mode 100644
> drivers/clk/clk-divider.c create mode 100644
> drivers/clk/clk-fixed-factor.c create mode 100644
> drivers/clk/clk-mux.c create mode 100644 drivers/clk/clk.c
> create mode 100644 drivers/clk/imx/clk-gate2.c
> create mode 100644 drivers/clk/imx/clk-imx6q.c
> create mode 100644 drivers/clk/imx/clk-pfd.c
> create mode 100644 drivers/clk/imx/clk-pllv3.c
> create mode 100644 drivers/clk/imx/clk.h
> create mode 100644 include/linux/clk-provider.h
>
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/20190508/78f67312/attachment.sig>
next prev parent reply other threads:[~2019-05-08 7:25 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-25 10:29 [U-Boot] [PATCH v3 00/11] clk: Port Linux common clock framework [CCF] to U-boot (tag: 5.0-rc3) Lukasz Majewski
2019-04-25 10:29 ` [U-Boot] [PATCH v3 01/11] dm: Fix documentation entry as there is no UCLASS_CLOCK uclass Lukasz Majewski
2019-04-26 2:16 ` Peng Fan
2019-04-25 10:29 ` [U-Boot] [PATCH v3 02/11] cmd: Do not show frequency for clocks which .get_rate() return error Lukasz Majewski
2019-04-26 2:17 ` Peng Fan
2019-04-25 10:29 ` [U-Boot] [PATCH v3 03/11] clk: Remove clock ID check in .get_rate() of clk_fixed_* Lukasz Majewski
2019-04-26 2:17 ` Peng Fan
2019-04-25 10:29 ` [U-Boot] [PATCH v3 04/11] clk: Extend struct clk to provide information regarding clock rate Lukasz Majewski
2019-04-26 2:23 ` Peng Fan
2019-04-25 10:29 ` [U-Boot] [PATCH v3 05/11] clk: Provide struct clk for fixed rate clock (clk_fixed_rate.c) Lukasz Majewski
2019-04-26 2:29 ` Peng Fan
2019-04-25 10:29 ` [U-Boot] [PATCH v3 06/11] dm: clk: Define clk_get_parent() for clk operations Lukasz Majewski
2019-04-26 2:31 ` Peng Fan
2019-04-25 10:29 ` [U-Boot] [PATCH v3 07/11] dm: clk: Define clk_get_parent_rate() " Lukasz Majewski
2019-04-26 2:36 ` Peng Fan
2019-04-26 6:04 ` Lukasz Majewski
2019-04-25 10:29 ` [U-Boot] [PATCH v3 08/11] dm: clk: Define clk_get_by_id() " Lukasz Majewski
2019-04-26 2:39 ` Peng Fan
2019-04-25 10:29 ` [U-Boot] [PATCH v3 09/11] clk: test: Provide unit test for clk_get_by_id() method Lukasz Majewski
2019-04-25 10:29 ` [U-Boot] [PATCH v3 10/11] clk: test: Provide unit test for clk_get_parent_rate() method Lukasz Majewski
2019-04-25 10:29 ` [U-Boot] [PATCH v3 11/11] clk: Port Linux common clock framework [CCF] for imx6q to U-boot (tag: 5.0-rc3) Lukasz Majewski
2019-04-26 2:54 ` Peng Fan
2019-05-08 7:25 ` Lukasz Majewski [this message]
2019-05-18 16:08 ` [U-Boot] [PATCH v3 00/11] clk: Port Linux common clock framework [CCF] " Simon Glass
2019-05-18 21:28 ` Lukasz Majewski
2019-05-18 22:21 ` Simon Glass
2019-05-19 21:03 ` Lukasz Majewski
2019-05-20 16:09 ` Simon Glass
2019-05-21 14:48 ` Lukasz Majewski
2019-05-22 0:53 ` Simon Glass
2019-05-30 3:04 ` Peng Fan
2019-05-30 8:17 ` Marek Vasut
2019-06-03 7:22 ` Lukasz Majewski
2019-06-22 19:09 ` Simon Glass
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=20190508092517.7baec06b@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.