mbox series

[v2,0/4] clk: Support spread spectrum and use it in clk-pll144x and clk-scmi

Message ID 20250205-clk-ssc-v2-0-fa73083caa92@nxp.com (mailing list archive)
Headers show
Series clk: Support spread spectrum and use it in clk-pll144x and clk-scmi | expand

Message

Peng Fan (OSS) Feb. 5, 2025, 9:49 a.m. UTC
- Introduce clk_set_spread_spectrum to set the parameters for enabling
  spread spectrum of a clock.
- Parse 'assigned-clock-sscs' and configure it by default before using the
  clock. The pull request for this property is at [1]
  This property is parsed before parsing clock rate.

- Enable this feature for clk-scmi on i.MX95.
  This may not the best, since checking machine compatibles.
  I am thinking to provide an API scmi_get_vendor_info, then driver
  could use it for OEM stuff, such as
  if (scmi_get_vendor_info returns NXP_IMX)
      ops->set_spread_spectrum = scmi_clk_set_spread_spectrum;

[1] https://github.com/devicetree-org/dt-schema/pull/154

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
Changes in v2:
- Rename to clk_hw_set_spread_spectrum and not export it as consumer API.
- Fix error handling
- The enable parameter is still kept, because 0% is valid per
  https://www.ti.com/lit/an/scaa103/scaa103.pdf?ts=1738667308903
  https://www.synopsys.com/blogs/chip-design/understanding-pcie-spread-spectrum-clocking.html
- Include the i.MX clk pll14xx which was an effort to enable SSC on
i.MX8MN from https://lore.kernel.org/all/20250118124044.157308-1-dario.binacchi@amarulasolutions.com/
  With this patchset, things could be simplied a lot.
- Update the clk-scmi extconfig, marked as not apply, because spec not settle down.
- Link to v1: https://lore.kernel.org/linux-clk/20250124-clk-ssc-v1-0-2d39f6baf2af@nxp.com/T/#mce926ef10d3d9c1c960c21867c2f1509f1f87cb9

---
Peng Fan (4):
      clk: Introduce clk_hw_set_spread_spectrum
      clk: conf: Support assigned-clock-sscs
      clk: imx: pll14xx: support spread spectrum clock generation
      [NOT APPLY] clk: scmi: Support spread spectrum

 drivers/clk/clk-conf.c        | 70 +++++++++++++++++++++++++++++++++++++++++++
 drivers/clk/clk-scmi.c        | 47 +++++++++++++++++++++++++++--
 drivers/clk/clk.c             | 34 +++++++++++++++++++++
 drivers/clk/imx/clk-pll14xx.c | 66 ++++++++++++++++++++++++++++++++++++++++
 include/linux/clk-provider.h  | 32 ++++++++++++++++++++
 include/linux/clk.h           | 22 ++++++++++++++
 include/linux/scmi_protocol.h |  6 ++++
 7 files changed, 275 insertions(+), 2 deletions(-)
---
base-commit: 40b8e93e17bff4a4e0cc129e04f9fdf5daa5397e
change-id: 20250124-clk-ssc-f3d70fb6cd1c

Best regards,