[U-Boot] [PATCH v5 00/18] clk: Port Linux common clock framework [CCF] to U-boot (tag: v5.1.12)

Lukasz Majewski lukma at denx.de
Mon Jun 24 13:50:34 UTC 2019


This patch series brings the files from Linux kernel (SHA1: 5752b50477da
Linux 5.1.12 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 added to clk-uclass.c file.

CCF impact to U-Boot size:
--------------------------
		SPL		U-Boot.img
Without CCF:		51 KiB		358 KiB
With CCF:		55 KiB		363 KiB
Size increase:		1.3%		7.2%

The SPL implementation is not yet optimized (no OF_PLATDATA, etc).

Repository:
https://github.com/lmajewski/u-boot-dfu/commits/CCF-v5

Applicable on top of u-boot/master:
SHA1: 77f6e2dd0551d8a825bab391a1bd6b838874bcd4

Travis-CI:
https://travis-ci.org/lmajewski/u-boot-dfu/builds/549603356


Changes in v6:
- Use dev->uclass_priv pointer to store pointer to clk

Changes in v5:
- s/U-boot/U-Boot/g
- Update Linux version to 5.1.12
- Add paragraph regarding sandbox CCF testing (common uclass code)
- Use long long to store rate value (to avoid int overflow and also return
  errors correctly)
- Use u32 to avoid checkpatch warning
- s/U-boot/U-Boot/g
- Replace dev->driver_data with dev_get_clk_ptr() wrapper on uclass_priv
- Replace ulong with long long (to accommodate large freqs and return
  errors)
- s/U-boot/U-Boot/g
- Check if the relevant code has changed between Linux tag v5.0-rc3 and
  v5.1.12 (no changes - the version can be safely updated).
- Use imply CLK_IMX6Q in Kconfig for (SPL_)CCF
- Fix clk-fixed-factor implementation (kzalloc needed for correct Sandbox
  operation)
- Fix gate2 implementation
- Use dev->uclass_priv instead of dev->driver_data to store back pointer
  to the struct clk.
- Split and introduce earlier the clk-provider.h header file

Changes in v4:
- New patch
- Port some more Linux code to facilitate imx8 code porting (most notably
  flags)
- Explicitly use container_of() based macro to provide struct clk in various
  places (e.g. gate2, mux, etc)
  Following patches has been squashed:
  http://patchwork.ozlabs.org/patch/1093141/
  http://patchwork.ozlabs.org/patch/1093142/
  http://patchwork.ozlabs.org/patch/1093146/

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
- Replace dev->driver_data with dev_get_clk_ptr() wrapper on uclas_priv

Lukasz Majewski (18):
  clk: doc: Add documentation entry for Common Clock Framework [CCF]
    (i.MX)
  dm: Fix documentation entry as there is no UCLASS_CLOCK uclass
  clk: Remove clock ID check in .get_rate() of clk_fixed_*
  clk: Extend struct clk to provide information regarding clock rate
  clk: Extend struct clk to provide clock type agnostic flags
  clk: Provide struct clk for fixed rate clock (clk_fixed_rate.c)
  clk: Introduce clk-provider.h to store Common Clock Framework's
    internals
  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: Port Linux common clock framework [CCF] for imx6q to U-boot (tag:
    v5.1.12)
  dm: clk: Extend clk_get_parent_rate() to support CLK_GET_RATE_NOCACHE
    flag
  dts: sandbox: Add 'osc' clock for Common Clock Framework [CCF] testing
  clk: sandbox: Adjust clk-divider to emulate reading its value from HW
  clk: sandbox: Adjust clk-mux.c to emulate reading divider value from
    HW
  clk: sandbox: Add sandbox test code for Common Clock Framework [CCF]
  defconfig: sandbox: Enable SANDBOX_CLK_CCF to reuse generic CCF code
  clk: Add MAINTAINERS entry for clocks (./drivers/clk/)

 MAINTAINERS                        |   7 ++
 arch/sandbox/dts/test.dts          |  10 ++
 configs/sandbox_defconfig          |   1 +
 configs/sandbox_flattree_defconfig |   1 +
 doc/imx/clk/ccf.txt                | 101 ++++++++++++++++++++
 drivers/clk/Kconfig                |  22 +++++
 drivers/clk/Makefile               |   3 +
 drivers/clk/clk-divider.c          | 155 +++++++++++++++++++++++++++++++
 drivers/clk/clk-fixed-factor.c     |  80 ++++++++++++++++
 drivers/clk/clk-mux.c              | 172 ++++++++++++++++++++++++++++++++++
 drivers/clk/clk-uclass.c           |  60 ++++++++++++
 drivers/clk/clk.c                  |  57 ++++++++++++
 drivers/clk/clk_fixed_factor.c     |   3 -
 drivers/clk/clk_fixed_rate.c       |   8 +-
 drivers/clk/clk_sandbox_ccf.c      | 185 +++++++++++++++++++++++++++++++++++++
 drivers/clk/imx/Kconfig            |  16 ++++
 drivers/clk/imx/Makefile           |   2 +
 drivers/clk/imx/clk-gate2.c        | 103 +++++++++++++++++++++
 drivers/clk/imx/clk-imx6q.c        | 179 +++++++++++++++++++++++++++++++++++
 drivers/clk/imx/clk-pfd.c          |  90 ++++++++++++++++++
 drivers/clk/imx/clk-pllv3.c        |  82 ++++++++++++++++
 drivers/clk/imx/clk.h              |  69 ++++++++++++++
 include/clk.h                      |  37 +++++++-
 include/linux/clk-provider.h       | 132 ++++++++++++++++++++++++++
 include/sandbox-clk.h              |  76 +++++++++++++++
 test/dm/Makefile                   |   2 +-
 test/dm/clk_ccf.c                  |  62 +++++++++++++
 27 files changed, 1707 insertions(+), 8 deletions(-)
 create mode 100644 doc/imx/clk/ccf.txt
 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/clk_sandbox_ccf.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
 create mode 100644 include/sandbox-clk.h
 create mode 100644 test/dm/clk_ccf.c

-- 
2.11.0



More information about the U-Boot mailing list