mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/8] clk: ath79: move the PLL clock driver to drivers/clk
@ 2026-11-04  5:58 Rosen Penev
  2026-11-04  5:58 ` [PATCH 1/8] MIPS: ath79: apply the QCA956x timer workaround in setup Rosen Penev
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Rosen Penev @ 2026-11-04  5:58 UTC (permalink / raw)
  To: linux-mips, Thomas Bogendoerfer, Stephen Boyd
  Cc: Brian Masney, Jerome Brunet, Alban Bedel, Antony Pavlov,
	open list, open list:COMMON CLK FRAMEWORK

The ath79 PLL clock code lives in arch/mips/ath79/clock.c and uses the
arch headers and ath79_reset_base. This series makes it a normal clk
driver in drivers/clk and then cleans it up.

Patches 1-2 remove what ties it to the arch code. The QCA956x timer
interrupt workaround moves to plat_time_init(), and so does reading the
reference clock rate from the bootstrap pins, for boards whose device
tree leaves the rate out. The arch code also warns when a rate in the
device tree disagrees with the pins.

Patch 3 moves the driver, with copies of the PLL register definitions it
uses, and adds a MAINTAINERS entry from the qca,ath79-pll binding. It
stays a CLK_OF_DECLARE driver, as the MIPS timer needs the CPU clock.

Patches 4-8 clean it up:
- 4: use GENMASK() and FIELD_GET() for the register fields (the
  generated code is unchanged)
- 5: convert to clk_hw. This also fixes the AR724x and AR933x clocks,
  whose parent was looked up by the name "ref", so they were orphans
  when the device tree's reference clock node has a different name.
- 6: fix the error handling: an unchecked ioremap(), clk_put() of an
  error pointer, and panics or BUG_ON() where an error return will do
- 7: one init function per compatible instead of re-matching it
- 8: share the fractional PLL calculation, using 64-bit maths. This
  fixes a 32-bit overflow of the QCA955x DDR PLL rate whenever its
  NFRAC is above 107 with a 40 MHz reference clock, or above 171 with
  25 MHz.

The series touches both arch/mips and drivers/clk. Patches 3-8 depend on
1-2, so it would be easiest to take it all through one tree with an ack
from the other maintainer.

Not addressed: the QCA956x PLL formula. It ignores the NFRAC_H field
("hfrac >> 13" of a 13-bit field is always 0) and divides NFRAC_L by
25 << 13 instead of 2^18. Mainline U-Boot has the same code, so it is
no independent check. I left it unchanged until it can be checked
against register values from a QCA956x board.

Tool use, per Documentation/process/generated-content.rst: this series
was developed with Claude Code (Claude Opus 5.5). It wrote most of the
code changes and changelogs in patches 3-8, following my review of the
driver and my requests, and reviewed patches 1-2. It also wrote the
user space harness used to test patch 8, and it fetched and compared
the U-Boot sources for the QCA956x formula. I reviewed and tested all
of it and take responsibility for it.

Rosen Penev (8):
  MIPS: ath79: apply the QCA956x timer workaround in setup
  MIPS: ath79: move the bootstrap reference clock to setup
  clk: ath79: move the ath79 clock driver to drivers/clk
  clk: ath79: use FIELD_GET() for the PLL register fields
  clk: ath79: convert to clk_hw based registration
  clk: ath79: fix the error handling
  clk: ath79: give each compatible its own init function
  clk: ath79: share the fractional PLL calculation

 MAINTAINERS              |   8 +
 arch/mips/ath79/Makefile |   2 +-
 arch/mips/ath79/clock.c  | 673 ---------------------------------------
 arch/mips/ath79/setup.c  | 100 ++++++
 drivers/clk/Kconfig      |  12 +
 drivers/clk/Makefile     |   1 +
 drivers/clk/clk-ath79.c  | 593 ++++++++++++++++++++++++++++++++++
 drivers/clk/clk-ath79.h  | 140 ++++++++
 8 files changed, 855 insertions(+), 674 deletions(-)
 delete mode 100644 arch/mips/ath79/clock.c
 create mode 100644 drivers/clk/clk-ath79.c
 create mode 100644 drivers/clk/clk-ath79.h


base-commit: d6bcfc94eb4da6e089c5473970cd96727292fd97
-- 
2.56.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-11-04  5:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04  5:58 [PATCH 0/8] clk: ath79: move the PLL clock driver to drivers/clk Rosen Penev
2026-11-04  5:58 ` [PATCH 1/8] MIPS: ath79: apply the QCA956x timer workaround in setup Rosen Penev
2026-11-04  5:58 ` [PATCH 2/8] MIPS: ath79: move the bootstrap reference clock to setup Rosen Penev
2026-11-04  5:58 ` [PATCH 3/8] clk: ath79: move the ath79 clock driver to drivers/clk Rosen Penev
2026-11-04  5:58 ` [PATCH 4/8] clk: ath79: use FIELD_GET() for the PLL register fields Rosen Penev
2026-11-04  5:58 ` [PATCH 5/8] clk: ath79: convert to clk_hw based registration Rosen Penev
2026-11-04  5:58 ` [PATCH 6/8] clk: ath79: fix the error handling Rosen Penev
2026-11-04  5:58 ` [PATCH 7/8] clk: ath79: give each compatible its own init function Rosen Penev
2026-11-04  5:58 ` [PATCH 8/8] clk: ath79: share the fractional PLL calculation Rosen Penev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®